{"id":321145,"date":"2021-04-08T21:00:19","date_gmt":"2021-04-08T21:00:19","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=321145"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=321145","title":{"rendered":"\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0438 \u0430\u043d\u0430\u043b\u0438\u0437 \u0442\u0435\u043a\u0441\u0442\u043e\u0432 \u043d\u0430 Python \u0438 Spark NLP"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u0412 \u043d\u0430\u0448\u0435 \u0432\u0440\u0435\u043c\u044f \u0431\u0435\u0437 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432,&nbsp;\u043d\u0435 \u043e\u0431\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0438 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0435\u043a\u0442, \u0438 \u0442\u0430\u043a \u0443\u0436 \u0441\u043b\u043e\u0436\u0438\u043b\u043e\u0441\u044c \u0447\u0442\u043e Python \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0448\u0438\u0440\u043e\u043a\u0438\u043c \u0441\u043f\u0435\u043a\u0442\u0440\u043e\u043c  \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432 \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u0447 NLP. \u0417\u0430\u0434\u0430\u0447\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u044b\u0435: \u0430\u043d\u0430\u043b\u0438\u0437 \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438(sentiment) \u0442\u0435\u043a\u0441\u0442\u0430, \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435, \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439(NER) \u0442\u0430\u043a \u0438 \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043a\u0430\u043a \u0431\u043e\u0442\u044b, \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432 \u0432 \u0441\u0430\u043f\u043f\u043e\u0440\u0442-\u0447\u0430\u0442\u0430\u0445 &#8212; \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043b\u0438 \u0432\u0430\u0448\u0430 \u0442\u0435\u0445.\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0438\u043b\u0438 \u0441\u0435\u0439\u043b\u0437 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0430\u043c, \u0438\u043b\u0438 \u043f\u043e\u0441\u0442\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0442\u0435\u043a\u0441\u0442\u0430 \u043f\u043e\u0441\u043b\u0435 SpeechToText.<\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447 NLP \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432. \u0412\u043e\u0442 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0442\u0430\u043a\u043e\u0432\u044b\u0445:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/stanfordnlp.github.io\/CoreNLP\/\" rel=\"noopener noreferrer nofollow\">CoreNLP<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.nltk.org\/\" rel=\"noopener noreferrer nofollow\">NLTK<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/textblob.readthedocs.io\/en\/dev\/\" rel=\"noopener noreferrer nofollow\">TextBlob<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/spacy.io\/\" rel=\"noopener noreferrer nofollow\">Spacy<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/nlp.johnsnowlabs.com\/\" rel=\"noopener noreferrer nofollow\">Spark NLP<\/a><\/p>\n<\/li>\n<\/ul>\n<p>\u0420\u0435\u0447\u044c \u043a\u0430\u043a \u0432\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442\u0435 \u043f\u043e\u0439\u0434\u0435\u0442 \u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0435 \u0447\u0442\u043e \u0443\u043c\u0435\u044e\u0442 \u0432\u044b\u0448\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043a\u0430\u043a \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0435 <strong>pre<\/strong>&#8212;<strong>trained <\/strong>\u043c\u043e\u0434\u0435\u043b\u0438 \u0442\u0430\u043a \u0438 \u043f\u043b\u0430\u0442\u043d\u044b\u0435, \u0443\u0437\u043a\u043e\u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f <strong>healthcare<\/strong>.<\/p>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b  Spark NLP \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f Java 8 &#8212;  \u043e\u043d\u0430 \u043d\u0443\u0436\u043d\u0430 \u0434\u043b\u044f \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 Apache Spark \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 Spark NLP. \u0414\u043b\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0438\u043b\u0438 \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043c\u0438\u043d\u0438\u043c\u0443\u043c 16\u0413\u0431 \u041e\u0417\u0423. \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043b\u0443\u0447\u0448\u0435 \u043d\u0430 \u043a\u0430\u043a\u043e\u043c \u043d\u0438\u0431\u0443\u0434\u044c \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u0435 Linux (\u041d\u0430 macOS \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438), \u043b\u0438\u0447\u043d\u043e \u044f \u0432\u044b\u0431\u0440\u0430\u043b Ubuntu \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u043d\u0430 AWS.<\/p>\n<p><code>apt-get -qy install openjdk-8<\/code><\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c Python3 \u0438 \u0441\u043e\u043f\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438<\/p>\n<p><code>apt-get -qy install build-essential python3 python3-pip python3-dev gnupg2<\/code><\/p>\n<p><code>pip install nlu==1.1.3<\/code> <\/p>\n<p><code>pip install pyspark==2.4.7<\/code><\/p>\n<p><code>pip install spark-nlp==2.7.4<\/code><\/p>\n<p>\u042d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u043d\u0430 <a href=\"https:\/\/colab.research.google.com\/github\/JohnSnowLabs\/spark-nlp-workshop\/blob\/master\/tutorials\/streamlit_notebooks\/NER_EN.ipynb\" rel=\"noopener noreferrer nofollow\">colab<\/a>. \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 Spark NLP \u043f\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u043e\u0432 (pipeline), \u0432\u0430\u0448 \u0442\u0435\u043a\u0441\u0442 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0430\u0434\u0438\u0439 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u043e\u043f\u0438\u0441\u0430\u043b\u0438 \u0432 pipe-\u043b\u0430\u0439\u043d\u0435, \u0438 \u043a\u0430\u0436\u0434\u0430\u044f \u0441\u0442\u0430\u0434\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438, \u043a  \u043f\u0440\u0438\u043c\u0435\u0440\u0443: \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f <strong>\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439<\/strong>. \u041d\u0438\u0436\u0435 \u043d\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435 \u0441\u0445\u0435\u043c\u0430 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u0441\u0442\u0430\u0434\u0438\u0439 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442\u044c \u0432\u0430\u0448 \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0442\u0435\u043a\u0441\u0442, \u043a\u0430\u0436\u0434\u0430\u044f \u0441\u0442\u0430\u0434\u0438\u044f <strong><em>\u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 <\/em><\/strong>\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0432\u043e\u044e \u043a\u043e\u043b\u043e\u043d\u043a\u0443 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u043e\u0441\u043b\u0435 \u0435\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1a3\/770\/63e\/1a377063ebc1344b3052d91c490fa8c5.png\" alt=\"\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 \u0432 Spark NLP\" title=\"\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 \u0432 Spark NLP\" width=\"1199\" height=\"276\"><figcaption>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 \u0432 Spark NLP<\/figcaption><\/figure>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0434\u0438\u0439 \u0434\u043b\u044f \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430. (\u0432\u0435\u0441\u044c \u043a\u043e\u0434 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043f\u043e <a href=\"https:\/\/colab.research.google.com\/github\/JohnSnowLabs\/spark-nlp-workshop\/blob\/master\/tutorials\/streamlit_notebooks\/NER_EN.ipynb\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a> \u043d\u0430 colab)<\/p>\n<pre><code class=\"python\">documentAssembler = DocumentAssembler() \\     .setInputCol('text') \\     .setOutputCol('document')  tokenizer = Tokenizer() \\     .setInputCols(['document']) \\     .setOutputCol('token')  embeddings = BertEmbeddings.pretrained(name='bert_base_cased', lang='en') \\         .setInputCols(['document', 'token']) \\         .setOutputCol('embeddings')  ner_model = NerDLModel.pretrained('ner_dl_bert', 'en') \\     .setInputCols(['document', 'token', 'embeddings']) \\     .setOutputCol('ner')  ner_converter = NerConverter() \\     .setInputCols(['document', 'token', 'ner']) \\     .setOutputCol('ner_chunk')  nlp_pipeline = Pipeline(stages=[     documentAssembler,      tokenizer,     embeddings,     ner_model,     ner_converter ])<\/code><\/pre>\n<ol>\n<li>\n<p>documentAssembler &#8212; \u0441\u043e\u0437\u0434\u0430\u0435\u0442  \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e \u0442\u0438\u043f\u0430&nbsp;<em>Document,<\/em>&nbsp;\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0430\u043d\u043d\u043e\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c<\/p>\n<\/li>\n<li>\n<p>tokenizer &#8212; \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u0442 \u0442\u0435\u043a\u0441\u0442 \u0438 \u043f\u0443\u043d\u043a\u0442\u0443\u0430\u0446\u0438\u044e \u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u0442\u0440\u043e\u043a<\/p>\n<\/li>\n<li>\n<p>embeddings &#8212;&nbsp;\u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0441\u043b\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>ner_model &#8212; \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u0435\u043b\u044c \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439.   \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443: October 28, 1955  = DATE   <\/p>\n<\/li>\n<li>\n<p>ner_converter &#8212; \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043a\u043e\u043b\u043e\u043d\u043a\u0443 \u0441 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u043d\u044b\u043c\u0438 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044f\u043c\u0438  October 28, 1955<\/p>\n<\/li>\n<\/ol>\n<p>\u0418 \u0432\u0441\u0435 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e, \u043d\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043a\u0430\u043a-\u0442\u043e \u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043f\u0438\u0441\u0430\u0442\u044c &#8212; \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044f \u0441\u0442\u0430\u0434\u0438\u0438 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430 \u0438 \u0441\u0430\u043c \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d, \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u044f \u043f\u0440\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e Spark NLP, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 SparkNLP (<strong>johnsnowlabs<\/strong>) \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u0443\u044e <a href=\"https:\/\/github.com\/JohnSnowLabs\/nlu\" rel=\"noopener noreferrer nofollow\">\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443<\/a> \u0438\u043b\u0438 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u0430\u0445\u0430\u0440 \u043d\u0430\u0434 SparkNLP &#8212; \u043d\u0430\u0437\u044b\u0432\u0430\u0439\u0442\u0435 \u043a\u0430\u043a \u0445\u043e\u0442\u0438\u0442\u0435, \u043d\u043e \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u0432\u044b\u0448\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"python\">import nlu  pipeline = nlu.load('ner') result = pipeline.predict(   text, output_level='document' ).to_dict(orient='records')<\/code><\/pre>\n<p> \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0432\u0441\u0435 \u0442\u0435 \u0436\u0435 \u0441\u0430\u043c\u044b\u0435 NER, \u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0432 \u043d\u0430 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043c\u0435\u043d\u044c\u0448\u0435 \u043a\u043e\u0434\u0430. <\/p>\n<p>\u0425\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0435\u0449\u0435 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c  \u0447\u0442\u043e \u043e\u0431\u0430   \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439, \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e Apache Spark, \u043f\u0440\u0435\u0434\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0441\u0432\u044f\u0437\u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430 Python c  Spark \u0447\u0435\u0440\u0435\u0437 pyspark. \u041f\u043e\u0442\u043e\u043c\u0443 \u0432\u0430\u043c \u043d\u0435 \u043e\u0441\u043e\u0431\u043e \u0437\u0430\u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u043e 10-100 \u0440\u0430\u0437 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u0441 \u043a\u043e\u0434\u043e\u043c \u0432\u044b\u0448\u0435, \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u0440\u0435\u0434\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0430 predict, \u0432 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043d\u0443\u0436\u043d\u044b\u0445 \u043c\u043d\u0435 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u043e\u0432  \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0421elery \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432.<\/p>\n<pre><code class=\"python\"># \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u0420\u0435\u0435\u0441\u0442\u0440 pipeline_registry = PipelineRegistry()  def get_pipeline_registry():     pipeline_registry.register('sentiment', nlu.load('en.sentiment'))     pipeline_registry.register('ner', nlu.load('ner'))     pipeline_registry.register('stopwords', nlu.load('stopwords'))     pipeline_registry.register('stemmer', nlu.load('stemm'))     pipeline_registry.register('emotion', nlu.load('emotion'))     return pipeline_registry  @worker_process_init.connect def init_worker(**kwargs):     logging.info(\"Initializing pipeline_factory...\")     get_pipeline_registry()<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c NLP \u0437\u0430\u0434\u0430\u0447\u0438 \u0431\u0435\u0437 \u0431\u043e\u043b\u0438 \u0432 \u043c\u043e\u0437\u0433\u0443 \u0438 \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u043e\u043c \u0443\u0441\u0438\u043b\u0438\u0439.<\/p>\n<\/div>\n<p> \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\/post\/551518\/\"> https:\/\/habr.com\/ru\/post\/551518\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u0412 \u043d\u0430\u0448\u0435 \u0432\u0440\u0435\u043c\u044f \u0431\u0435\u0437 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u0432,&nbsp;\u043d\u0435 \u043e\u0431\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0438 \u043e\u0434\u0438\u043d \u043f\u0440\u043e\u0435\u043a\u0442, \u0438 \u0442\u0430\u043a \u0443\u0436 \u0441\u043b\u043e\u0436\u0438\u043b\u043e\u0441\u044c \u0447\u0442\u043e Python \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0448\u0438\u0440\u043e\u043a\u0438\u043c \u0441\u043f\u0435\u043a\u0442\u0440\u043e\u043c  \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432 \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u0447 NLP. \u0417\u0430\u0434\u0430\u0447\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u044b\u0435: \u0430\u043d\u0430\u043b\u0438\u0437 \u0442\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438(sentiment) \u0442\u0435\u043a\u0441\u0442\u0430, \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435, \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439(NER) \u0442\u0430\u043a \u0438 \u0431\u043e\u043b\u0435\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043a\u0430\u043a \u0431\u043e\u0442\u044b, \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432 \u0432 \u0441\u0430\u043f\u043f\u043e\u0440\u0442-\u0447\u0430\u0442\u0430\u0445 &#8212; \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043b\u0438 \u0432\u0430\u0448\u0430 \u0442\u0435\u0445.\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0438\u043b\u0438 \u0441\u0435\u0439\u043b\u0437 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0430\u043c, \u0438\u043b\u0438 \u043f\u043e\u0441\u0442\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0442\u0435\u043a\u0441\u0442\u0430 \u043f\u043e\u0441\u043b\u0435 SpeechToText.<\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447 NLP \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432. \u0412\u043e\u0442 \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0442\u0430\u043a\u043e\u0432\u044b\u0445:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/stanfordnlp.github.io\/CoreNLP\/\" rel=\"noopener noreferrer nofollow\">CoreNLP<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.nltk.org\/\" rel=\"noopener noreferrer nofollow\">NLTK<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/textblob.readthedocs.io\/en\/dev\/\" rel=\"noopener noreferrer nofollow\">TextBlob<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/spacy.io\/\" rel=\"noopener noreferrer nofollow\">Spacy<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/nlp.johnsnowlabs.com\/\" rel=\"noopener noreferrer nofollow\">Spark NLP<\/a><\/p>\n<\/li>\n<\/ul>\n<p>\u0420\u0435\u0447\u044c \u043a\u0430\u043a \u0432\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442\u0435 \u043f\u043e\u0439\u0434\u0435\u0442 \u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0435 \u0447\u0442\u043e \u0443\u043c\u0435\u044e\u0442 \u0432\u044b\u0448\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u043a\u0430\u043a \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0435 <strong>pre<\/strong>&#8212;<strong>trained <\/strong>\u043c\u043e\u0434\u0435\u043b\u0438 \u0442\u0430\u043a \u0438 \u043f\u043b\u0430\u0442\u043d\u044b\u0435, \u0443\u0437\u043a\u043e\u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f <strong>healthcare<\/strong>.<\/p>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b  Spark NLP \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f Java 8 &#8212;  \u043e\u043d\u0430 \u043d\u0443\u0436\u043d\u0430 \u0434\u043b\u044f \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 Apache Spark \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 Spark NLP. \u0414\u043b\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0438\u043b\u0438 \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043c\u0438\u043d\u0438\u043c\u0443\u043c 16\u0413\u0431 \u041e\u0417\u0423. \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043b\u0443\u0447\u0448\u0435 \u043d\u0430 \u043a\u0430\u043a\u043e\u043c \u043d\u0438\u0431\u0443\u0434\u044c \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u0435 Linux (\u041d\u0430 macOS \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438), \u043b\u0438\u0447\u043d\u043e \u044f \u0432\u044b\u0431\u0440\u0430\u043b Ubuntu \u0438\u043d\u0441\u0442\u0430\u043d\u0441 \u043d\u0430 AWS.<\/p>\n<p><code>apt-get -qy install openjdk-8<\/code><\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c Python3 \u0438 \u0441\u043e\u043f\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438<\/p>\n<p><code>apt-get -qy install build-essential python3 python3-pip python3-dev gnupg2<\/code><\/p>\n<p><code>pip install nlu==1.1.3<\/code> <\/p>\n<p><code>pip install pyspark==2.4.7<\/code><\/p>\n<p><code>pip install spark-nlp==2.7.4<\/code><\/p>\n<p>\u042d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u043d\u0430 <a href=\"https:\/\/colab.research.google.com\/github\/JohnSnowLabs\/spark-nlp-workshop\/blob\/master\/tutorials\/streamlit_notebooks\/NER_EN.ipynb\" rel=\"noopener noreferrer nofollow\">colab<\/a>. \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 Spark NLP \u043f\u043e \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0443 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u043e\u0432 (pipeline), \u0432\u0430\u0448 \u0442\u0435\u043a\u0441\u0442 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0430\u0434\u0438\u0439 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u043e\u043f\u0438\u0441\u0430\u043b\u0438 \u0432 pipe-\u043b\u0430\u0439\u043d\u0435, \u0438 \u043a\u0430\u0436\u0434\u0430\u044f \u0441\u0442\u0430\u0434\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438, \u043a  \u043f\u0440\u0438\u043c\u0435\u0440\u0443: \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f <strong>\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439<\/strong>. \u041d\u0438\u0436\u0435 \u043d\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435 \u0441\u0445\u0435\u043c\u0430 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u0441\u0442\u0430\u0434\u0438\u0439 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442\u044c \u0432\u0430\u0448 \u0432\u0445\u043e\u0434\u043d\u043e\u0439 \u0442\u0435\u043a\u0441\u0442, \u043a\u0430\u0436\u0434\u0430\u044f \u0441\u0442\u0430\u0434\u0438\u044f <strong><em>\u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 <\/em><\/strong>\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0432\u043e\u044e \u043a\u043e\u043b\u043e\u043d\u043a\u0443 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u043e\u0441\u043b\u0435 \u0435\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<figure class=\"full-width\"><figcaption>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 \u0432 Spark NLP<\/figcaption><\/figure>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0434\u0438\u0439 \u0434\u043b\u044f \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430. (\u0432\u0435\u0441\u044c \u043a\u043e\u0434 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043f\u043e <a href=\"https:\/\/colab.research.google.com\/github\/JohnSnowLabs\/spark-nlp-workshop\/blob\/master\/tutorials\/streamlit_notebooks\/NER_EN.ipynb\" rel=\"noopener noreferrer nofollow\">\u0441\u0441\u044b\u043b\u043a\u0435<\/a> \u043d\u0430 colab)<\/p>\n<pre><code class=\"python\">documentAssembler = DocumentAssembler() \\     .setInputCol('text') \\     .setOutputCol('document')  tokenizer = Tokenizer() \\     .setInputCols(['document']) \\     .setOutputCol('token')  embeddings = BertEmbeddings.pretrained(name='bert_base_cased', lang='en') \\         .setInputCols(['document', 'token']) \\         .setOutputCol('embeddings')  ner_model = NerDLModel.pretrained('ner_dl_bert', 'en') \\     .setInputCols(['document', 'token', 'embeddings']) \\     .setOutputCol('ner')  ner_converter = NerConverter() \\     .setInputCols(['document', 'token', 'ner']) \\     .setOutputCol('ner_chunk')  nlp_pipeline = Pipeline(stages=[     documentAssembler,      tokenizer,     embeddings,     ner_model,     ner_converter ])<\/code><\/pre>\n<ol>\n<li>\n<p>documentAssembler &#8212; \u0441\u043e\u0437\u0434\u0430\u0435\u0442  \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044e \u0442\u0438\u043f\u0430&nbsp;<em>Document,<\/em>&nbsp;\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0430\u043d\u043d\u043e\u0442\u0430\u0442\u043e\u0440\u0430\u043c\u0438 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c<\/p>\n<\/li>\n<li>\n<p>tokenizer &#8212; \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u0442 \u0442\u0435\u043a\u0441\u0442 \u0438 \u043f\u0443\u043d\u043a\u0442\u0443\u0430\u0446\u0438\u044e \u043d\u0430 \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u0442\u0440\u043e\u043a<\/p>\n<\/li>\n<li>\n<p>embeddings &#8212;&nbsp;\u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0432\u0435\u043a\u0442\u043e\u0440\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0441\u043b\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>ner_model &#8212; \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u0435\u043b\u044c \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439.   \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443: October 28, 1955  = DATE   <\/p>\n<\/li>\n<li>\n<p>ner_converter &#8212; \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043a\u043e\u043b\u043e\u043d\u043a\u0443 \u0441 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u043d\u044b\u043c\u0438 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044f\u043c\u0438  October 28, 1955<\/p>\n<\/li>\n<\/ol>\n<p>\u0418 \u0432\u0441\u0435 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e, \u043d\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043a\u0430\u043a-\u0442\u043e \u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043f\u0438\u0441\u0430\u0442\u044c &#8212; \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044f \u0441\u0442\u0430\u0434\u0438\u0438 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430 \u0438 \u0441\u0430\u043c \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d, \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u044f \u043f\u0440\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e Spark NLP, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 SparkNLP (<strong>johnsnowlabs<\/strong>) \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u0443\u044e <a href=\"https:\/\/github.com\/JohnSnowLabs\/nlu\" rel=\"noopener noreferrer nofollow\">\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443<\/a> \u0438\u043b\u0438 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u0430\u0445\u0430\u0440 \u043d\u0430\u0434 SparkNLP &#8212; \u043d\u0430\u0437\u044b\u0432\u0430\u0439\u0442\u0435 \u043a\u0430\u043a \u0445\u043e\u0442\u0438\u0442\u0435, \u043d\u043e \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u0432\u044b\u0448\u0435\u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"python\">import nlu  pipeline = nlu.load('ner') result = pipeline.predict(   text, output_level='document' ).to_dict(orient='records')<\/code><\/pre>\n<p> \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0432\u0441\u0435 \u0442\u0435 \u0436\u0435 \u0441\u0430\u043c\u044b\u0435 NER, \u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0432 \u043d\u0430 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043c\u0435\u043d\u044c\u0448\u0435 \u043a\u043e\u0434\u0430. <\/p>\n<p>\u0425\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0435\u0449\u0435 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c  \u0447\u0442\u043e \u043e\u0431\u0430   \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439, \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e Apache Spark, \u043f\u0440\u0435\u0434\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u0441\u0432\u044f\u0437\u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u0430 Python c  Spark \u0447\u0435\u0440\u0435\u0437 pyspark. \u041f\u043e\u0442\u043e\u043c\u0443 \u0432\u0430\u043c \u043d\u0435 \u043e\u0441\u043e\u0431\u043e \u0437\u0430\u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u043e 10-100 \u0440\u0430\u0437 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u0441 \u043a\u043e\u0434\u043e\u043c \u0432\u044b\u0448\u0435, \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u0440\u0435\u0434\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0430 predict, \u0432 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044f \u0441\u0434\u0435\u043b\u0430\u043b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043d\u0443\u0436\u043d\u044b\u0445 \u043c\u043d\u0435 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u043e\u0432  \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0421elery \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432.<\/p>\n<pre><code class=\"python\"># \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u0420\u0435\u0435\u0441\u0442\u0440 pipeline_registry = PipelineRegistry()  def get_pipeline_registry():     pipeline_registry.register('sentiment', nlu.load('en.sentiment'))     pipeline_registry.register('ner', nlu.load('ner'))     pipeline_registry.register('stopwords', nlu.load('stopwords'))     pipeline_registry.register('stemmer', nlu.load('stemm'))     pipeline_registry.register('emotion', nlu.load('emotion'))     return pipeline_registry  @worker_process_init.connect def init_worker(**kwargs):     logging.info(\"Initializing pipeline_factory...\")     get_pipeline_registry()<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c NLP \u0437\u0430\u0434\u0430\u0447\u0438 \u0431\u0435\u0437 \u0431\u043e\u043b\u0438 \u0432 \u043c\u043e\u0437\u0433\u0443 \u0438 \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u043e\u043c \u0443\u0441\u0438\u043b\u0438\u0439.<\/p>\n<\/div>\n<p> \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\/post\/551518\/\"> https:\/\/habr.com\/ru\/post\/551518\/<\/a><br \/><\/br><\/br><\/p>\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-321145","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/321145","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=321145"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/321145\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=321145"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=321145"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=321145"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}