{"id":381886,"date":"2024-06-29T03:56:09","date_gmt":"2024-06-29T03:56:09","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=381886"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=381886","title":{"rendered":"<span>\u041a\u0430\u043a \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u043a\u043d\u0438\u0433\u0443 \u043e \u0413\u0430\u0440\u0440\u0438 \u041f\u043e\u0442\u0442\u0435\u0440\u0435 \u0432 \u0433\u0440\u0430\u0444 \u0437\u043d\u0430\u043d\u0438\u0439<\/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<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/191\/de6\/bd5\/191de6bd555cc25dedf9963cd73c2182.jpg\" width=\"780\" height=\"439\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/191\/de6\/bd5\/191de6bd555cc25dedf9963cd73c2182.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\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 \u2014 \u044d\u0442\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0435 \u0441\u0435\u0442\u0438, \u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u2014 \u044d\u0442\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a\u0438, \u0447\u0438\u0441\u043b\u0430 \u0438 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f. \u041e\u0431\u043b\u0430\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u0440\u043e\u0441\u0442\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0434\u0430\u043b\u044c\u0448\u0435. \u041a \u0441\u0442\u0430\u0440\u0442\u0443 \u0444\u043b\u0430\u0433\u043c\u0430\u043d\u0441\u043a\u043e\u0433\u043e <a href=\"https:\/\/skillfactory.ru\/dstpro?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_dspr_140821&amp;utm_term=lead\">\u043a\u0443\u0440\u0441\u0430 \u043f\u043e Data Science<\/a> \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0430\u0448\u0435\u043c\u0443 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0438\u0437 \u0431\u043b\u043e\u0433\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0433\u0440\u0430\u0444\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 neo4j \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 SpaCy \u0438 Selenium \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0438\u0437 \u043a\u043d\u0438\u0433\u0438 \u0433\u0440\u0430\u0444 \u0432\u0437\u0430\u0438\u043c\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0439 \u0433\u0435\u0440\u043e\u0435\u0432. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0438 \u043a\u043e\u0434, \u043a\u0430\u043a \u0432\u0441\u0435\u0433\u0434\u0430, \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c.<\/p>\n<hr\/>\n<p>\u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0432\u044b \u0443\u0436\u0435 \u0432\u0438\u0434\u0435\u043b\u0438 <a href=\"https:\/\/twitter.com\/mathbeveridge\">\u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439<\/a> \u042d\u043d\u0434\u0440\u044e \u0411\u0435\u0432\u0435\u0440\u0438\u0434\u0436\u0435\u043c \u0433\u0440\u0430\u0444 <a href=\"https:\/\/networkofthrones.wordpress.com\/\">Game of Thrones<\/a>. \u042d\u043d\u0434\u0440\u044e \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043b \u0433\u0440\u0430\u0444 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043a\u043d\u0438\u0436\u043d\u044b\u0445 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439. \u0415\u0441\u043b\u0438 \u0434\u0432\u0430 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430 \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430 \u0432 \u0442\u0435\u043a\u0441\u0442\u0435, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u0432 \u043a\u043d\u0438\u0433\u0435 \u043e\u043d\u0438 \u043a\u0430\u043a-\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0438\u043b\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442. \u042f \u0440\u0435\u0448\u0438\u043b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0443\u044e \u043a\u043d\u0438\u0433\u0443, \u043d\u0435 \u0438\u043c\u0435\u044e\u0449\u0443\u044e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0439 \u043c\u043d\u0435 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0441\u0435\u0442\u0438. \u0422\u0430\u043a \u0440\u043e\u0434\u0438\u043b\u0441\u044f \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044e \u0433\u0440\u0430\u0444\u0430 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439 \u043a\u043d\u0438\u0433\u0438 \u201c\u0413\u0430\u0440\u0440\u0438 \u041f\u043e\u0442\u0442\u0435\u0440 \u0438 \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u0441\u043a\u0438\u0439 \u043a\u0430\u043c\u0435\u043d\u044c\u201d.<\/p>\n<p>\u042f \u043f\u0440\u043e\u0432\u0451\u043b \u043c\u043d\u043e\u0433\u043e \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u0440\u0435\u0448\u0438\u0442\u044c, \u043a\u0430\u043a \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0442\u044c. \u041f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c, \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044f \u0438\u0445 \u0440\u0430\u0431\u043e\u0442\u0443, \u043d\u043e \u043d\u0438 \u043e\u0434\u043d\u0430 \u0438\u0437 \u043d\u0438\u0445 \u043d\u0435 \u0431\u044b\u043b\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u0430. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0444\u044d\u043d\u0434\u043e\u043c\u0430 <a href=\"https:\/\/harrypotter.fandom.com\/wiki\/Main_Page\">\u0413\u0430\u0440\u0440\u0438 \u041f\u043e\u0442\u0442\u0435\u0440\u0430<\/a> \u0435\u0441\u0442\u044c <a href=\"https:\/\/harrypotter.fandom.com\/wiki\/Harry_Potter_and_the_Philosopher's_Stone_(character_index)\">\u0441\u043f\u0438\u0441\u043e\u043a <\/a>\u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439 \u043f\u0435\u0440\u0432\u043e\u0439 \u043a\u043d\u0438\u0433\u0438.<\/p>\n<p>\u041d\u0430\u043c \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430 \u0433\u043b\u0430\u0432\u0430 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0433\u0435\u0440\u043e\u044f, \u044d\u0442\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439. \u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043d\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u0445 \u043c\u0430\u0442\u0447\u0435\u0440\u043e\u043c <a href=\"https:\/\/spacy.io\/\">SpaCy<\/a>. \u041e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u0435\u0442\u0440\u0438\u043a\u0443 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u044b\u0445 \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0439 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432 <a href=\"https:\/\/neo4j.com\/\">Neo4j<\/a>.<\/p>\n<p>\u041f\u043e\u0440\u043e\u0433 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0439 \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0433\u0440\u0430\u0444\u0430 &#171;\u0418\u0433\u0440\u044b \u043f\u0440\u0435\u0441\u0442\u043e\u043b\u043e\u0432&#187;: \u043a\u043e\u0433\u0434\u0430 \u0434\u0432\u0430 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430 \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 14 \u0441\u043b\u043e\u0432 \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430, \u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u043e\u043d\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0438, \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u0442\u0438\u0445 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043a\u0430\u043a \u0432\u0435\u0441 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0439.<\/p>\n<h3>\u041f\u043b\u0430\u043d<\/h3>\n<ol>\n<li>\n<p>\u041f\u0430\u0440\u0441\u0438\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0444\u044d\u043d\u0434\u043e\u043c\u0430 \u0413\u0430\u0440\u0440\u0438 \u041f\u043e\u0442\u0442\u0435\u0440\u0430.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0442\u0435\u043a\u0441\u0442 \u043a\u043d\u0438\u0433\u0438, \u0440\u0435\u0448\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u044b\u0445 \u0441\u0441\u044b\u043b\u043e\u043a.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0451\u043c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u0430\u0432\u0438\u043b SpaCy.<\/p>\n<\/li>\n<li>\n<p>\u0414\u0435\u043b\u0430\u0435\u043c \u0432\u044b\u0432\u043e\u0434\u044b \u043e\u0431 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f\u0445 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432 \u0433\u0440\u0430\u0444\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 Neo4j.<\/p>\n<\/li>\n<\/ol>\n<p>\u041d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439 \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u0448\u0430\u0433\u0438, \u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b \u0431\u043b\u043e\u043a\u043d\u043e\u0442 <a href=\"https:\/\/github.com\/tomasonjo\/blogs\/blob\/master\/harry_potter\/HarryPotterNLP.ipynb\">Google Colab<\/a>.<\/p>\n<h4>\u0421\u043a\u0440\u044d\u043f\u0438\u043d\u0433 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0444\u044d\u043d\u0434\u043e\u043c\u0430 \u0413\u0430\u0440\u0440\u0438 \u041f\u043e\u0442\u0442\u0435\u0440\u0430<\/h4>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u0441 <a href=\"https:\/\/selenium-python.readthedocs.io\/\">Selenium<\/a>, \u0441\u043e\u0431\u0435\u0440\u0451\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439 \u043a\u043d\u0438\u0433\u0438 &#171;\u0413\u0430\u0440\u0440\u0438 \u041f\u043e\u0442\u0442\u0435\u0440 \u0438 \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u0441\u043a\u0438\u0439 \u043a\u0430\u043c\u0435\u043d\u044c&#187;, \u0432\u043e\u0442 <a href=\"https:\/\/harrypotter.fandom.com\/wiki\/Harry_Potter_and_the_Philosopher's_Stone_(character_index)\">\u0441\u043f\u0438\u0441\u043e\u043a <\/a>\u0438\u0445 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u0439.<\/p>\n<pre><code class=\"python\">wd = webdriver.Chrome('chromedriver',chrome_options=chrome_options) wd.get(url) character_dict = dict() elem = wd.find_element_by_class_name(\"mw-parser-output\")  # Locate character by chapter tables = elem.find_elements_by_tag_name('table') for i, chapter in enumerate(tables):   list_of_characters = []   characters = chapter.find_elements_by_tag_name('a')   for character in characters:     if not character.get_attribute('title'):       continue     list_of_characters.append({'title': character.get_attribute('title'), 'url': character.get_attribute('href')})   character_dict['chapter_' + str(i + 1)] = list_of_characters<\/code><\/pre>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043a\u043e\u0434\u0443 \u0432\u044b\u0448\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439 \u0441 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u043e\u0431 \u0438\u0445 \u043f\u0435\u0440\u0432\u043e\u043c \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0438 \u0432 \u043a\u043d\u0438\u0433\u0435. \u0423 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430 \u0435\u0441\u0442\u044c \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0441 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u043e \u043d\u0451\u043c.<\/p>\n<p>\u041d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 <a href=\"https:\/\/harrypotter.fandom.com\/wiki\/Hermione_Granger\">\u0413\u0435\u0440\u043c\u0438\u043e\u043d\u044b \u0413\u0440\u0435\u0439\u043d\u0434\u0436\u0435\u0440<\/a> \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439. \u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0438\u0437 \u043a\u043d\u0438\u0433\u0438 \u0438 \u043e\u0431\u043e\u0433\u0430\u0442\u0438\u0442\u044c \u0433\u0440\u0430\u0444 \u0437\u043d\u0430\u043d\u0438\u0439, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u043e\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c\u0430\u043c\u0438 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0434\u0435\u0442\u0430\u043b\u0438, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u0434\u043e\u043c \u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u043e \u043a\u0440\u043e\u0432\u0438.<\/p>\n<pre><code class=\"python\">  for chapter in character_dict:     for index, character in enumerate(character_dict[chapter]):       # Rate limit sleep       time.sleep(1)       # Get the character page with selenium       wd.get(character['url'])       # Enrich aliases       try:         alias_div = wd.find_element_by_xpath(\"\/\/div[@data-source = 'alias']\")         aliases = alias_div.find_elements_by_tag_name('li')         result = []         for a in aliases:           # Ignore under the cloak-guise and the name he told           if \"disguise\" in a.text or \"the name he told\" in a.text:             continue           alias = a.text.split('[')[0].split('(')[0].strip()           result.append(alias)         character_dict[chapter][index]['aliases'] = result       except:         pass       # Enrich blood       character_dict[chapter][index]['blood'] = enrich_single_item('blood')       # Enrich nationality       character_dict[chapter][index]['nationality'] = enrich_single_item('nationality')<\/code><\/pre>\n<p>\u0414\u043b\u044f \u044f\u0441\u043d\u043e\u0441\u0442\u0438 \u044f \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e \u043d\u0435 \u0432\u0435\u0441\u044c \u043a\u043e\u0434, \u0430 \u0442\u0430\u043a\u0436\u0435 \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443 \u0413\u0430\u0440\u0440\u0438 \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/harrypotter.fandom.com\/wiki\/Gregory_Goyle\">\u0413\u0440\u0435\u0433\u043e\u0440\u0438 \u0413\u043e\u0439\u043b<\/a> (\u043f\u043e\u0434 \u043c\u0430\u0441\u043a\u0438\u0440\u043e\u0432\u043a\u043e\u0439 Polyjuice).<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u043e\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u043c \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c\u044b \u043f\u043e\u0434 \u043c\u0430\u0441\u043a\u0438\u0440\u043e\u0432\u043a\u043e\u0439 Polyjuice. \u0410 \u0435\u0449\u0451, \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0413\u0430\u0440\u0440\u0438 \u0441\u043a\u0430\u0437\u0430\u043b \u0421\u0442\u044d\u043d\u043b\u0438 \u0428\u0430\u043d\u043f\u0430\u0439\u043a\u0443, \u0447\u0442\u043e \u043e\u043d \u041d\u0435\u0432\u0438\u043b\u043b \u041b\u043e\u043d\u0433\u0431\u043e\u0442\u0442\u043e\u043c, \u044d\u0442\u043e \u043c\u044b \u0442\u043e\u0436\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043c. \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439, \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 Neo4j. \u041d\u0430\u0448\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b:<\/p>\n<ul>\n<li>\n<p>\u0438\u043c\u044f;<\/p>\n<\/li>\n<li>\n<p>\u0430\u0434\u0440\u0435\u0441 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b;<\/p>\n<\/li>\n<li>\n<p>\u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c\u044b;<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c;<\/p>\n<\/li>\n<li>\n<p>\u043a\u0440\u043e\u0432\u043d\u043e\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435;<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u043b;<\/p>\n<\/li>\n<li>\n<p>\u0431\u0438\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0432\u0438\u0434.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u0437\u0430\u0438\u043c\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u0434\u043e\u043c;<\/p>\n<\/li>\n<li>\n<p>\u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u0440\u0435\u0434\u0430\u043d \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436;<\/p>\n<\/li>\n<li>\n<p>\u0441\u0435\u043c\u044c\u044f.<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"python\">entity_query = \"\"\" UNWIND $data as row MERGE (c:Character{name:row.title}) SET c.url = row.url,     c.aliases = row.aliases,     c.blood = row.blood,     c.nationality = row.nationality,     c.species = row.species,     c.gender = row.gender FOREACH (h in CASE WHEN row.house IS NOT NULL THEN [1] ELSE [] END | MERGE (h1:House{name:row.house}) MERGE (c)-[:BELONGS_TO]->(h1)) FOREACH (l in row.loyalty | MERGE (g:Group{name:l}) MERGE (c)-[:LOYAL_TO]->(g)) FOREACH (f in row.family | MERGE (f1:Character{name:f.person}) MERGE (c)-[t:FAMILY_MEMBER]->(f1) SET t.type = f.type)      \"\"\" with driver.session() as session:   for chapter in character_dict:     session.run(entity_query, {'data': character_dict[chapter]})<\/code><\/pre>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430\u0445 \u0432 Neo4j<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3be\/0c9\/d6f\/3be0c9d6ff7f4b6e2f594259a87df500.png\" alt=\"\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0434\u0433\u0440\u0430\u0444\u0430 \u0413\u0435\u0440\u043c\u0438\u043e\u043d\u044b \u0413\u0440\u0435\u0439\u043d\u0434\u0436\u0435\u0440\" title=\"\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0434\u0433\u0440\u0430\u0444\u0430 \u0413\u0435\u0440\u043c\u0438\u043e\u043d\u044b \u0413\u0440\u0435\u0439\u043d\u0434\u0436\u0435\u0440\" width=\"1292\" height=\"726\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3be\/0c9\/d6f\/3be0c9d6ff7f4b6e2f594259a87df500.png\"\/><figcaption>\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0434\u0433\u0440\u0430\u0444\u0430 \u0413\u0435\u0440\u043c\u0438\u043e\u043d\u044b \u0413\u0440\u0435\u0439\u043d\u0434\u0436\u0435\u0440<\/figcaption><\/figure>\n<p>\u041f\u043e\u0445\u043e\u0436\u0435, \u0413\u0435\u0440\u043c\u0438\u043e\u043d\u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430 \u043a\u0430\u043a \u041c\u0430\u043b\u0435\u043d\u044c\u043a\u0430\u044f \u043c\u0438\u0441\u0441 \u0421\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e \u0438 \u043f\u0440\u0435\u0434\u0430\u043d\u0430 \u041e\u0431\u0449\u0435\u0441\u0442\u0432\u0443 \u0441\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0431\u043b\u0430\u0433\u043e\u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044e \u044d\u043b\u044c\u0444\u043e\u0432. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u044b \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0424\u0440\u0435\u0434 \u0423\u0438\u0437\u043b\u0438 \u0443\u0436\u0435 \u0441\u0435\u0439\u0447\u0430\u0441 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0448\u0443\u0440\u0438\u043d\u043e\u043c \u041c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u0439 \u043c\u0438\u0441\u0441 \u0421\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e.<\/p>\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 \u0442\u0435\u043a\u0441\u0442\u0430<\/h4>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u043a\u043d\u0438\u0433\u0438. \u042f \u043d\u0430\u0448\u0451\u043b \u043d\u0430 GitHub <a href=\"https:\/\/github.com\/amephraim\/nlp\/tree\/master\/texts\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439<\/a> \u0441 \u0442\u0435\u043a\u0441\u0442\u0430\u043c\u0438 \u043f\u0435\u0440\u0432\u044b\u0445 \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u043a\u043d\u0438\u0433 \u043e \u0413\u0430\u0440\u0440\u0438 \u041f\u043e\u0442\u0442\u0435\u0440\u0435. \u041a \u0434\u0430\u043d\u043d\u044b\u043c \u043d\u0435 \u043f\u0440\u0438\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0443, \u0447\u0442\u043e \u0432\u043f\u0440\u0430\u0432\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445 \u0441 \u0447\u0438\u0441\u0442\u043e\u0439 \u0441\u043e\u0432\u0435\u0441\u0442\u044c\u044e:<\/p>\n<pre><code class=\"python\">def get_text(url):   try:     return requests.get(url).text   except:     print(\"No text was found\")     return None<\/code><\/pre>\n<p>\u041c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043d\u0435\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u043e\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435, \u0438 \u044d\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u044f \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u043b \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438, \u0442\u043e \u0437\u0430\u0431\u044b\u043b \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043a\u043e\u0440\u0435\u0444\u0435\u0440\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u0438, \u0442\u043e \u0435\u0441\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0435\u0441\u044f \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u0438 \u0442\u043e\u043c\u0443 \u0436\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u043b\u0438\u043d\u0433\u0432\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043c\u043e\u0439 <a href=\"https:\/\/towardsdatascience.com\/from-text-to-knowledge-the-information-extraction-pipeline-b65e7e30273e\">\u043f\u043e\u0441\u0442<\/a> \u043e \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0435 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0432 \u043d\u0451\u043c \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440.<\/p>\n<p>\u042f \u0438\u0441\u043a\u0430\u043b \u043c\u043e\u0434\u0435\u043b\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043a\u043e\u0440\u0435\u0444\u0435\u0440\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u0438 \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c, \u043d\u043e, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044f \u0437\u043d\u0430\u044e, \u0438\u0445 \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0435. \u041f\u0435\u0440\u0432\u0430\u044f \u2014 <a href=\"https:\/\/github.com\/huggingface\/neuralcoref\">NeuralCoref<\/a>, \u043e\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e\u0432\u0435\u0440\u0445 SpaCy, \u0432\u0442\u043e\u0440\u0430\u044f \u2014 AllenNLP. \u0420\u0430\u043d\u0435\u0435 \u044f \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0441 NeuralCoref \u0438 \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 AllenNLP.<\/p>\n<p>\u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0432 Colab 16 \u0413\u0411 \u041e\u0417\u0423 \u0438 \u043f\u0430\u043c\u044f\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u043e \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0430\u0441\u044c, \u043a\u043e\u0433\u0434\u0430 \u044f \u0432\u0432\u043e\u0434\u0438\u043b \u0432\u0441\u044e \u0433\u043b\u0430\u0432\u0443 \u0432 AllenNLP. \u0417\u0430\u0442\u0435\u043c \u044f \u043d\u0430\u0440\u0435\u0437\u0430\u043b \u0433\u043b\u0430\u0432\u0443 \u043d\u0430 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043d\u043e \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043e\u0447\u0435\u043d\u044c \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0438\u0437-\u0437\u0430 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 BERT, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e NeuralCoref, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043b\u0435\u0433\u043a\u043e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0446\u0435\u043b\u043e\u0439 \u0433\u043b\u0430\u0432\u043e\u0439 \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u0435\u0435. \u041a\u043e\u0434 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u0430:<\/p>\n<pre><code class=\"python\">def coref_resolution(text):     \"\"\"Function that executes coreference resolution on a given text\"\"\"     doc = nlp(text)     # fetches tokens with whitespaces from spacy document     tok_list = list(token.text_with_ws for token in doc)     for cluster in doc._.coref_clusters:         # get tokens from representative cluster name         cluster_main_words = set(cluster.main.text.split(' '))         for coref in cluster:             if coref != cluster.main:  # if coreference element is not the representative element of that cluster                 if coref.text != cluster.main.text and bool(set(coref.text.split(' ')).intersection(cluster_main_words)) == False:                     # if coreference element text and representative element text are not equal and none of the coreference element words are in representative element. This was done to handle nested coreference scenarios                     tok_list[coref.start] = cluster.main.text + \\                         doc[coref.end-1].whitespace_                     for i in range(coref.start+1, coref.end):                         tok_list[i] = \"\"      return \"\".join(tok_list)<\/code><\/pre>\n<h3>\u0420\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u0430\u0432\u0438\u043b SpaCy<\/h3>\n<p>\u042f \u0445\u043e\u0442\u0435\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439, \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u043c\u043e\u0434\u0435\u043b\u0438 SpaCy, HuggingFace, Flair \u0438 \u0434\u0430\u0436\u0435 Stanford NLP, \u043d\u043e \u043d\u0438 \u043e\u0434\u043d\u0430 \u0438\u0437 \u043d\u0438\u0445 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u044f \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u043c\u0438 <a href=\"https:\/\/spacy.io\/usage\/rule-based-matching\">\u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f<\/a> \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u0430\u0432\u0438\u043b \u0432 SpaCy.<\/p>\n<p>\u041c\u044b \u0443\u0436\u0435 \u0437\u043d\u0430\u0435\u043c, \u043a\u0430\u043a\u0438\u0445 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439 \u0438\u0449\u0435\u043c. \u041e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u0441\u043f\u043e\u0441\u043e\u0431 \u0442\u043e\u0447\u043d\u0435\u0435 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438\u0445. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430.<\/p>\n<pre><code class=\"python\">def get_matcher_patterns(character):   matcher_pattern = []   stop_words = ['of', 'the', 'at', 'family', 'keeper', 'wizard', 'fat', 'de', 'hogwarts']   parts_of_name = [el for el in character['title'].split(' ') if len(el) > 2]   # Append the whole pattern   matcher_pattern.append([{\"LOWER\": n.lower(), \"IS_TITLE\": True} for n in parts_of_name])      # Append parts of names   if not \"'\" in character['title']: # Skip names like Vernon Dursley's secretary     for n in parts_of_name:       if n.lower() in stop_words: # Skip appending stop words         continue       matcher_pattern.append([{\"LOWER\": n.lower(), \"IS_TITLE\": True}])       # Special case for Ronald Weasley -> Also add Ron       if n == \"Ronald\":         matcher_pattern.append([{\"LOWER\": \"ron\", \"IS_TITLE\": True}])   return matcher_pattern<\/code><\/pre>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u0430\u043a \u0438\u0441\u043a\u043e\u043c\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u043d\u043e\u0435 \u0438\u043c\u044f, \u0437\u0430\u0442\u0435\u043c \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043c \u0438\u043c\u044f \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u043c \u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u0438\u0437 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430. \u041f\u0440\u0438\u043c\u0435\u0440: \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0434\u043b\u044f \u0410\u043b\u044c\u0431\u0443\u0441\u0430 \u0414\u0430\u043c\u0431\u043b\u0434\u043e\u0440\u0430, \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0442\u0440\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430:<\/p>\n<ul>\n<li>\n<p>\u043f\u043e\u043b\u043d\u043e\u0435 \u0438\u043c\u044f: \u0410\u043b\u044c\u0431\u0443\u0441 \u0414\u0430\u043c\u0431\u043b\u0434\u043e\u0440;<\/p>\n<\/li>\n<li>\n<p>\u0438\u043c\u044f: \u0410\u043b\u044c\u0431\u0443\u0441;<\/p>\n<\/li>\n<li>\n<p>\u0444\u0430\u043c\u0438\u043b\u0438\u044f: \u0414\u0430\u043c\u0431\u043b\u0434\u043e\u0440.<\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0441\u0442\u044c \u0438 \u043a\u043e\u0435-\u043a\u0430\u043a\u0438\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f: \u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043a\u043d\u0438\u0433\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436 \u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435\u043b\u044c \u0437\u043e\u043e\u043f\u0430\u0440\u043a\u0430 [Keeper of the Zoo]. \u0418\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043d\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c &#171;of&#187; \u0438\u043b\u0438 &#171;the&#187; \u043a\u0430\u043a \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0425\u043e\u0447\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u043b\u043e\u0432\u0430 \u0431\u044b\u043b\u0438 \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b \u043a \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0443. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u0441\u043b\u043e\u0432\u0430 black \u043d\u0435 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043b\u0438\u0441\u044c \u043a\u0430\u043a \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0421\u0438\u0440\u0438\u0443\u0441\u0430 \u0411\u043b\u044d\u043a\u0430.<\/p>\n<p>\u0411\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u0440\u0435\u0447\u044c \u0438\u0434\u0451\u0442 \u043e \u0421\u0438\u0440\u0438\u0443\u0441\u0435 \u0411\u043b\u044d\u043a\u0435, \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 Black \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0437\u0430\u0433\u043b\u0430\u0432\u043d\u044b\u043c\u0438. \u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0435 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e: Black \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0437\u0430\u0433\u043b\u0430\u0432\u043d\u044b\u043c\u0438 \u0438\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0441\u043b\u043e\u0432\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043d\u043e \u0442\u0430\u043a\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e.<\/p>\n<p>\u041e\u0441\u043e\u0431\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u2014 \u0420\u043e\u043d\u0430\u043b\u044c\u0434 \u0423\u0438\u0437\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u0442\u0435\u043a\u0441\u0442\u0435 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0420\u043e\u043d. \u041d\u0435 \u043e\u0442\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 &#171;\u0441\u0435\u043a\u0440\u0435\u0442\u0430\u0440\u044c \u0412\u0435\u0440\u043d\u043e\u043d\u0430 \u0414\u0443\u0440\u0441\u043b\u0438&#187; \u0438 &#171;\u0444\u0438\u043b\u0438\u043d \u0414\u0440\u0430\u043a\u043e \u041c\u0430\u043b\u0444\u043e\u044f&#187;.<\/p>\n<p>\u041f\u0440\u0438 \u0442\u0430\u043a\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0434\u0432\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u041f\u0435\u0440\u0432\u0430\u044f \u2014 \u0432 \u0442\u0435\u043a\u0441\u0442\u0435 &#171;\u0410\u043b\u044c\u0431\u0443\u0441 \u0414\u0430\u043c\u0431\u043b\u0434\u043e\u0440 \u2014 \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u0438\u043a&#187; \u043d\u0430\u0439\u0434\u0451\u0442\u0441\u044f \u0442\u0440\u0438 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044f, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432 \u0448\u0430\u0431\u043b\u043e\u043d\u0435 \u0435\u0441\u0442\u044c \u043a\u0430\u043a \u043f\u043e\u043b\u043d\u043e\u0435 \u0438\u043c\u044f, \u0442\u0430\u043a \u0438 \u0435\u0433\u043e \u0447\u0430\u0441\u0442\u0438. \u0420\u0435\u0448\u0435\u043d\u0438\u0435: \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044f\u043c \u0434\u043b\u0438\u043d\u043d\u0435\u0435. \u0415\u0441\u043b\u0438 \u0432 \u043e\u0434\u043d\u043e\u043c \u0438 \u0442\u043e\u043c \u0436\u0435 \u043c\u0435\u0441\u0442\u0435 \u0435\u0441\u0442\u044c \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u043b\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u0440\u0443\u0433\u043e\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430, \u0442\u043e \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u043e\u0442\u0434\u0430\u0434\u0438\u043c \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044e \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438.<\/p>\n<pre><code class=\"python\">  # Find matches   doc = nlp(text)   matches = matcher(doc)   result = []   for match_id, start, end in matches:       string_id = nlp.vocab.strings[match_id]  # Get string representation       span = doc[start:end]  # The matched span        # Get predicates for correct result appendment       exists_longer = [(start == e['start'] and end &lt; e['end']) or (start > e['start'] and end == e['end']) for e in result]       same = [start == e['start'] and end == e['end'] for e in result]       shorter_end = [start == e['start'] and end > e['end'] for e in result]       shorter_start = [start &lt; e['start'] and end == e['end'] for e in result]              # Append to results       if any(exists_longer): # If there is a longer version of the given entity already in results         continue              if any(shorter_end): # If there is any entity with the same start span but has shorter end         del result[shorter_end.index(True)]         result.append({'string_id': [string_id], 'start': start, 'end': end, 'text': span.text})        elif any(shorter_start): # If there is any entity with the same end span but has shorter start         del result[shorter_start.index(True)]         result.append =({'string_id': [string_id], 'start': start, 'end': end, 'text': span.text})        elif not any(same): # If not exists yet         result.append({'string_id': [string_id], 'start': start, 'end': end, 'text': span.text})       else: # Add more entities to a single span         i = same.index(True)         result[i]['string_id'].append(string_id)<\/code><\/pre>\n<p><em>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0437\u0430\u0446\u0438\u0435\u0439.<\/em><\/p>\n<p>\u041c\u043e\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0441 \u0431\u043e\u043b\u0435\u0435 \u0434\u043b\u0438\u043d\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u0430. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043e\u043d\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043b\u0438 \u0441\u0440\u0435\u0434\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u0434\u043b\u0438\u043d\u043d\u0435\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445.<\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f, \u043d\u0435 \u0434\u043b\u0438\u043d\u043d\u0435\u0435 \u043b\u0438 \u0432\u0441\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0432 \u0442\u043e\u0439 \u0436\u0435 \u043f\u043e\u0437\u0438\u0446\u0438\u0438, \u0447\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0435\u0441\u043b\u0438 \u0435\u0449\u0451 \u043d\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f &#171;else&#187;, \u0432\u0435\u0434\u044c \u0438\u043d\u043e\u0433\u0434\u0430 \u043e\u0434\u043d\u043e\u0439 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439: &#171;\u0423\u0438\u0437\u043b\u0438, \u0438\u0434\u0438 \u0441\u044e\u0434\u0430!&#187;. \u0412 \u043a\u043d\u0438\u0433\u0435 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0423\u0438\u0437\u043b\u0438. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u0441\u0441\u044b\u043b\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u0435\u0433\u043e \u0444\u0430\u043c\u0438\u043b\u0438\u0438, \u0430 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439 \u0441 \u0442\u0430\u043a\u043e\u0439 \u0444\u0430\u043c\u0438\u043b\u0438\u0435\u0439 \u043c\u043d\u043e\u0433\u043e. \u0427\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u043e\u0431\u0449\u0435\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"python\">hardcoded_options = dict() hardcoded_options['Malfoy'] = ['Draco Malfoy'] hardcoded_options['Patil'] = ['Padma Patil', 'Parvati Patil'] hardcoded_options['Tom'] = ['Tom']  def handle_multiple_options(result, doc):   needs_deduplication = [(i,x) for i,x in enumerate(result) if len(x['string_id']) > 1]   for index, multiple_options in needs_deduplication:     # Special logic for Dursleys, if there if Mr. then Vernon, if Mrs. then Petunia     prefix = doc[multiple_options['start']-3 : multiple_options['start']]     if (multiple_options['text'] == 'Dursley') and (\"Mr.\" in prefix.text):       resolution = [\"Vernon Dursley\"]     elif (multiple_options['text'] == 'Dursley') and (\"Mrs.\" in prefix.text):       resolution = [\"Petunia Dursley\"]     # Find nearest entity     else:       end_char = multiple_options['end']       distance = sys.maxsize       resolution = []       for possible_option in result:         # Skip multiple options and entities that don't have any of the multiple option         if (not len(possible_option['string_id']) == 1) or (not possible_option['string_id'][0] in multiple_options['string_id']):           continue         new_distance = abs(multiple_options['end'] - possible_option['end'])         if new_distance &lt; distance:           distance = new_distance           resolution = possible_option['string_id']              if not resolution:         try:           ho = hardcoded_options[multiple_options['text']]           if len(ho) == 1:             resolution = ho           else:             resolution = [random.choice(ho)]         except:           print(f\"no way to disambiguate {multiple_options['text']} from options: {multiple_options['string_id']}\")          result[index]['string_id'] = resolution   return result<\/code><\/pre>\n<p>\u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u0438\u043d\u043d\u0435\u0435. \u041c\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0438\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439. \u042f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043b\u043e\u0433\u0438\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u0441\u0442\u0440\u0430\u043d\u044f\u0435\u0442 \u043d\u0435\u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e\u0441\u0442\u044c \u0441 \u043c\u0438\u0441\u0442\u0435\u0440\u043e\u043c \u0438 \u043c\u0438\u0441\u0441\u0438\u0441 \u0414\u0443\u0440\u0441\u043b\u0438. \u0415\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043c &#171;\u0414\u0443\u0440\u0441\u043b\u0438&#187; \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 &#171;\u043c\u0438\u0441\u0442\u0435\u0440&#187;, \u0442\u043e \u044d\u0442\u043e \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0412\u0435\u0440\u043d\u043e\u043d\u0430, \u0430 \u0435\u0441\u043b\u0438 &#171;\u043c\u0438\u0441\u0441\u0438\u0441&#187; \u2014 \u043d\u0430 \u041f\u0435\u0442\u0443\u043d\u0438\u044e. \u0418 \u0432\u043e\u0442 \u043e\u0431\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435: \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442 \u0441\u0441\u044b\u043b\u043a\u0443 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u043c\u0443 \u0441\u043e\u0441\u0435\u0434\u0443.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043c\u0435\u0436\u0434\u0443 \u0413\u0430\u0440\u0440\u0438 \u041f\u043e\u0442\u0442\u0435\u0440\u043e\u043c, \u0414\u0436\u0435\u0439\u043c\u0441\u043e\u043c \u041f\u043e\u0442\u0442\u0435\u0440\u043e\u043c \u0438 \u041b\u0438\u043b\u0438 \u041f\u043e\u0442\u0442\u0435\u0440. \u0422\u043e\u0433\u0434\u0430 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0443\u044e \u0432 \u0442\u0435\u043a\u0441\u0442\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u0438\u0437 \u0442\u0440\u0451\u0445 \u0438 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u043c\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0443 \u0435\u0451 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u0415\u0441\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u043d\u043e\u0435 \u0438\u043b\u0438 \u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u0438\u043c\u044f \u043d\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u043e\u0434\u043d\u043e\u0439 \u0433\u043b\u0430\u0432\u044b, \u0442\u0430\u043a \u0447\u0442\u043e \u043a\u0430\u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e \u044f \u0436\u0451\u0441\u0442\u043a\u043e \u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043b \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b.<\/p>\n<h3>\u0412\u044b\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0439 \u043c\u0435\u0436\u0434\u0443 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430\u043c\u0438<\/h3>\n<p>\u0421\u0430\u043c\u043e\u0435 \u0442\u0440\u0443\u0434\u043d\u043e\u0435 \u043f\u043e\u0437\u0430\u0434\u0438. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434 \u043e\u0431 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f\u0445 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u043e\u0440\u043e\u0433 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f (\u0438\u043b\u0438 \u0441\u0432\u044f\u0437\u0438) \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430\u043c\u0438. \u041a\u0430\u043a \u0443\u0436\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u043e\u0441\u044c, \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u0442 \u0436\u0435 \u043f\u043e\u0440\u043e\u0433 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u0447\u0442\u043e \u0438 \u043f\u0440\u0438 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0438 \u0433\u0440\u0430\u0444\u0430 &#171;\u0418\u0433\u0440\u044b \u043f\u0440\u0435\u0441\u0442\u043e\u043b\u043e\u0432&#187;.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0434\u0432\u0430 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0430 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0438 14 \u0441\u043b\u043e\u0432, \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043e\u043d\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u043b\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c. \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0438\u0441\u043a\u0430\u0436\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b, \u044f \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u043b \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438. \u041e \u0447\u0451\u043c \u044f \u0433\u043e\u0432\u043e\u0440\u044e? \u0415\u0441\u0442\u044c \u0434\u0432\u0430 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f:<\/p>\n<blockquote>\n<p>&#171;\u0423 \u0413\u0430\u0440\u0440\u0438 \u0431\u044b\u043b \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u0434\u0435\u043d\u044c. \u041f\u043e\u0441\u043b\u0435 \u043e\u0431\u0435\u0434\u0430 \u043e\u043d \u043f\u043e\u0448\u0451\u043b \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u0441 \u0414\u0430\u043c\u0431\u043b\u0434\u043e\u0440\u043e\u043c&#187;.<\/p>\n<\/blockquote>\n<p>\u0417\u0434\u0435\u0441\u044c \u0431\u0443\u0434\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e \u0442\u0440\u0438 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438: &#171;\u0413\u0430\u0440\u0440\u0438&#187;, &#171;\u041e\u043d&#187; \u043a\u0430\u043a \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0413\u0430\u0440\u0440\u0438 \u0438 &#171;\u0414\u0430\u043c\u0431\u043b\u0434\u043e\u0440&#187;. \u0420\u0435\u0448\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0443 \u0432 \u043b\u043e\u0431, \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434 \u043e \u0434\u0432\u0443\u0445 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u0445 \u043c\u0435\u0436\u0434\u0443 \u0413\u0430\u0440\u0440\u0438 \u0438 \u0414\u0430\u043c\u0431\u043b\u0434\u043e\u0440\u043e\u043c, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0434\u0432\u0430 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u044f &#171;\u0413\u0430\u0440\u0440\u0438&#187; \u0431\u043b\u0438\u0437\u043a\u0438 \u043a \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u044e &#171;\u0414\u0430\u043c\u0431\u043b\u0434\u043e\u0440\u0430&#187;. \u0422\u0430\u043a\u043e\u0433\u043e \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u043b \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0433\u0434\u0435 \u043d\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430 \u0441\u0441\u044b\u043b\u0430\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u043d\u0430 \u043e\u0434\u043d\u0443 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c. \u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u0430\u0440 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439:<\/p>\n<pre><code class=\"python\">def get_distances(result, distance_threshold):   #sort by start character   result = sorted(result, key=lambda k: k['start'])   compact_entities = []   # Merge entities   for entity in result:     # If the same entity occurs, prolong the end      if (len(compact_entities) > 0) and (compact_entities[-1]['string_id'] == entity['string_id']):       compact_entities[-1]['end'] = entity['end']     else:       compact_entities.append(entity)   distances = list()   # Iterate over all entities   for index, source in enumerate(compact_entities[:-1]):     # Compare with entities that come after the given one     for target in compact_entities[index + 1:]:       if (source['string_id'] != target['string_id']) and (abs(source['end'] - target['start']) &lt; distance_threshold):         link = sorted([source['string_id'][0], target['string_id'][0]])         distances.append(link)       else:         break   # Count the number of interactions   return Counter(map(tuple, distances))   <\/code><\/pre>\n<h3>\u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432 \u0433\u0440\u0430\u0444\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 Neo4j<\/h3>\n<p>\u041c\u044b \u0438\u0437\u0432\u043b\u0435\u043a\u043b\u0438 \u0433\u0440\u0430\u0444 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043c\u0435\u0436\u0434\u0443 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430\u043c\u0438, \u0438 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432 \u0433\u0440\u0430\u0444\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u0417\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0438\u043c\u043f\u043e\u0440\u0442 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0434\u0435\u043b\u043e \u0441 \u0441\u0435\u0442\u044c\u044e \u043c\u043e\u043d\u043e\u0447\u0430\u0441\u0442\u0438\u0446. \u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043c\u043d\u043e\u0439 \u0431\u043b\u043e\u043a\u043d\u043e\u0442 <a href=\"https:\/\/github.com\/tomasonjo\/blogs\/blob\/master\/harry_potter\/HarryPotterNLP.ipynb\">Colab<\/a>, \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u043f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0435 <a href=\"https:\/\/neo4j.com\/sandbox\/\">Neo4j Sandbox<\/a> \u0438\u043b\u0438 \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 <a href=\"https:\/\/neo4j.com\/cloud\/aura\/\">Aura<\/a>:<\/p>\n<pre><code class=\"python\">def store_to_neo4j(distances):   data = [{'source': el[0], 'target': el[1], 'weight': distances[el]} for el in distances]   with driver.session() as session:     session.run(\"\"\"     UNWIND $data as row     MERGE (c:Character{name:row.source})     MERGE (t:Character{name:row.target})     MERGE (c)-[i:INTERACTS]-(t)     SET i.weight = coalesce(i.weight,0) + row.weight     \"\"\", {'data': data})<\/code><\/pre>\n<p>\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u0438\u0445:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f7e\/38f\/f74\/f7e38ff74dcbf58b97b86ad98035df67.png\" alt=\"\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 NEuler \u0433\u0440\u0430\u0444 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\" title=\"\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 NEuler \u0433\u0440\u0430\u0444 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\" width=\"1231\" height=\"680\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f7e\/38f\/f74\/f7e38ff74dcbf58b97b86ad98035df67.png\"\/><figcaption>\u0412\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 NEuler \u0433\u0440\u0430\u0444 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f<\/figcaption><\/figure>\n<p>\u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442 \u043a\u043b\u0430\u0441\u0441\u043d\u043e. \u0412 \u0446\u0435\u043d\u0442\u0440\u0435 \u0441\u0435\u0442\u0438 \u2014 \u0413\u0430\u0440\u0440\u0438 \u041f\u043e\u0442\u0442\u0435\u0440, \u043a\u043d\u0438\u0433\u0430 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u043e \u0413\u0430\u0440\u0440\u0438. \u0412\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043c\u043d\u0435 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043b\u043e \u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u043e\u043f-\u0441\u043b\u043e\u0432 \u0432 \u0448\u0430\u0431\u043b\u043e\u043d \u043c\u0430\u0442\u0447\u0435\u0440\u0430. \u0412\u0435\u043a \u0436\u0438\u0432\u0438 \u2014 \u0432\u0435\u043a \u0443\u0447\u0438\u0441\u044c. <\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/github.com\/tomasonjo\/blogs\/blob\/master\/harry_potter\/HarryPotterNLP.ipynb\">\u041a\u043e\u0434<\/a> \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/neo4j.com\/developer\/graph-data-science\/neuler-no-code-graph-algorithms\/\">\u041f\u0435\u0441\u043e\u0447\u043d\u0438\u0446\u0430<\/a> \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u043d\u0430 \u0433\u0440\u0430\u0444\u0430\u0445.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u043b\u044e\u0431\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 IT \u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0443\u0436\u043d\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c, \u0430 \u043d\u0430\u0448\u0438 \u043a\u0443\u0440\u0441\u044b \u0433\u043e\u0442\u043e\u0432\u044f\u0442 \u043a \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f\u043c \u0432 \u0441\u0444\u0435\u0440\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0431\u0430\u043b\u0430\u043d\u0441 \u0442\u0435\u043e\u0440\u0438\u0438 \u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438. \u041c\u044b \u043f\u0440\u0438\u0432\u0438\u0432\u0430\u0435\u043c \u043c\u044b\u0448\u043b\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u0432\u0430\u0441 \u043a \u043d\u0443\u0436\u043d\u043e\u043c\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443, \u043f\u043e\u044d\u0442\u043e\u043c\u0443, \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u044f\u0437\u044b\u043a\u043e\u043c \u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438, \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0435 \u043d\u0430 \u043d\u0430\u0448\u0438 \u043a\u0443\u0440\u0441\u044b \u043f\u043e <a href=\"https:\/\/skillfactory.ru\/dstpro?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_dspr_140821&amp;utm_term=conc\">Data Science<\/a>, \u043f\u043e <a href=\"https:\/\/skillfactory.ru\/dataanalystpro?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=analytics_dapr_140821&amp;utm_term=conc\">\u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/a> \u0438\u043b\u0438 \u043d\u0430 \u043a\u0443\u0440\u0441 \u043f\u043e <a href=\"https:\/\/skillfactory.ru\/ml-and-dl?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_mldl_140821&amp;utm_term=conc\">\u0433\u043b\u0443\u0431\u043e\u043a\u043e\u043c\u0443 \u0438 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u043c\u0443 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044e<\/a>, \u0433\u0434\u0435 \u0432\u044b \u043d\u0430\u0443\u0447\u0438\u0442\u0435\u0441\u044c \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c \u0438\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u0443 \u0438 \u0440\u0435\u0448\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0431\u0438\u0437\u043d\u0435\u0441\u0430. \u0422\u0430\u043a\u0436\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 <a href=\"https:\/\/skillfactory.ru\/courses\/?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=sf_allcourses_140821&amp;utm_term=conc\">\u0443\u0437\u043d\u0430\u0442\u044c<\/a>, \u043a\u0430\u043a \u043d\u0430\u0447\u0430\u0442\u044c \u043a\u0430\u0440\u044c\u0435\u0440\u0443 \u0438\u043b\u0438 \u043f\u0440\u043e\u043a\u0430\u0447\u0430\u0442\u044c\u0441\u044f \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u0445:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d4e\/599\/d35\/d4e599d355749a85e26af2490ddd7721.png\" width=\"1000\" height=\"200\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d4e\/599\/d35\/d4e599d355749a85e26af2490ddd7721.png\"\/><figcaption><\/figcaption><\/figure>\n<p><strong>Data Science \u0438 Machine Learning<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/dstpro?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_dspr_140821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Data Scientist<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/dataanalystpro?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=analytics_dapr_140821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Data Analyst<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/math-stat-for-ds#syllabus?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_mat_140821&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00ab\u041c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u0434\u043b\u044f Data Science\u00bb<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/math_and_ml?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_matml_140821&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00ab\u041c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u0438 Machine Learning \u0434\u043b\u044f Data Science\u00bb<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/dataengineer?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_dea_140821&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u043f\u043e Data Engineering<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/ml-and-dl?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_mldl_140821&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00abMachine Learning \u0438 Deep Learning\u00bb<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/ml-programma-machine-learning-online?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_ml_140821&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u043f\u043e Machine Learning<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>Python, \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/python-fullstack-web-developer?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_fpw_140821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Fullstack-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0430 Python<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/python-for-web-developers?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_pws_140821&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00abPython \u0434\u043b\u044f \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438\u00bb<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/frontend?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_fr_140821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Frontend-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/webdev?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_webdev_140821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u0412\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041c\u043e\u0431\u0438\u043b\u044c\u043d\u0430\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/iosdev?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_iosdev_140821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f iOS-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/android?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_andr_140821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Android-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>Java \u0438 C#<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/java?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_java_140821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Java-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/java-qa-engineer?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_qaja_140821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f QA-\u0438\u043d\u0436\u0435\u043d\u0435\u0440 \u043d\u0430 JAVA<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/csharp?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_cdev_140821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f C#-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/game-dev?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_gamedev_140821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0438\u0433\u0440 \u043d\u0430 Unity<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041e\u0442 \u043e\u0441\u043d\u043e\u0432 \u2014 \u0432 \u0433\u043b\u0443\u0431\u0438\u043d\u0443<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/algo?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_algo_140821&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00ab\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445\u00bb<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/cplus?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_cplus_140821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f C++ \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/cybersecurity?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_hacker_140821&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u042d\u0442\u0438\u0447\u043d\u044b\u0439 \u0445\u0430\u043a\u0435\u0440<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0410 \u0442\u0430\u043a\u0436\u0435:<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/devops?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_devops_140821&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u043f\u043e DevOps<\/a><\/p>\n<\/li>\n<\/ul>\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\/570582\/\"> https:\/\/habr.com\/ru\/articles\/570582\/<\/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<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\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 \u2014 \u044d\u0442\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u044b\u0435 \u0441\u0435\u0442\u0438, \u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u2014 \u044d\u0442\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a\u0438, \u0447\u0438\u0441\u043b\u0430 \u0438 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f. \u041e\u0431\u043b\u0430\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u0440\u043e\u0441\u0442\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0434\u0430\u043b\u044c\u0448\u0435. \u041a \u0441\u0442\u0430\u0440\u0442\u0443 \u0444\u043b\u0430\u0433\u043c\u0430\u043d\u0441\u043a\u043e\u0433\u043e <a href=\"https:\/\/skillfactory.ru\/dstpro?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_dspr_140821&amp;utm_term=lead\">\u043a\u0443\u0440\u0441\u0430 \u043f\u043e Data Science<\/a> \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0430\u0448\u0435\u043c\u0443 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044e \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0438\u0437 \u0431\u043b\u043e\u0433\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0433\u0440\u0430\u0444\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 neo4j \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 SpaCy \u0438 Selenium \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0438\u0437 \u043a\u043d\u0438\u0433\u0438 \u0433\u0440\u0430\u0444 \u0432\u0437\u0430\u0438\u043c\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0439 \u0433\u0435\u0440\u043e\u0435\u0432. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0438 \u043a\u043e\u0434, \u043a\u0430\u043a \u0432\u0441\u0435\u0433\u0434\u0430, \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c.<\/p>\n<hr\/>\n<p>\u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0432\u044b \u0443\u0436\u0435 \u0432\u0438\u0434\u0435\u043b\u0438 <a href=\"https:\/\/twitter.com\/mathbeveridge\">\u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439<\/a> \u042d\u043d\u0434\u0440\u044e \u0411\u0435\u0432\u0435\u0440\u0438\u0434\u0436\u0435\u043c \u0433\u0440\u0430\u0444 <a href=\"https:\/\/networkofthrones.wordpress.com\/\">Game of Thrones<\/a>. \u042d\u043d\u0434\u0440\u044e \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u043b \u0433\u0440\u0430\u0444 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043a\u043d\u0438\u0436\u043d\u044b\u0445 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439. \u0415\u0441\u043b\u0438 \u0434\u0432\u0430 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430 \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430 \u0432 \u0442\u0435\u043a\u0441\u0442\u0435, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u0447\u0442\u043e \u0432 \u043a\u043d\u0438\u0433\u0435 \u043e\u043d\u0438 \u043a\u0430\u043a-\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0438\u043b\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442. \u042f \u0440\u0435\u0448\u0438\u043b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u0443\u044e \u043a\u043d\u0438\u0433\u0443, \u043d\u0435 \u0438\u043c\u0435\u044e\u0449\u0443\u044e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u0439 \u043c\u043d\u0435 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0438 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0441\u0435\u0442\u0438. \u0422\u0430\u043a \u0440\u043e\u0434\u0438\u043b\u0441\u044f \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044e \u0433\u0440\u0430\u0444\u0430 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439 \u043a\u043d\u0438\u0433\u0438 \u201c\u0413\u0430\u0440\u0440\u0438 \u041f\u043e\u0442\u0442\u0435\u0440 \u0438 \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u0441\u043a\u0438\u0439 \u043a\u0430\u043c\u0435\u043d\u044c\u201d.<\/p>\n<p>\u042f \u043f\u0440\u043e\u0432\u0451\u043b \u043c\u043d\u043e\u0433\u043e \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u0440\u0435\u0448\u0438\u0442\u044c, \u043a\u0430\u043a \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0442\u044c. \u041f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c, \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044f \u0438\u0445 \u0440\u0430\u0431\u043e\u0442\u0443, \u043d\u043e \u043d\u0438 \u043e\u0434\u043d\u0430 \u0438\u0437 \u043d\u0438\u0445 \u043d\u0435 \u0431\u044b\u043b\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u0430. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0444\u044d\u043d\u0434\u043e\u043c\u0430 <a href=\"https:\/\/harrypotter.fandom.com\/wiki\/Main_Page\">\u0413\u0430\u0440\u0440\u0438 \u041f\u043e\u0442\u0442\u0435\u0440\u0430<\/a> \u0435\u0441\u0442\u044c <a href=\"https:\/\/harrypotter.fandom.com\/wiki\/Harry_Potter_and_the_Philosopher's_Stone_(character_index)\">\u0441\u043f\u0438\u0441\u043e\u043a <\/a>\u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439 \u043f\u0435\u0440\u0432\u043e\u0439 \u043a\u043d\u0438\u0433\u0438.<\/p>\n<p>\u041d\u0430\u043c \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430 \u0433\u043b\u0430\u0432\u0430 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0433\u0435\u0440\u043e\u044f, \u044d\u0442\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439. \u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u0432\u0441\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043d\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u0445 \u043c\u0430\u0442\u0447\u0435\u0440\u043e\u043c <a href=\"https:\/\/spacy.io\/\">SpaCy<\/a>. \u041e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u0435\u0442\u0440\u0438\u043a\u0443 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u044b\u0445 \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0439 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432 <a href=\"https:\/\/neo4j.com\/\">Neo4j<\/a>.<\/p>\n<p>\u041f\u043e\u0440\u043e\u0433 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0439 \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u0438\u0437 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0433\u0440\u0430\u0444\u0430 &#171;\u0418\u0433\u0440\u044b \u043f\u0440\u0435\u0441\u0442\u043e\u043b\u043e\u0432&#187;: \u043a\u043e\u0433\u0434\u0430 \u0434\u0432\u0430 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430 \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 14 \u0441\u043b\u043e\u0432 \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430, \u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u043e\u043d\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0438, \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u044d\u0442\u0438\u0445 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043a\u0430\u043a \u0432\u0435\u0441 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0439.<\/p>\n<h3>\u041f\u043b\u0430\u043d<\/h3>\n<ol>\n<li>\n<p>\u041f\u0430\u0440\u0441\u0438\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0444\u044d\u043d\u0434\u043e\u043c\u0430 \u0413\u0430\u0440\u0440\u0438 \u041f\u043e\u0442\u0442\u0435\u0440\u0430.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0442\u0435\u043a\u0441\u0442 \u043a\u043d\u0438\u0433\u0438, \u0440\u0435\u0448\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u044b\u0445 \u0441\u0441\u044b\u043b\u043e\u043a.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0451\u043c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u0430\u0432\u0438\u043b SpaCy.<\/p>\n<\/li>\n<li>\n<p>\u0414\u0435\u043b\u0430\u0435\u043c \u0432\u044b\u0432\u043e\u0434\u044b \u043e\u0431 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f\u0445 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432 \u0433\u0440\u0430\u0444\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 Neo4j.<\/p>\n<\/li>\n<\/ol>\n<p>\u041d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439 \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u0448\u0430\u0433\u0438, \u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b \u0431\u043b\u043e\u043a\u043d\u043e\u0442 <a href=\"https:\/\/github.com\/tomasonjo\/blogs\/blob\/master\/harry_potter\/HarryPotterNLP.ipynb\">Google Colab<\/a>.<\/p>\n<h4>\u0421\u043a\u0440\u044d\u043f\u0438\u043d\u0433 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0444\u044d\u043d\u0434\u043e\u043c\u0430 \u0413\u0430\u0440\u0440\u0438 \u041f\u043e\u0442\u0442\u0435\u0440\u0430<\/h4>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u0441 <a href=\"https:\/\/selenium-python.readthedocs.io\/\">Selenium<\/a>, \u0441\u043e\u0431\u0435\u0440\u0451\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439 \u043a\u043d\u0438\u0433\u0438 &#171;\u0413\u0430\u0440\u0440\u0438 \u041f\u043e\u0442\u0442\u0435\u0440 \u0438 \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u0441\u043a\u0438\u0439 \u043a\u0430\u043c\u0435\u043d\u044c&#187;, \u0432\u043e\u0442 <a href=\"https:\/\/harrypotter.fandom.com\/wiki\/Harry_Potter_and_the_Philosopher's_Stone_(character_index)\">\u0441\u043f\u0438\u0441\u043e\u043a <\/a>\u0438\u0445 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u0439.<\/p>\n<pre><code class=\"python\">wd = webdriver.Chrome('chromedriver',chrome_options=chrome_options) wd.get(url) character_dict = dict() elem = wd.find_element_by_class_name(\"mw-parser-output\")  # Locate character by chapter tables = elem.find_elements_by_tag_name('table') for i, chapter in enumerate(tables):   list_of_characters = []   characters = chapter.find_elements_by_tag_name('a')   for character in characters:     if not character.get_attribute('title'):       continue     list_of_characters.append({'title': character.get_attribute('title'), 'url': character.get_attribute('href')})   character_dict['chapter_' + str(i + 1)] = list_of_characters<\/code><\/pre>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043a\u043e\u0434\u0443 \u0432\u044b\u0448\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439 \u0441 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u043e\u0431 \u0438\u0445 \u043f\u0435\u0440\u0432\u043e\u043c \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0438 \u0432 \u043a\u043d\u0438\u0433\u0435. \u0423 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430 \u0435\u0441\u0442\u044c \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0441 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u043e \u043d\u0451\u043c.<\/p>\n<p>\u041d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 <a href=\"https:\/\/harrypotter.fandom.com\/wiki\/Hermione_Granger\">\u0413\u0435\u0440\u043c\u0438\u043e\u043d\u044b \u0413\u0440\u0435\u0439\u043d\u0434\u0436\u0435\u0440<\/a> \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439. \u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u0438\u0437 \u043a\u043d\u0438\u0433\u0438 \u0438 \u043e\u0431\u043e\u0433\u0430\u0442\u0438\u0442\u044c \u0433\u0440\u0430\u0444 \u0437\u043d\u0430\u043d\u0438\u0439, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u043e\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441 \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c\u0430\u043c\u0438 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0434\u0435\u0442\u0430\u043b\u0438, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u0434\u043e\u043c \u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043f\u043e \u043a\u0440\u043e\u0432\u0438.<\/p>\n<pre><code class=\"python\">  for chapter in character_dict:     for index, character in enumerate(character_dict[chapter]):       # Rate limit sleep       time.sleep(1)       # Get the character page with selenium       wd.get(character['url'])       # Enrich aliases       try:         alias_div = wd.find_element_by_xpath(\"\/\/div[@data-source = 'alias']\")         aliases = alias_div.find_elements_by_tag_name('li')         result = []         for a in aliases:           # Ignore under the cloak-guise and the name he told           if \"disguise\" in a.text or \"the name he told\" in a.text:             continue           alias = a.text.split('[')[0].split('(')[0].strip()           result.append(alias)         character_dict[chapter][index]['aliases'] = result       except:         pass       # Enrich blood       character_dict[chapter][index]['blood'] = enrich_single_item('blood')       # Enrich nationality       character_dict[chapter][index]['nationality'] = enrich_single_item('nationality')<\/code><\/pre>\n<p>\u0414\u043b\u044f \u044f\u0441\u043d\u043e\u0441\u0442\u0438 \u044f \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e \u043d\u0435 \u0432\u0435\u0441\u044c \u043a\u043e\u0434, \u0430 \u0442\u0430\u043a\u0436\u0435 \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443 \u0413\u0430\u0440\u0440\u0438 \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/harrypotter.fandom.com\/wiki\/Gregory_Goyle\">\u0413\u0440\u0435\u0433\u043e\u0440\u0438 \u0413\u043e\u0439\u043b<\/a> (\u043f\u043e\u0434 \u043c\u0430\u0441\u043a\u0438\u0440\u043e\u0432\u043a\u043e\u0439 Polyjuice).<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u043e\u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u043c \u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c\u044b \u043f\u043e\u0434 \u043c\u0430\u0441\u043a\u0438\u0440\u043e\u0432\u043a\u043e\u0439 Polyjuice. \u0410 \u0435\u0449\u0451, \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0413\u0430\u0440\u0440\u0438 \u0441\u043a\u0430\u0437\u0430\u043b \u0421\u0442\u044d\u043d\u043b\u0438 \u0428\u0430\u043d\u043f\u0430\u0439\u043a\u0443, \u0447\u0442\u043e \u043e\u043d \u041d\u0435\u0432\u0438\u043b\u043b \u041b\u043e\u043d\u0433\u0431\u043e\u0442\u0442\u043e\u043c, \u044d\u0442\u043e \u043c\u044b \u0442\u043e\u0436\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043c. \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439, \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0432 Neo4j. \u041d\u0430\u0448\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b:<\/p>\n<ul>\n<li>\n<p>\u0438\u043c\u044f;<\/p>\n<\/li>\n<li>\n<p>\u0430\u0434\u0440\u0435\u0441 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b;<\/p>\n<\/li>\n<li>\n<p>\u043f\u0441\u0435\u0432\u0434\u043e\u043d\u0438\u043c\u044b;<\/p>\n<\/li>\n<li>\n<p>\u043d\u0430\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c;<\/p>\n<\/li>\n<li>\n<p>\u043a\u0440\u043e\u0432\u043d\u043e\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435;<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e\u043b;<\/p>\n<\/li>\n<li>\n<p>\u0431\u0438\u043e\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0432\u0438\u0434.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u0437\u0430\u0438\u043c\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u0434\u043e\u043c;<\/p>\n<\/li>\n<li>\n<p>\u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u0440\u0435\u0434\u0430\u043d \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436;<\/p>\n<\/li>\n<li>\n<p>\u0441\u0435\u043c\u044c\u044f.<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"python\">entity_query = \"\"\" UNWIND $data as row MERGE (c:Character{name:row.title}) SET c.url = row.url,     c.aliases = row.aliases,     c.blood = row.blood,     c.nationality = row.nationality,     c.species = row.species,     c.gender = row.gender FOREACH (h in CASE WHEN row.house IS NOT NULL THEN [1] ELSE [] END | MERGE (h1:House{name:row.house}) MERGE (c)-[:BELONGS_TO]->(h1)) FOREACH (l in row.loyalty | MERGE (g:Group{name:l}) MERGE (c)-[:LOYAL_TO]->(g)) FOREACH (f in row.family | MERGE (f1:Character{name:f.person}) MERGE (c)-[t:FAMILY_MEMBER]->(f1) SET t.type = f.type)      \"\"\" with driver.session() as session:   for chapter in character_dict:     session.run(entity_query, {'data': character_dict[chapter]})<\/code><\/pre>\n<p>\u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430\u0445 \u0432 Neo4j<\/p>\n<figure class=\"full-width\"><figcaption>\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0434\u0433\u0440\u0430\u0444\u0430 \u0413\u0435\u0440\u043c\u0438\u043e\u043d\u044b \u0413\u0440\u0435\u0439\u043d\u0434\u0436\u0435\u0440<\/figcaption><\/figure>\n<p>\u041f\u043e\u0445\u043e\u0436\u0435, \u0413\u0435\u0440\u043c\u0438\u043e\u043d\u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0430 \u043a\u0430\u043a \u041c\u0430\u043b\u0435\u043d\u044c\u043a\u0430\u044f \u043c\u0438\u0441\u0441 \u0421\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e \u0438 \u043f\u0440\u0435\u0434\u0430\u043d\u0430 \u041e\u0431\u0449\u0435\u0441\u0442\u0432\u0443 \u0441\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0431\u043b\u0430\u0433\u043e\u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044e \u044d\u043b\u044c\u0444\u043e\u0432. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u044b \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0424\u0440\u0435\u0434 \u0423\u0438\u0437\u043b\u0438 \u0443\u0436\u0435 \u0441\u0435\u0439\u0447\u0430\u0441 \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0448\u0443\u0440\u0438\u043d\u043e\u043c \u041c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u0439 \u043c\u0438\u0441\u0441 \u0421\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e.<\/p>\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 \u0442\u0435\u043a\u0441\u0442\u0430<\/h4>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u043a\u043d\u0438\u0433\u0438. \u042f \u043d\u0430\u0448\u0451\u043b \u043d\u0430 GitHub <a href=\"https:\/\/github.com\/amephraim\/nlp\/tree\/master\/texts\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439<\/a> \u0441 \u0442\u0435\u043a\u0441\u0442\u0430\u043c\u0438 \u043f\u0435\u0440\u0432\u044b\u0445 \u0447\u0435\u0442\u044b\u0440\u0451\u0445 \u043a\u043d\u0438\u0433 \u043e \u0413\u0430\u0440\u0440\u0438 \u041f\u043e\u0442\u0442\u0435\u0440\u0435. \u041a \u0434\u0430\u043d\u043d\u044b\u043c \u043d\u0435 \u043f\u0440\u0438\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0443, \u0447\u0442\u043e \u0432\u043f\u0440\u0430\u0432\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445 \u0441 \u0447\u0438\u0441\u0442\u043e\u0439 \u0441\u043e\u0432\u0435\u0441\u0442\u044c\u044e:<\/p>\n<pre><code class=\"python\">def get_text(url):   try:     return requests.get(url).text   except:     print(\"No text was found\")     return None<\/code><\/pre>\n<p>\u041c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043d\u0435\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u043e\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435, \u0438 \u044d\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c.<\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u044f \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u043b \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438, \u0442\u043e \u0437\u0430\u0431\u044b\u043b \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043a\u043e\u0440\u0435\u0444\u0435\u0440\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u0438, \u0442\u043e \u0435\u0441\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0435\u0441\u044f \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u0438 \u0442\u043e\u043c\u0443 \u0436\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u043b\u0438\u043d\u0433\u0432\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043c\u043e\u0439 <a href=\"https:\/\/towardsdatascience.com\/from-text-to-knowledge-the-information-extraction-pipeline-b65e7e30273e\">\u043f\u043e\u0441\u0442<\/a> \u043e \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0435 \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0432 \u043d\u0451\u043c \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440.<\/p>\n<p>\u042f \u0438\u0441\u043a\u0430\u043b \u043c\u043e\u0434\u0435\u043b\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043a\u043e\u0440\u0435\u0444\u0435\u0440\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u0438 \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c, \u043d\u043e, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044f \u0437\u043d\u0430\u044e, \u0438\u0445 \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0435. \u041f\u0435\u0440\u0432\u0430\u044f \u2014 <a href=\"https:\/\/github.com\/huggingface\/neuralcoref\">NeuralCoref<\/a>, \u043e\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e\u0432\u0435\u0440\u0445 SpaCy, \u0432\u0442\u043e\u0440\u0430\u044f \u2014 AllenNLP. \u0420\u0430\u043d\u0435\u0435 \u044f \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0441 NeuralCoref \u0438 \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 AllenNLP.<\/p>\n<p>\u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0432 Colab 16 \u0413\u0411 \u041e\u0417\u0423 \u0438 \u043f\u0430\u043c\u044f\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u043e \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0430\u0441\u044c, \u043a\u043e\u0433\u0434\u0430 \u044f \u0432\u0432\u043e\u0434\u0438\u043b \u0432\u0441\u044e \u0433\u043b\u0430\u0432\u0443 \u0432 AllenNLP. \u0417\u0430\u0442\u0435\u043c \u044f \u043d\u0430\u0440\u0435\u0437\u0430\u043b \u0433\u043b\u0430\u0432\u0443 \u043d\u0430 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043d\u043e \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043e\u0447\u0435\u043d\u044c \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0438\u0437-\u0437\u0430 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 BERT, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e NeuralCoref, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043b\u0435\u0433\u043a\u043e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0446\u0435\u043b\u043e\u0439 \u0433\u043b\u0430\u0432\u043e\u0439 \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u0435\u0435. \u041a\u043e\u0434 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u0430:<\/p>\n<pre><code class=\"python\">def coref_resolution(text):     \"\"\"Function that executes coreference resolution on a given text\"\"\"     doc = nlp(text)     # fetches tokens with whitespaces from spacy document     tok_list = list(token.text_with_ws for token in doc)     for cluster in doc._.coref_clusters:         # get tokens from representative cluster name         cluster_main_words = set(cluster.main.text.split(' '))         for coref in cluster:             if coref != cluster.main:  # if coreference element is not the representative element of that cluster                 if coref.text != cluster.main.text and bool(set(coref.text.split(' ')).intersection(cluster_main_words)) == False:                     # if coreference element text and representative element text are not equal and none of the coreference element words are in representative element. This was done to handle nested coreference scenarios                     tok_list[coref.start] = cluster.main.text + \\                         doc[coref.end-1].whitespace_                     for i in range(coref.start+1, coref.end):                         tok_list[i] = \"\"      return \"\".join(tok_list)<\/code><\/pre>\n<h3>\u0420\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u0430\u0432\u0438\u043b SpaCy<\/h3>\n<p>\u042f \u0445\u043e\u0442\u0435\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u044c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439, \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u043c\u043e\u0434\u0435\u043b\u0438 SpaCy, HuggingFace, Flair \u0438 \u0434\u0430\u0436\u0435 Stanford NLP, \u043d\u043e \u043d\u0438 \u043e\u0434\u043d\u0430 \u0438\u0437 \u043d\u0438\u0445 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u044f \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u043c\u0438 <a href=\"https:\/\/spacy.io\/usage\/rule-based-matching\">\u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f<\/a> \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u0430\u0432\u0438\u043b \u0432 SpaCy.<\/p>\n<p>\u041c\u044b \u0443\u0436\u0435 \u0437\u043d\u0430\u0435\u043c, \u043a\u0430\u043a\u0438\u0445 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u0439 \u0438\u0449\u0435\u043c. \u041e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u0441\u043f\u043e\u0441\u043e\u0431 \u0442\u043e\u0447\u043d\u0435\u0435 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438\u0445. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430.<\/p>\n<pre><code class=\"python\">def get_matcher_patterns(character):   matcher_pattern = []   stop_words = ['of', 'the', 'at', 'family', 'keeper', 'wizard', 'fat', 'de', 'hogwarts']   parts_of_name = [el for el in character['title'].split(' ') if len(el) > 2]   # Append the whole pattern   matcher_pattern.append([{\"LOWER\": n.lower(), \"IS_TITLE\": True} for n in parts_of_name])      # Append parts of names   if not \"'\" in character['title']: # Skip names like Vernon Dursley's secretary     for n in parts_of_name:       if n.lower() in stop_words: # Skip appending stop words         continue       matcher_pattern.append([{\"LOWER\": n.lower(), \"IS_TITLE\": True}])       # Special case for Ronald Weasley -> Also add Ron       if n == \"Ronald\":         matcher_pattern.append([{\"LOWER\": \"ron\", \"IS_TITLE\": True}])   return matcher_pattern<\/code><\/pre>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043a\u0430\u043a \u0438\u0441\u043a\u043e\u043c\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u043d\u043e\u0435 \u0438\u043c\u044f, \u0437\u0430\u0442\u0435\u043c \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043c \u0438\u043c\u044f \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u043c \u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0448\u0430\u0431\u043b\u043e\u043d \u0438\u0437 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430. \u041f\u0440\u0438\u043c\u0435\u0440: \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0434\u043b\u044f \u0410\u043b\u044c\u0431\u0443\u0441\u0430 \u0414\u0430\u043c\u0431\u043b\u0434\u043e\u0440\u0430, \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0442\u0440\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0448\u0430\u0431\u043b\u043e\u043d\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0430:<\/p>\n<ul>\n<li>\n<p>\u043f\u043e\u043b\u043d\u043e\u0435 \u0438\u043c\u044f: \u0410\u043b\u044c\u0431\u0443\u0441 \u0414\u0430\u043c\u0431\u043b\u0434\u043e\u0440;<\/p>\n<\/li>\n<li>\n<p>\u0438\u043c\u044f: \u0410\u043b\u044c\u0431\u0443\u0441;<\/p>\n<\/li>\n<li>\n<p>\u0444\u0430\u043c\u0438\u043b\u0438\u044f: \u0414\u0430\u043c\u0431\u043b\u0434\u043e\u0440.<\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0441\u0442\u044c \u0438 \u043a\u043e\u0435-\u043a\u0430\u043a\u0438\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f: \u044f <\/p>\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-381886","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/381886","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=381886"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/381886\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=381886"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=381886"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=381886"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}