網(wǎng)站建設(shè)刂搜金手指下拉貳肆免費訪問國外網(wǎng)站的app
文章目錄
- NLP簡介
- ES中的自然語言處理(NLP)
- NLP演示
- 將opennlp插件放在ESplugins路徑中
- 下載NER模型
- 配置opennlp
- 重啟ES、驗證
NLP簡介
NLP代表自然語言處理,是計算機科學(xué)和人工智能領(lǐng)域的一個分支。它涉及使用計算機來處理、分析和生成自然語言,例如英語、中文、西班牙語等等。
NLP的目標是使計算機能夠理解人類語言的含義和意圖,從而使其能夠與人類進行有效的交互。這種交互可以是口頭的,例如語音識別和語音合成,也可以是書面的,例如文本分類、文本摘要和情感分析。
簡單點理解NLP就是我們可以使用軟件來操作和理解口語或書面文本或自然語言的方式。
ES中的自然語言處理(NLP)
將 NLP 模型集成到 Elastic 平臺時,為上傳和管理模型提供出色的用戶體驗

NLP演示
下載ES對應(yīng)的opennlp插件
下載地址:https://github.com/spinscale/elasticsearch-ingest-opennlp
將opennlp插件放在ESplugins路徑中

下載NER模型
NER:從非結(jié)構(gòu)化文本構(gòu)建結(jié)構(gòu),嘗試提取名稱、位置或組織等細節(jié)
bin/ingest-opennlp/download-models

配置opennlp
修改配置文件:config/elasticsearch.yml
ingest.opennlp.model.file.persons: en-ner-persons.bin
ingest.opennlp.model.file.dates: en-ner-dates.bin
ingest.opennlp.model.file.locations: en-ner-locations.bin
重啟ES、驗證
-
創(chuàng)建一個支持NLP的pipeline
PUT _ingest/pipeline/opennlp-pipeline {"description": "A pipeline to do named entity extraction","processors": [{"opennlp": {"field": "message"}}] }
-
添加數(shù)據(jù)
PUT my-nlp-index PUT my-nlp-index/_doc/1?pipeline=opennlp-pipeline {"message": "Shay Banon announced the release of Elasticsearch 6.0 in November 2017" }PUT my-nlp-index/_doc/2?pipeline=opennlp-pipeline {"message" : "Kobe Bryant was one of the best basketball players of all times. Not even Michael Jordan has ever scored 81 points in one game. Munich is really an awesome city, but New York is as well. Yesterday has been the hottest day of the year." }
-
查看數(shù)據(jù)
GET my-nlp-index/_doc/1 GET my-nlp-index/_doc/2