{"id":374098,"date":"2024-05-21T05:52:02","date_gmt":"2024-05-21T05:52:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=374098"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=374098","title":{"rendered":"<span>\u0413\u0430\u0439\u0434 texthero pandas<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h4>\u0423\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430\u00a0(NLP)<\/h4>\n<p>\u042f \u0432\u0441\u0435\u0433\u0434\u0430 \u043d\u0430\u0445\u043e\u0436\u0443\u0441\u044c \u0432 \u043f\u043e\u0438\u0441\u043a\u0435 \u043d\u043e\u0432\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u043c\u043d\u0435  \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443, \u043a\u043e\u0433\u0434\u0430 \u044f  \u043d\u0430\u0442\u043a\u043d\u0443\u043b\u0441\u044f \u043d\u0430 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 \u0432\u0438\u0434\u0435\u043e\u043a\u043b\u0438\u043f, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c Texthero,  \u044f \u0437\u043d\u0430\u043b, \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0435\u0433\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c. Texthero \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d \u043a\u0430\u043a \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430  Pandas, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435  \u0440\u044f\u0434\u044b Pandas \u0441\u0442\u0430\u043b\u043e \u043f\u0440\u043e\u0449\u0435, \u0447\u0435\u043c \u043a\u043e\u0433\u0434\u0430-\u043b\u0438\u0431\u043e. \u042f \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u0434\u043e\u0441\u0442\u0430\u043b \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e,  \u043e\u0442\u043a\u0440\u044b\u043b \u043d\u043e\u0443\u0442\u0431\u0443\u043a \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043b \u043f\u0430\u0440\u0443 \u0442\u044b\u0441\u044f\u0447 \u0434\u0438\u0441\u043a\u0443\u0441\u0441\u0438\u0439 \u0438\u0437 Reddit \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430,  \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443.<\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/strong><em>: <\/em>\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Texthero \u0432\u0441\u0435 \u0435\u0449\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0431\u0435\u0442\u0430-\u0432\u0435\u0440\u0441\u0438\u0438! \u0422\u0430\u043c \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043c\u043e\u0436\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c\u0441\u044f.<em> \u042f \u043d\u0430\u0448\u0435\u043b \u043e\u0448\u0438\u0431\u043a\u0443 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 wordcloud\u0438 \u0441\u043e\u043e\u0431\u0449\u0438\u043b \u043e\u0431 \u044d\u0442\u043e\u043c. \u042d\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e \u0432 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438!<\/em><\/p>\n<h4>\u041e\u0431\u0437\u043e\u0440 Texthero<\/h4>\n<p>\u042f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e \u0432\u0441\u0435 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u0435\u0435 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043a\u043e\u0434\u043e\u043c, \u043d\u043e \u0434\u043b\u044f \u043a\u0440\u0430\u0442\u043a\u043e\u0441\u0442\u0438, Texthero \u0440\u0430\u0437\u0431\u0438\u0442 \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u044f:<\/p>\n<p><a href=\"https:\/\/texthero.org\/docs\/api-preprocessing\" rel=\"noopener noreferrer nofollow\"><strong>\u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/strong><\/a><\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c <em>\u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438<\/em>\u200a\u2014\u200a\u044d\u0442\u043e \u0432\u0441\u0435, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u043b\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u0447\u0438\u0441\u0442\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0441\u0435\u0440\u0438\u0439 Pandas. \u041f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c \u043e\u043d \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <a href=\"https:\/\/docs.python.org\/3\/library\/re.html\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f (regex)<\/a>.<\/p>\n<p><a href=\"https:\/\/texthero.org\/docs\/api-nlp\" rel=\"noopener noreferrer nofollow\"><strong>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 (NLP)<\/strong><\/a><\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c <em>NLP<\/em> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0438 \u0438\u043c\u0435\u043d \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445. \u041e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <a href=\"https:\/\/spacy.io\/\" rel=\"noopener noreferrer nofollow\">Spacy<\/a>.<\/p>\n<p><a href=\"https:\/\/texthero.org\/docs\/api-representation\" rel=\"noopener noreferrer nofollow\"><strong>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435<\/strong><\/a><\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c <em>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f <\/em>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432 \u0441\u043b\u043e\u0432  \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432. \u041e\u043d \u0442\u0430\u043a\u0436\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u041c\u0435\u0442\u043e\u0434  \u0413\u043b\u0430\u0432\u043d\u044b\u0445 \u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0438 k-\u0421\u0440\u0435\u0434\u043d\u0438\u0445. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <a href=\"https:\/\/scikit-learn.org\/stable\/user_guide.html\" rel=\"noopener noreferrer nofollow\">scikit-learn \u0434\u043b\u044f TF-IDF \u0438 Count<\/a>, \u0430 \u0432\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u044f\u0437\u044b\u043a\u043e\u0432\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439.<\/p>\n<p><a href=\"https:\/\/texthero.org\/docs\/api-visualization\" rel=\"noopener noreferrer nofollow\"><strong>\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/strong><\/a><\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c <em>\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438<\/em> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u043e\u043a\u0430\u0437\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439 \u0432  \u0432\u0438\u0434\u0435 \u0442\u043e\u0447\u0435\u0447\u043d\u043e\u0439 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b \u0438\u043b\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043e\u0431\u043b\u0430\u043a\u043e\u0432 \u0441\u043b\u043e\u0432. \u042d\u0442\u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044c \u0432  \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0438\u043c\u0435\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <a href=\"https:\/\/plotly.com\/python\/plotly-fundamentals\/\" rel=\"noopener noreferrer nofollow\">Plotly<\/a> \u0438 WordCloud.<\/p>\n<p>\u041e\u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c \u0441 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439:<a href=\"https:\/\/texthero.org\/\" rel=\"noopener noreferrer nofollow\"><strong>Texthero \u00b7 <em>Text preprocessing, representation and visualization from zero to hero.<\/em><\/strong>Text preprocessing, representation and visualization from zero to hero.texthero.org<\/a><\/p>\n<h4>\u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438\u00a0\u0434\u0430\u043d\u043d\u044b\u0435<\/h4>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f pip \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0431\u044b\u043b\u0430 \u043f\u0440\u043e\u0441\u0442\u0430, \u043d\u043e \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u043e\u043c \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0435\u0435 \u0432 \u043c\u043e\u0435\u0439 \u0441\u0440\u0435\u0434\u0435 \u0441 <a href=\"https:\/\/github.com\/nitred\/airflow-pandas\" rel=\"noopener noreferrer nofollow\">Apache Airflow<\/a>  \u0438\u0437-\u0437\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 pandas. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435  \u0432\u0440\u0435\u043c\u044f, \u0447\u0442\u043e\u0431\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u043d\u043e\u0432\u043e\u0439 \u0441\u0440\u0435\u0434\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043c\u043d\u043e\u0433\u043e  \u0434\u0440\u0443\u0433\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u043d\u0430 \u0431\u044d\u043a\u0435\u043d\u0434\u0435. \u041e\u043d \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u043f\u0430\u0440\u0443 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445  \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u043e\u0441\u043b\u0435 \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u0432 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e <a href=\"https:\/\/praw.readthedocs.io\/en\/latest\/\" rel=\"noopener noreferrer nofollow\">PRAW<\/a> \u0434\u043b\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 <a href=\"https:\/\/www.reddit.com\/\" rel=\"noopener noreferrer nofollow\">Reddit<\/a>.<\/p>\n<pre><code class=\"python\">!pip install texthero import praw import pandas as pd import texthero as hero from config import cid, csec, ua # \u0414\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f PRAW <\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0435 Texthero \u0432\u043f\u0435\u0440\u0432\u044b\u0435, \u043e\u043d \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u043a\u043e\u0435-\u0447\u0442\u043e \u0438\u0437 <a href=\"https:\/\/www.nltk.org\/\" rel=\"noopener noreferrer nofollow\">NLTK<\/a> \u0438 <a href=\"https:\/\/spacy.io\/\" rel=\"noopener noreferrer nofollow\">Spacy<\/a>:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/305\/664\/75a\/30566475a94ec1fa594c6e469d104d81.png\" alt=\"\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0438 Texthero \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c \u0438\u043c\u043f\u043e\u0440\u0442\u0435\" title=\"\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0438 Texthero \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c \u0438\u043c\u043f\u043e\u0440\u0442\u0435\" width=\"577\" height=\"124\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/305\/664\/75a\/30566475a94ec1fa594c6e469d104d81.png\"\/><\/p>\n<div><figcaption>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0438 Texthero \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c \u0438\u043c\u043f\u043e\u0440\u0442\u0435<\/figcaption><\/div>\n<\/figure>\n<h4>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p>\u042f \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u044e \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0441\u0443\u0431\u0440\u0435\u0434\u0434\u0438\u0442\u0430 <strong>Teaching<\/strong>, \u0447\u0442\u043e\u0431\u044b  \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0441\u043c\u043e\u0436\u0435\u043c \u043b\u0438 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u0442\u0435\u043c\u044b \u0432\u043e\u043a\u0440\u0443\u0433 \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0439\u0441\u0442\u0432\u0430 \u043e  \u043d\u0430\u0447\u0430\u043b\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0432 \u0448\u043a\u043e\u043b\u0435 \u043e\u0441\u0435\u043d\u044c\u044e \u0432 \u0441\u0442\u0440\u0430\u0434\u0430\u044e\u0449\u0435\u0439 \u043e\u0442 COVID \u0410\u043c\u0435\u0440\u0438\u043a\u0435.<\/p>\n<pre><code class=\"python\"># \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 reddit reddit = praw.Reddit(client_id= cid,                      client_secret= csec,                      user_agent= ua) # \u0421\u043f\u0438\u0441\u043e\u043a \u0434\u043b\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u0438 \u0444\u0440\u0435\u0439\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 posts = [] # \u0412\u043e\u0437\u0432\u0440\u0430\u0442 1000 \u043d\u043e\u0432\u044b\u0445 \u043f\u043e\u0441\u0442\u043e\u0432 \u0438\u0437 teaching new = reddit.subreddit('teaching').new(limit=1000) # \u0412\u043e\u0437\u0432\u0440\u0430\u0442 \u0432\u0430\u0436\u043d\u044b\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 for post in new: posts.append([post.title, post.score, post.num_comments, post.selftext, post.created, post.pinned, post.total_awards_received]) # \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0440\u0435\u0439\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 df = pd.DataFrame(posts,columns=['title', 'score', 'comments', 'post', 'created', 'pinned', 'total awards']) # \u0412\u043e\u0437\u0432\u0440\u0430\u0442 3-\u0445 \u0432\u0435\u0440\u0445\u043d\u0438\u0445 \u0440\u044f\u0434\u043e\u0432 \u0438\u0437 \u0444\u0440\u0435\u0439\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 df.head(3)<\/code><\/pre>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e<strong> PRAW<\/strong> \u043c\u043e\u0436\u043d\u043e \u0441 \u043b\u0435\u0433\u043a\u043e\u0441\u0442\u044c\u044e \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 Reddit \u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0438\u0445 \u0432\u043e \u0444\u0440\u0435\u0439\u043c pandas.<\/p>\n<p>\u0422\u0443\u0442 \u044f \u043f\u043e\u043b\u0443\u0447\u0430\u044e 1000 \u043d\u043e\u0432\u044b\u0445 \u043f\u043e\u0441\u0442\u043e\u0432 \u0438\u0437 <strong>teaching<\/strong>. <strong>df.head(3) <\/strong>\u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0444\u0440\u0435\u0439\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/dfb\/f99\/ae2\/dfbf99ae28acea2205337a02222d64d2.png\" alt=\"\u041f\u0435\u0440\u0432\u044b\u0435 3 \u0440\u044f\u0434\u0430 \u0444\u0440\u0435\u0439\u043c\u0430\u00a0\u0434\u0430\u043d\u043d\u044b\u0445\" title=\"\u041f\u0435\u0440\u0432\u044b\u0435 3 \u0440\u044f\u0434\u0430 \u0444\u0440\u0435\u0439\u043c\u0430\u00a0\u0434\u0430\u043d\u043d\u044b\u0445\" width=\"640\" height=\"79\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/dfb\/f99\/ae2\/dfbf99ae28acea2205337a02222d64d2.png\"\/><\/p>\n<div><figcaption>\u041f\u0435\u0440\u0432\u044b\u0435 3 \u0440\u044f\u0434\u0430 \u0444\u0440\u0435\u0439\u043c\u0430\u00a0\u0434\u0430\u043d\u043d\u044b\u0445<\/figcaption><\/div>\n<\/figure>\n<h4>\u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e\u00a0Texthero<\/h4>\n<p>\u041d\u0430\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0444\u0438\u0448\u043a\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 texthero\u200a\u2014\u200a\u044d\u0442\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430  \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u041d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0445  \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439? Texthero \u0442\u0435\u0431\u044f \u043f\u0440\u0438\u043a\u0440\u043e\u0435\u0442! \u041f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0437\u043e\u0432\u0438\u0442\u0435 \u043c\u0435\u0442\u043e\u0434\u00a0.clean() \u0438  \u043f\u0435\u0440\u0435\u0434\u0430\u0439\u0442\u0435 \u0435\u043c\u0443 \u0440\u044f\u0434 \u0444\u0440\u0435\u0439\u043c\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code class=\"javascript\">df['clean_title'] = hero.clean(df['title'])<\/code><\/pre>\n<p>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 clean() \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0435\u043c\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0439:<\/p>\n<ol>\n<li>\n<p><code>fillna(s)<\/code> \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442 \u043d\u0435\u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0443\u0441\u0442\u044b\u043c\u0438 \u043f\u0440\u043e\u0431\u0435\u043b\u0430\u043c\u0438;<\/p>\n<\/li>\n<li>\n<p><code>lowercase(s)<\/code> \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442 \u0432\u0435\u0441\u044c \u0442\u0435\u043a\u0441\u0442 \u0432 \u043d\u0438\u0436\u043d\u0438\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440;<\/p>\n<\/li>\n<li>\n<p><code>remove_digits()<\/code> \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0432\u0441\u0435 \u0431\u043b\u043e\u043a\u0438 \u0446\u0438\u0444\u0440;<\/p>\n<\/li>\n<li>\n<p><code>remove_punctuation()<\/code> \u0443\u0431\u0438\u0440\u0430\u0435\u0442 \u0432\u0441\u044e \u043f\u0443\u043d\u043a\u0442\u0443\u0430\u0446\u0438\u044e (!\u00bb#$%&amp;'()*+,-.\/:;&lt;=>?@[\\]^_`{|}~);<\/p>\n<\/li>\n<li>\n<p><code>remove_diacritics()<\/code> \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0432\u0441\u0435 \u0437\u043d\u0430\u043a\u0438 \u0443\u0434\u0430\u0440\u0435\u043d\u0438\u0439\u0438\u0437 \u0441\u0442\u0440\u043e\u043a;<\/p>\n<\/li>\n<li>\n<p><code>remove_stopwords()<\/code> \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0432\u0441\u0435 \u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432\u0430;<\/p>\n<\/li>\n<li>\n<p><code>remove_whitespace()<\/code> \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0432\u0441\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u044b \u043c\u0435\u0436\u0434\u0443 \u0441\u043b\u043e\u0432\u0430\u043c\u0438.<\/p>\n<\/li>\n<\/ol>\n<h4>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u0430\u044f \u0447\u0438\u0441\u0442\u043a\u0430<\/h4>\n<p>\u0415\u0441\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u043c\u043e\u0436\u043d\u043e  \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u043e\u0439 \u0447\u0438\u0441\u0442\u043a\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438  \u044f \u0445\u043e\u0447\u0443 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A8%D1%83%D0%BC%D0%BE%D0%B2%D1%8B%D0%B5_%D1%81%D0%BB%D0%BE%D0%B2%D0%B0\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432\u0430<\/a> \u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0435, \u044f \u043c\u043e\u0433\u0443 \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c <strong>remove_stopwords<\/strong> \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c <strong>texthero.preprocessing.stem()<\/strong> \u043a \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435:<\/p>\n<pre><code class=\"python\">from texthero import preprocessing # \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0447\u0438\u0441\u0442\u043a\u0438 custom_pipeline = [preprocessing.fillna , preprocessing.lowercase , preprocessing.remove_digits , preprocessing.remove_punctuation , preprocessing.remove_diacritics #, preprocessing.remove_stopwords , preprocessing.remove_whitespace , preprocessing.stem] # \u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 custom_pipeline \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0443 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b df['clean_title'] = hero.clean(df['title'], pipeline = custom_pipeline) # \u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 custom_pipeline \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0443 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b df['clean_title'] = hero.clean(df['title'], pipeline = custom_pipeline) df.head()<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e <strong>custom_pipeline <\/strong>\u2014 \u044d\u0442\u043e \u0441\u043f\u0438\u0441\u043e\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u041e\u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c \u0441 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430!<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d46\/133\/47d\/d4613347daf7eaf17140a57e37784b08.png\" alt=\"Clean_title \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0432 \u0444\u0440\u0435\u0439\u043c\u00a0\u0434\u0430\u043d\u043d\u044b\u0445\" title=\"Clean_title \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0432 \u0444\u0440\u0435\u0439\u043c\u00a0\u0434\u0430\u043d\u043d\u044b\u0445\" width=\"640\" height=\"151\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d46\/133\/47d\/d4613347daf7eaf17140a57e37784b08.png\"\/><\/p>\n<div><figcaption>Clean_title \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0432 \u0444\u0440\u0435\u0439\u043c\u00a0\u0434\u0430\u043d\u043d\u044b\u0445<\/figcaption><\/div>\n<\/figure>\n<h4>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0441\u043b\u043e\u0432<\/h4>\n<p>\u042d\u0442\u043e \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c 1 \u0441\u0442\u0440\u043e\u043a\u0430 \u043a\u043e\u0434\u0430, \u0438 \u044f \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0435\u0451, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0435\u0441\u0442\u044c  \u043b\u0438 \u0435\u0449\u0435 \u0441\u043b\u043e\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432. Texthero \u0435\u0449\u0435 \u043d\u0435  \u0438\u043c\u0435\u0435\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c, \u0443 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0447\u0435\u0447\u043d\u0430\u044f \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430,  \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/plotly.com\/python\/plotly-express\/\" rel=\"noopener noreferrer nofollow\"><strong>Plotly express<\/strong><\/a> \u0434\u043b\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0441\u043b\u043e\u0432 \u0432 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u0435.<\/p>\n<pre><code class=\"python\">tw = hero.visualization.top_words(df['clean_title']).head(10) import plotly.express as px fig = px.bar(tw) fig.show() tw.head()<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/76f\/91b\/79f\/76f91b79f7e57dfe70f448f28f965f8b.png\" alt=\"\u0413\u0440\u0430\u0444\u0438\u043a \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0441\u043b\u043e\u0432\" title=\"\u0413\u0440\u0430\u0444\u0438\u043a \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0441\u043b\u043e\u0432\" width=\"640\" height=\"305\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/76f\/91b\/79f\/76f91b79f7e57dfe70f448f28f965f8b.png\"\/><\/p>\n<div><figcaption>\u0413\u0440\u0430\u0444\u0438\u043a \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0441\u043b\u043e\u0432<\/figcaption><\/div>\n<\/figure>\n<h4>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u044b\u0445 \u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432<\/h4>\n<p><a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A1%D1%82%D0%B5%D0%BC%D0%BC%D0%B8%D0%BD%D0%B3\" rel=\"noopener noreferrer nofollow\"><strong><em>\u0421\u0442\u0435\u043c\u043c\u0438\u043d\u0433<\/em><\/strong><\/a>  \u0441\u043b\u043e\u0432 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u201c \u2018 \u201c (\u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u044d\u0442\u043e \u043c\u0435\u0436\u0434\u0443 teachers \u0438  students) \u043a \u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432\u0430\u043c \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u043b\u043e\u0432\u0430.  \u0421\u0442\u0435\u043c\u043c\u0438\u043d\u0433 \u0443\u0436\u0435 \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0432 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u0443\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443, \u043d\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0435\u0449\u0435 \u0438  \u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432\u0430. \u0418\u0445 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <strong>\u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f<\/strong> \u0434\u0432\u0443\u0445 \u0434\u0440\u0443\u0433\u0438\u0445:<\/p>\n<pre><code class=\"python\">from texthero import stopwords default_stopwords = stopwords.DEFAULT # \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432 \u043a \u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432\u0430\u043c custom_stopwords = default_stopwords.union(set([\"'\"])) # \u0412\u044b\u0437\u043e\u0432 remove_stopwords \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0441\u043f\u0438\u0441\u043a\u0430 custom_stopwords df['clean_title'] = hero.remove_stopwords(df['clean_title'], custom_stopwords)<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0441\u043f\u0438\u0441\u043e\u043a custom_stopwords \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432 <strong>hero.remove_stopwords()<\/strong>. \u042f \u0437\u0430\u043d\u043e\u0432\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e \u0435\u0433\u043e \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b!<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d79\/d8e\/009\/d79d8e0090aca0ec3e5ab03f45f9eddc.png\" alt=\"\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e\u0441\u043b\u0435 \u0441\u0442\u0435\u043c\u043c\u0438\u043d\u0433\u0430\" title=\"\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e\u0441\u043b\u0435 \u0441\u0442\u0435\u043c\u043c\u0438\u043d\u0433\u0430\" width=\"640\" height=\"347\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d79\/d8e\/009\/d79d8e0090aca0ec3e5ab03f45f9eddc.png\"\/><\/p>\n<div><figcaption>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e\u0441\u043b\u0435 \u0441\u0442\u0435\u043c\u043c\u0438\u043d\u0433\u0430<\/figcaption><\/div>\n<\/figure>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0431\u044b\u043b \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d \u0441\u0442\u0435\u043c\u043c\u0438\u043d\u0433 \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432\u0430!<\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b<\/h4>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f\u00a0<a href=\"https:\/\/pandas.pydata.org\/pandas-docs\/stable\/reference\/api\/pandas.DataFrame.pipe.html\" rel=\"noopener noreferrer nofollow\"><strong>.pipe()<\/strong><\/a> \u043e\u0442 Pandas \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043c\u043e\u0434\u0443\u043b\u044f Texthero \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e. \u0427\u0442\u043e\u0431\u044b \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a, \u044f \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.decomposition.PCA.html?highlight=pca#sklearn.decomposition.PCA\" rel=\"noopener noreferrer nofollow\"><em>\u043c\u0435\u0442\u043e\u0434 \u0433\u043b\u0430\u0432\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442<\/em><\/a><em> (PCA)<\/em> \u0434\u043b\u044f \u0441\u0436\u0430\u0442\u0438\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430. \u042f \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0441\u044c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044e <a href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.cluster.KMeans.html?highlight=kmeans#sklearn.cluster.KMeans\" rel=\"noopener noreferrer nofollow\"><em>K-\u0441\u0440\u0435\u0434\u043d\u0438\u0445<\/em><\/a>, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0446\u0432\u0435\u0442. \u041f\u043e\u043c\u043d\u0438\u0442\u0435, \u0447\u0442\u043e Texthero \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 <em>\u0440\u044f\u0434 <\/em>\u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043c\u043e\u0433\u0443 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432\u044b\u0445\u043e\u0434 \u043a\u0430\u043a \u043d\u043e\u0432\u044b\u0439 \u0441\u0442\u043e\u043b\u0431\u0435\u0446 \u0432\u043e \u0444\u0440\u0435\u0439\u043c\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<pre><code class=\"python\"># \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u0433\u043b\u0430\u0432\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043a \u0444\u0440\u0435\u0439\u043c\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043a\u0430\u043a \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 df['pca'] = (             df['clean_title']             .pipe(hero.tfidf)             .pipe(hero.pca)    ) # \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 k-\u0441\u0440\u0435\u0434\u043d\u0438\u0445 \u043a \u0444\u0440\u0435\u0439\u043c\u0443 \u0434\u0430\u043d\u043d\u044b\u0445  df['kmeans'] = ( df['clean_title'] .pipe(hero.tfidf) .pipe(hero.kmeans) ) df.head() <\/code><\/pre>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b76\/9d6\/3bf\/b769d63bf4d5b2f3ac6c75a2476523ed.png\" width=\"380\" height=\"294\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b76\/9d6\/3bf\/b769d63bf4d5b2f3ac6c75a2476523ed.png\"\/><\/figure>\n<p>\u041a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f PCA \u0438 K-\u0441\u0440\u0435\u0434\u043d\u0438\u0445 \u0431\u044b\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432\u0441\u0435\u0433\u043e  \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430! \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <strong>hero.scatterplot()<\/strong><\/p>\n<pre><code class=\"python\"># \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0442\u043e\u0447\u0435\u0447\u043d\u043e\u0439 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b hero.scatterplot(df, 'pca', color = 'kmeans', hover_data=['title'] )<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 Plotly, \u0442\u043e\u0447\u0435\u0447\u043d\u0430\u044f \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c  \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439, \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f\u043c! \u0415\u0451 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u043f\u043e \u043c\u0435\u0440\u0435  \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0438  \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c!<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9b7\/4ad\/671\/9b74ad6713e7922aa016f3c1169eb917.png\" alt=\"\u0417\u0430\u0433\u043b\u0430\u0432\u043d\u0430\u044f \u0442\u043e\u0447\u0435\u0447\u043d\u0430\u044f \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430\" title=\"\u0417\u0430\u0433\u043b\u0430\u0432\u043d\u0430\u044f \u0442\u043e\u0447\u0435\u0447\u043d\u0430\u044f \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430\" width=\"640\" height=\"287\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9b7\/4ad\/671\/9b74ad6713e7922aa016f3c1169eb917.png\"\/><\/p>\n<div><figcaption>\u0417\u0430\u0433\u043b\u0430\u0432\u043d\u0430\u044f \u0442\u043e\u0447\u0435\u0447\u043d\u0430\u044f \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430<\/figcaption><\/div>\n<\/figure>\n<h4>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043c\u044b\u0441\u043b\u0438<\/h4>\n<p>\u0425\u043e\u0442\u044f Texthero \u0432\u0441\u0435 \u0435\u0449\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0431\u0435\u0442\u0430-\u0432\u0435\u0440\u0441\u0438\u0438, \u044f \u0432\u0438\u0436\u0443 \u043c\u043d\u043e\u0433\u043e\u043e\u0431\u0435\u0449\u0430\u044e\u0449\u0435\u0435  \u0431\u0443\u0434\u0443\u0449\u0435\u0435 \u0434\u043b\u044f \u043d\u0435\u0451 \u0438 \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u043e\u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u0442\u0443 \u043b\u044e\u0431\u043e\u0432\u044c, \u043a\u043e\u0442\u043e\u0440\u0443\u044e  \u0437\u0430\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u0442. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u0435\u043b\u0430\u0435\u0442 \u0447\u0438\u0441\u0442\u043a\u0443 \u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0443 \u0442\u0435\u043a\u0441\u0442\u0430 \u0432 \u0444\u0440\u0435\u0439\u043c\u0430\u0445  \u0434\u0430\u043d\u043d\u044b\u0445 panda \u043b\u0435\u0433\u043a\u0438\u043c \u0432\u0435\u0442\u0435\u0440\u043a\u043e\u043c. \u042f \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e \u0435\u0449\u0435  \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u043d\u043e \u0442\u043e\u0447\u0435\u0447\u043d\u044b\u0439 \u0433\u0440\u0430\u0444\u0438\u043a\u200a\u2014\u200a\u044d\u0442\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u043e\u0435  \u043d\u0430\u0447\u0430\u043b\u043e.<\/p>\n<h4>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434<\/h4>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0447\u0442\u0435\u043d\u0438\u0435. \u0412\u043e\u0442 \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"python\"># \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 reddit reddit = praw.Reddit(client_id= cid,                      client_secret= csec,                      user_agent= ua) # \u0421\u043f\u0438\u0441\u043e\u043a \u0434\u043b\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u0438 \u0444\u0440\u0435\u0439\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 posts = [] # \u0412\u043e\u0437\u0432\u0440\u0430\u0442 1000 \u043d\u043e\u0432\u044b\u0445 \u043f\u043e\u0441\u0442\u043e\u0432 \u0438\u0437 teaching new = reddit.subreddit('teaching').new(limit=1000) # \u0412\u043e\u0437\u0432\u0440\u0430\u0442 \u0432\u0430\u0436\u043d\u044b\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 for post in new: posts.append([post.title, post.score, post.num_comments, post.selftext, post.created, post.pinned, post.total_awards_received]) # \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0440\u0435\u0439\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 df = pd.DataFrame(posts,columns=['title', 'score', 'comments', 'post', 'created', 'pinned', 'total awards']) # \u0412\u043e\u0437\u0432\u0440\u0430\u0442 3-\u0445 \u0432\u0435\u0440\u0445\u043d\u0438\u0445 \u0440\u044f\u0434\u043e\u0432 \u0438\u0437 \u0444\u0440\u0435\u0439\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 df.head(3) from texthero import preprocessing custom_pipeline = [preprocessing.fillna , preprocessing.lowercase , preprocessing.remove_digits , preprocessing.remove_punctuation , preprocessing.remove_diacritics , preprocessing.remove_stopwords , preprocessing.remove_whitespace , preprocessing.stem] df['clean_title'] = hero.clean(df['title'], pipeline = custom_pipeline) df.head() from texthero import stopwords default_stopwords = stopwords.DEFAULT custom_stopwords = default_stopwords.union(set([\"'\"])) df['clean_title'] = hero.remove_stopwords(df['clean_title'], custom_stopwords) hero.visualization.top_words(df['clean_title'])tw = hero.visualization.top_words(df['clean_title']).head(10) import plotly.express as px fig = px.bar(tw) fig.show() df['pca'] = ( df['clean_title'] .pipe(hero.tfidf) .pipe(hero.pca) ) df['kmeans'] = ( df['clean_title'] .pipe(hero.tfidf) .pipe(hero.kmeans) ) hero.scatterplot(df, 'pca', color = 'kmeans', hover_data=['title'] )<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043a\u043e \u0432\u0441\u0435\u043c \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u043c.<\/p>\n<pre><code class=\"python\">import texthero import pandas as pd  df = pd.read_excel('data.xlsx') df = df.astype(str)   def cleaner(column):     return texthero.clean(column)  # \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0441\u0442\u043e\u043b\u0431\u0446\u0443 def clean_column(column):     return texthero.clean(column)  # \u041f\u0440\u0438\u043c\u0435\u043d\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0441\u0442\u043e\u043b\u0431\u0446\u0443 DataFrame df = df.apply(clean_column) df<\/code><\/pre>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/808887\/\"> https:\/\/habr.com\/ru\/articles\/808887\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h4>\u0423\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430\u00a0(NLP)<\/h4>\n<p>\u042f \u0432\u0441\u0435\u0433\u0434\u0430 \u043d\u0430\u0445\u043e\u0436\u0443\u0441\u044c \u0432 \u043f\u043e\u0438\u0441\u043a\u0435 \u043d\u043e\u0432\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043c\u043e\u0433\u0443\u0442 \u043c\u043d\u0435  \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443, \u043a\u043e\u0433\u0434\u0430 \u044f  \u043d\u0430\u0442\u043a\u043d\u0443\u043b\u0441\u044f \u043d\u0430 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 \u0432\u0438\u0434\u0435\u043e\u043a\u043b\u0438\u043f, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c Texthero,  \u044f \u0437\u043d\u0430\u043b, \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0435\u0433\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c. Texthero \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d \u043a\u0430\u043a \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0430  Pandas, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435  \u0440\u044f\u0434\u044b Pandas \u0441\u0442\u0430\u043b\u043e \u043f\u0440\u043e\u0449\u0435, \u0447\u0435\u043c \u043a\u043e\u0433\u0434\u0430-\u043b\u0438\u0431\u043e. \u042f \u0441\u0440\u0430\u0437\u0443 \u0436\u0435 \u0434\u043e\u0441\u0442\u0430\u043b \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e,  \u043e\u0442\u043a\u0440\u044b\u043b \u043d\u043e\u0443\u0442\u0431\u0443\u043a \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043b \u043f\u0430\u0440\u0443 \u0442\u044b\u0441\u044f\u0447 \u0434\u0438\u0441\u043a\u0443\u0441\u0441\u0438\u0439 \u0438\u0437 Reddit \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430,  \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443.<\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/strong><em>: <\/em>\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Texthero \u0432\u0441\u0435 \u0435\u0449\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0431\u0435\u0442\u0430-\u0432\u0435\u0440\u0441\u0438\u0438! \u0422\u0430\u043c \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043c\u043e\u0436\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c\u0441\u044f.<em> \u042f \u043d\u0430\u0448\u0435\u043b \u043e\u0448\u0438\u0431\u043a\u0443 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 wordcloud\u0438 \u0441\u043e\u043e\u0431\u0449\u0438\u043b \u043e\u0431 \u044d\u0442\u043e\u043c. \u042d\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043e \u0432 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438!<\/em><\/p>\n<h4>\u041e\u0431\u0437\u043e\u0440 Texthero<\/h4>\n<p>\u042f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u044e \u0432\u0441\u0435 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u0435\u0435 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043a\u043e\u0434\u043e\u043c, \u043d\u043e \u0434\u043b\u044f \u043a\u0440\u0430\u0442\u043a\u043e\u0441\u0442\u0438, Texthero \u0440\u0430\u0437\u0431\u0438\u0442 \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u044f:<\/p>\n<p><a href=\"https:\/\/texthero.org\/docs\/api-preprocessing\" rel=\"noopener noreferrer nofollow\"><strong>\u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/strong><\/a><\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c <em>\u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438<\/em>\u200a\u2014\u200a\u044d\u0442\u043e \u0432\u0441\u0435, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u043b\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u0447\u0438\u0441\u0442\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u0441\u0435\u0440\u0438\u0439 Pandas. \u041f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c \u043e\u043d \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <a href=\"https:\/\/docs.python.org\/3\/library\/re.html\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f (regex)<\/a>.<\/p>\n<p><a href=\"https:\/\/texthero.org\/docs\/api-nlp\" rel=\"noopener noreferrer nofollow\"><strong>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 (NLP)<\/strong><\/a><\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c <em>NLP<\/em> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0438 \u0438\u043c\u0435\u043d \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445. \u041e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <a href=\"https:\/\/spacy.io\/\" rel=\"noopener noreferrer nofollow\">Spacy<\/a>.<\/p>\n<p><a href=\"https:\/\/texthero.org\/docs\/api-representation\" rel=\"noopener noreferrer nofollow\"><strong>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435<\/strong><\/a><\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c <em>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f <\/em>\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u0432 \u0441\u043b\u043e\u0432  \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432. \u041e\u043d \u0442\u0430\u043a\u0436\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u041c\u0435\u0442\u043e\u0434  \u0413\u043b\u0430\u0432\u043d\u044b\u0445 \u041a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0438 k-\u0421\u0440\u0435\u0434\u043d\u0438\u0445. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <a href=\"https:\/\/scikit-learn.org\/stable\/user_guide.html\" rel=\"noopener noreferrer nofollow\">scikit-learn \u0434\u043b\u044f TF-IDF \u0438 Count<\/a>, \u0430 \u0432\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u044f\u0437\u044b\u043a\u043e\u0432\u044b\u0445 \u043c\u043e\u0434\u0435\u043b\u0435\u0439.<\/p>\n<p><a href=\"https:\/\/texthero.org\/docs\/api-visualization\" rel=\"noopener noreferrer nofollow\"><strong>\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/strong><\/a><\/p>\n<p>\u041c\u043e\u0434\u0443\u043b\u044c <em>\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438<\/em> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043f\u043e\u043a\u0430\u0437\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439 \u0432  \u0432\u0438\u0434\u0435 \u0442\u043e\u0447\u0435\u0447\u043d\u043e\u0439 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b \u0438\u043b\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043e\u0431\u043b\u0430\u043a\u043e\u0432 \u0441\u043b\u043e\u0432. \u042d\u0442\u043e\u0442 \u043c\u043e\u0434\u0443\u043b\u044c \u0432  \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0438\u043c\u0435\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <a href=\"https:\/\/plotly.com\/python\/plotly-fundamentals\/\" rel=\"noopener noreferrer nofollow\">Plotly<\/a> \u0438 WordCloud.<\/p>\n<p>\u041e\u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c \u0441 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439:<a href=\"https:\/\/texthero.org\/\" rel=\"noopener noreferrer nofollow\"><strong>Texthero \u00b7 <em>Text preprocessing, representation and visualization from zero to hero.<\/em><\/strong>Text preprocessing, representation and visualization from zero to hero.texthero.org<\/a><\/p>\n<h4>\u0417\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0438\u00a0\u0434\u0430\u043d\u043d\u044b\u0435<\/h4>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f pip \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0431\u044b\u043b\u0430 \u043f\u0440\u043e\u0441\u0442\u0430, \u043d\u043e \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442\u043e\u043c \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0435\u0435 \u0432 \u043c\u043e\u0435\u0439 \u0441\u0440\u0435\u0434\u0435 \u0441 <a href=\"https:\/\/github.com\/nitred\/airflow-pandas\" rel=\"noopener noreferrer nofollow\">Apache Airflow<\/a>  \u0438\u0437-\u0437\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 pandas. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435  \u0432\u0440\u0435\u043c\u044f, \u0447\u0442\u043e\u0431\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u043d\u043e\u0432\u043e\u0439 \u0441\u0440\u0435\u0434\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043c\u043d\u043e\u0433\u043e  \u0434\u0440\u0443\u0433\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u043d\u0430 \u0431\u044d\u043a\u0435\u043d\u0434\u0435. \u041e\u043d \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u043f\u0430\u0440\u0443 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445  \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043f\u043e\u0441\u043b\u0435 \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u0432 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e <a href=\"https:\/\/praw.readthedocs.io\/en\/latest\/\" rel=\"noopener noreferrer nofollow\">PRAW<\/a> \u0434\u043b\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 <a href=\"https:\/\/www.reddit.com\/\" rel=\"noopener noreferrer nofollow\">Reddit<\/a>.<\/p>\n<pre><code class=\"python\">!pip install texthero import praw import pandas as pd import texthero as hero from config import cid, csec, ua # \u0414\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f PRAW <\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0435 Texthero \u0432\u043f\u0435\u0440\u0432\u044b\u0435, \u043e\u043d \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u043a\u043e\u0435-\u0447\u0442\u043e \u0438\u0437 <a href=\"https:\/\/www.nltk.org\/\" rel=\"noopener noreferrer nofollow\">NLTK<\/a> \u0438 <a href=\"https:\/\/spacy.io\/\" rel=\"noopener noreferrer nofollow\">Spacy<\/a>:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0438 Texthero \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c \u0438\u043c\u043f\u043e\u0440\u0442\u0435<\/figcaption><\/div>\n<\/figure>\n<h4>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p>\u042f \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u044e \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0441\u0443\u0431\u0440\u0435\u0434\u0434\u0438\u0442\u0430 <strong>Teaching<\/strong>, \u0447\u0442\u043e\u0431\u044b  \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0441\u043c\u043e\u0436\u0435\u043c \u043b\u0438 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u0442\u0435\u043c\u044b \u0432\u043e\u043a\u0440\u0443\u0433 \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0439\u0441\u0442\u0432\u0430 \u043e  \u043d\u0430\u0447\u0430\u043b\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0432 \u0448\u043a\u043e\u043b\u0435 \u043e\u0441\u0435\u043d\u044c\u044e \u0432 \u0441\u0442\u0440\u0430\u0434\u0430\u044e\u0449\u0435\u0439 \u043e\u0442 COVID \u0410\u043c\u0435\u0440\u0438\u043a\u0435.<\/p>\n<pre><code class=\"python\"># \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 reddit reddit = praw.Reddit(client_id= cid,                      client_secret= csec,                      user_agent= ua) # \u0421\u043f\u0438\u0441\u043e\u043a \u0434\u043b\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u0438 \u0444\u0440\u0435\u0439\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 posts = [] # \u0412\u043e\u0437\u0432\u0440\u0430\u0442 1000 \u043d\u043e\u0432\u044b\u0445 \u043f\u043e\u0441\u0442\u043e\u0432 \u0438\u0437 teaching new = reddit.subreddit('teaching').new(limit=1000) # \u0412\u043e\u0437\u0432\u0440\u0430\u0442 \u0432\u0430\u0436\u043d\u044b\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 for post in new: posts.append([post.title, post.score, post.num_comments, post.selftext, post.created, post.pinned, post.total_awards_received]) # \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0440\u0435\u0439\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 df = pd.DataFrame(posts,columns=['title', 'score', 'comments', 'post', 'created', 'pinned', 'total awards']) # \u0412\u043e\u0437\u0432\u0440\u0430\u0442 3-\u0445 \u0432\u0435\u0440\u0445\u043d\u0438\u0445 \u0440\u044f\u0434\u043e\u0432 \u0438\u0437 \u0444\u0440\u0435\u0439\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 df.head(3)<\/code><\/pre>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e<strong> PRAW<\/strong> \u043c\u043e\u0436\u043d\u043e \u0441 \u043b\u0435\u0433\u043a\u043e\u0441\u0442\u044c\u044e \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 Reddit \u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0438\u0445 \u0432\u043e \u0444\u0440\u0435\u0439\u043c pandas.<\/p>\n<p>\u0422\u0443\u0442 \u044f \u043f\u043e\u043b\u0443\u0447\u0430\u044e 1000 \u043d\u043e\u0432\u044b\u0445 \u043f\u043e\u0441\u0442\u043e\u0432 \u0438\u0437 <strong>teaching<\/strong>. <strong>df.head(3) <\/strong>\u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0444\u0440\u0435\u0439\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u041f\u0435\u0440\u0432\u044b\u0435 3 \u0440\u044f\u0434\u0430 \u0444\u0440\u0435\u0439\u043c\u0430\u00a0\u0434\u0430\u043d\u043d\u044b\u0445<\/figcaption><\/div>\n<\/figure>\n<h4>\u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e\u00a0Texthero<\/h4>\n<p>\u041d\u0430\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0444\u0438\u0448\u043a\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 texthero\u200a\u2014\u200a\u044d\u0442\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430  \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u041d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0445  \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439? Texthero \u0442\u0435\u0431\u044f \u043f\u0440\u0438\u043a\u0440\u043e\u0435\u0442! \u041f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0437\u043e\u0432\u0438\u0442\u0435 \u043c\u0435\u0442\u043e\u0434\u00a0.clean() \u0438  \u043f\u0435\u0440\u0435\u0434\u0430\u0439\u0442\u0435 \u0435\u043c\u0443 \u0440\u044f\u0434 \u0444\u0440\u0435\u0439\u043c\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code class=\"javascript\">df['clean_title'] = hero.clean(df['title'])<\/code><\/pre>\n<p>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 clean() \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u0435\u043c\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0439:<\/p>\n<ol>\n<li>\n<p><code>fillna(s)<\/code> \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442 \u043d\u0435\u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0443\u0441\u0442\u044b\u043c\u0438 \u043f\u0440\u043e\u0431\u0435\u043b\u0430\u043c\u0438;<\/p>\n<\/li>\n<li>\n<p><code>lowercase(s)<\/code> \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442 \u0432\u0435\u0441\u044c \u0442\u0435\u043a\u0441\u0442 \u0432 \u043d\u0438\u0436\u043d\u0438\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440;<\/p>\n<\/li>\n<li>\n<p><code>remove_digits()<\/code> \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0432\u0441\u0435 \u0431\u043b\u043e\u043a\u0438 \u0446\u0438\u0444\u0440;<\/p>\n<\/li>\n<li>\n<p><code>remove_punctuation()<\/code> \u0443\u0431\u0438\u0440\u0430\u0435\u0442 \u0432\u0441\u044e \u043f\u0443\u043d\u043a\u0442\u0443\u0430\u0446\u0438\u044e (!\u00bb#$%&amp;'()*+,-.\/:;&lt;=>?@[\\]^_`{|}~);<\/p>\n<\/li>\n<li>\n<p><code>remove_diacritics()<\/code> \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0432\u0441\u0435 \u0437\u043d\u0430\u043a\u0438 \u0443\u0434\u0430\u0440\u0435\u043d\u0438\u0439\u0438\u0437 \u0441\u0442\u0440\u043e\u043a;<\/p>\n<\/li>\n<li>\n<p><code>remove_stopwords()<\/code> \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0432\u0441\u0435 \u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432\u0430;<\/p>\n<\/li>\n<li>\n<p><code>remove_whitespace()<\/code> \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u0432\u0441\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u044b \u043c\u0435\u0436\u0434\u0443 \u0441\u043b\u043e\u0432\u0430\u043c\u0438.<\/p>\n<\/li>\n<\/ol>\n<h4>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u0430\u044f \u0447\u0438\u0441\u0442\u043a\u0430<\/h4>\n<p>\u0415\u0441\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043d\u0435 \u0434\u0435\u043b\u0430\u0435\u0442 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u043c\u043e\u0436\u043d\u043e  \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u043e\u0439 \u0447\u0438\u0441\u0442\u043a\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438  \u044f \u0445\u043e\u0447\u0443 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A8%D1%83%D0%BC%D0%BE%D0%B2%D1%8B%D0%B5_%D1%81%D0%BB%D0%BE%D0%B2%D0%B0\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432\u0430<\/a> \u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0435, \u044f \u043c\u043e\u0433\u0443 \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c <strong>remove_stopwords<\/strong> \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c <strong>texthero.preprocessing.stem()<\/strong> \u043a \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0435:<\/p>\n<pre><code class=\"python\">from texthero import preprocessing # \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u043e\u0439 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u0447\u0438\u0441\u0442\u043a\u0438 custom_pipeline = [preprocessing.fillna , preprocessing.lowercase , preprocessing.remove_digits , preprocessing.remove_punctuation , preprocessing.remove_diacritics #, preprocessing.remove_stopwords , preprocessing.remove_whitespace , preprocessing.stem] # \u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 custom_pipeline \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0443 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b df['clean_title'] = hero.clean(df['title'], pipeline = custom_pipeline) # \u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 custom_pipeline \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0443 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b df['clean_title'] = hero.clean(df['title'], pipeline = custom_pipeline) df.head()<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e <strong>custom_pipeline <\/strong>\u2014 \u044d\u0442\u043e \u0441\u043f\u0438\u0441\u043e\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u041e\u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c \u0441 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430!<\/p>\n<figure class=\"full-width\">\n<div><figcaption>Clean_title \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0432 \u0444\u0440\u0435\u0439\u043c\u00a0\u0434\u0430\u043d\u043d\u044b\u0445<\/figcaption><\/div>\n<\/figure>\n<h4>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0441\u043b\u043e\u0432<\/h4>\n<p>\u042d\u0442\u043e \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c 1 \u0441\u0442\u0440\u043e\u043a\u0430 \u043a\u043e\u0434\u0430, \u0438 \u044f \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e \u0435\u0451, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0435\u0441\u0442\u044c  \u043b\u0438 \u0435\u0449\u0435 \u0441\u043b\u043e\u0432\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432. Texthero \u0435\u0449\u0435 \u043d\u0435  \u0438\u043c\u0435\u0435\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c, \u0443 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0447\u0435\u0447\u043d\u0430\u044f \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430,  \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/plotly.com\/python\/plotly-express\/\" rel=\"noopener noreferrer nofollow\"><strong>Plotly express<\/strong><\/a> \u0434\u043b\u044f \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0441\u043b\u043e\u0432 \u0432 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u0435.<\/p>\n<pre><code class=\"python\">tw = hero.visualization.top_words(df['clean_title']).head(10) import plotly.express as px fig = px.bar(tw) fig.show() tw.head()<\/code><\/pre>\n<figure class=\"full-width\">\n<div><figcaption>\u0413\u0440\u0430\u0444\u0438\u043a \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0441\u043b\u043e\u0432<\/figcaption><\/div>\n<\/figure>\n<h4>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u044b\u0445 \u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432<\/h4>\n<p><a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A1%D1%82%D0%B5%D0%BC%D0%BC%D0%B8%D0%BD%D0%B3\" rel=\"noopener noreferrer nofollow\"><strong><em>\u0421\u0442\u0435\u043c\u043c\u0438\u043d\u0433<\/em><\/strong><\/a>  \u0441\u043b\u043e\u0432 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u201c \u2018 \u201c (\u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u044d\u0442\u043e \u043c\u0435\u0436\u0434\u0443 teachers \u0438  students) \u043a \u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432\u0430\u043c \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u043b\u043e\u0432\u0430.  \u0421\u0442\u0435\u043c\u043c\u0438\u043d\u0433 \u0443\u0436\u0435 \u0431\u044b\u043b \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0432 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u0443\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443, \u043d\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0435\u0449\u0435 \u0438  \u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432\u0430. \u0418\u0445 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0441\u043f\u0438\u0441\u043e\u043a \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <strong>\u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f<\/strong> \u0434\u0432\u0443\u0445 \u0434\u0440\u0443\u0433\u0438\u0445:<\/p>\n<pre><code class=\"python\">from texthero import stopwords default_stopwords = stopwords.DEFAULT # \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432 \u043a \u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432\u0430\u043c custom_stopwords = default_stopwords.union(set([\"'\"])) # \u0412\u044b\u0437\u043e\u0432 remove_stopwords \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0441\u043f\u0438\u0441\u043a\u0430 custom_stopwords df['clean_title'] = hero.remove_stopwords(df['clean_title'], custom_stopwords)<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0441\u043f\u0438\u0441\u043e\u043a custom_stopwords \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432 <strong>hero.remove_stopwords()<\/strong>. \u042f \u0437\u0430\u043d\u043e\u0432\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e \u0435\u0433\u043e \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b!<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e\u0441\u043b\u0435 \u0441\u0442\u0435\u043c\u043c\u0438\u043d\u0433\u0430<\/figcaption><\/div>\n<\/figure>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0431\u044b\u043b \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d \u0441\u0442\u0435\u043c\u043c\u0438\u043d\u0433 \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432\u0430!<\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b<\/h4>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f\u00a0<a href=\"https:\/\/pandas.pydata.org\/pandas-docs\/stable\/reference\/api\/pandas.DataFrame.pipe.html\" rel=\"noopener noreferrer nofollow\"><strong>.pipe()<\/strong><\/a> \u043e\u0442 Pandas \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043c\u043e\u0434\u0443\u043b\u044f Texthero \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e. \u0427\u0442\u043e\u0431\u044b \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a, \u044f \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.decomposition.PCA.html?highlight=pca#sklearn.decomposition.PCA\" rel=\"noopener noreferrer nofollow\"><em>\u043c\u0435\u0442\u043e\u0434 \u0433\u043b\u0430\u0432\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442<\/em><\/a><em> (PCA)<\/em> \u0434\u043b\u044f \u0441\u0436\u0430\u0442\u0438\u044f \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430. \u042f \u0442\u0430\u043a\u0436\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0441\u044c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044e <a href=\"https:\/\/scikit-learn.org\/stable\/modules\/generated\/sklearn.cluster.KMeans.html?highlight=kmeans#sklearn.cluster.KMeans\" rel=\"noopener noreferrer nofollow\"><em>K-\u0441\u0440\u0435\u0434\u043d\u0438\u0445<\/em><\/a>, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0446\u0432\u0435\u0442. \u041f\u043e\u043c\u043d\u0438\u0442\u0435, \u0447\u0442\u043e Texthero \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 <em>\u0440\u044f\u0434 <\/em>\u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043c\u043e\u0433\u0443 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432\u044b\u0445\u043e\u0434 \u043a\u0430\u043a \u043d\u043e\u0432\u044b\u0439 \u0441\u0442\u043e\u043b\u0431\u0435\u0446 \u0432\u043e \u0444\u0440\u0435\u0439\u043c\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<pre><code class=\"python\"># \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u0433\u043b\u0430\u0432\u043d\u044b\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043a \u0444\u0440\u0435\u0439\u043c\u0443 \u0434\u0430\u043d\u043d\u044b\u0445, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043a\u0430\u043a \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 df['pca'] = (             df['clean_title']             .pipe(hero.tfidf)             .pipe(hero.pca)    ) # \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 k-\u0441\u0440\u0435\u0434\u043d\u0438\u0445 \u043a \u0444\u0440\u0435\u0439\u043c\u0443 \u0434\u0430\u043d\u043d\u044b\u0445  df['kmeans'] = ( df['clean_title'] .pipe(hero.tfidf) .pipe(hero.kmeans) ) df.head() <\/code><\/pre>\n<figure class=\"\"><\/figure>\n<p>\u041a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f PCA \u0438 K-\u0441\u0440\u0435\u0434\u043d\u0438\u0445 \u0431\u044b\u043b\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432\u0441\u0435\u0433\u043e  \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430! \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <strong>hero.scatterplot()<\/strong><\/p>\n<pre><code class=\"python\"># \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0442\u043e\u0447\u0435\u0447\u043d\u043e\u0439 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b hero.scatterplot(df, 'pca', color = 'kmeans', hover_data=['title'] )<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 Plotly, \u0442\u043e\u0447\u0435\u0447\u043d\u0430\u044f \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c  \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439, \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f\u043c! \u0415\u0451 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u043f\u043e \u043c\u0435\u0440\u0435  \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0438  \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c!<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0417\u0430\u0433\u043b\u0430\u0432\u043d\u0430\u044f \u0442\u043e\u0447\u0435\u0447\u043d\u0430\u044f \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0430<\/figcaption><\/div>\n<\/figure>\n<h4>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043c\u044b\u0441\u043b\u0438<\/h4>\n<p>\u0425\u043e\u0442\u044f Texthero \u0432\u0441\u0435 \u0435\u0449\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0431\u0435\u0442\u0430-\u0432\u0435\u0440\u0441\u0438\u0438, \u044f \u0432\u0438\u0436\u0443 \u043c\u043d\u043e\u0433\u043e\u043e\u0431\u0435\u0449\u0430\u044e\u0449\u0435\u0435  \u0431\u0443\u0434\u0443\u0449\u0435\u0435 \u0434\u043b\u044f \u043d\u0435\u0451 \u0438 \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u043e\u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u0442\u0443 \u043b\u044e\u0431\u043e\u0432\u044c, \u043a\u043e\u0442\u043e\u0440\u0443\u044e  \u0437\u0430\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u0442. \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u0435\u043b\u0430\u0435\u0442 \u0447\u0438\u0441\u0442\u043a\u0443 \u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0443 \u0442\u0435\u043a\u0441\u0442\u0430 \u0432 \u0444\u0440\u0435\u0439\u043c\u0430\u0445  \u0434\u0430\u043d\u043d\u044b\u0445 panda \u043b\u0435\u0433\u043a\u0438\u043c \u0432\u0435\u0442\u0435\u0440\u043a\u043e\u043c. \u042f \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e \u0435\u0449\u0435  \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u043d\u043e \u0442\u043e\u0447\u0435\u0447\u043d\u044b\u0439 \u0433\u0440\u0430\u0444\u0438\u043a\u200a\u2014\u200a\u044d\u0442\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u043e\u0435  \u043d\u0430\u0447\u0430\u043b\u043e.<\/p>\n<h4>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434<\/h4>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0447\u0442\u0435\u043d\u0438\u0435. \u0412\u043e\u0442 \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"python\"># \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 reddit reddit = praw.Reddit(client_id= cid,                      client_secret= csec,                      user_agent= ua) # \u0421\u043f\u0438\u0441\u043e\u043a \u0434\u043b\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0441\u0438\u0438 \u0444\u0440\u0435\u0439\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 posts = [] # \u0412\u043e\u0437\u0432\u0440\u0430\u0442 1000 \u043d\u043e\u0432\u044b\u0445 \u043f\u043e\u0441\u0442\u043e\u0432 \u0438\u0437 teaching new = reddit.subreddit('teaching').new(limit=1000) # \u0412\u043e\u0437\u0432\u0440\u0430\u0442 \u0432\u0430\u0436\u043d\u044b\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 for post in new: posts.append([post.title, post.score, post.num_comments, post.selftext, post.created, post.pinned, post.total_awards_received]) # \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0444\u0440\u0435\u0439\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 df = pd.DataFrame(posts,columns=['title', 'score', 'comments', 'post', 'created', 'pinned', 'total awards']) # \u0412\u043e\u0437\u0432\u0440\u0430\u0442 3-\u0445 \u0432\u0435\u0440\u0445\u043d\u0438\u0445 \u0440\u044f\u0434\u043e\u0432 \u0438\u0437 \u0444\u0440\u0435\u0439\u043c\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 df.head(3) from texthero import preprocessing custom_pipeline = [preprocessing.fillna , preprocessing.lowercase , preprocessing.remove_digits , preprocessing.remove_punctuation , preprocessing.remove_diacritics , preprocessing.remove_stopwords , preprocessing.remove_whitespace , preprocessing.stem] df['clean_title'] = hero.clean(df['title'], pipeline = custom_pipeline) df.head() from texthero import stopwords default_stopwords =<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-374098","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/374098","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=374098"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/374098\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=374098"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=374098"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=374098"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}