【Elasticsearch】NLP簡単アプリ

NLP入門

NLP は Natural Language Processing の略で、コンピューター サイエンスと人工知能の分野の一分野です。コンピューターを使用して、英語、中国語、スペイン語などの自然言語を処理、分析、生成する必要があります。

NLP の目標は、コンピュータが人間の言語の意味と意図を理解できるようにして、人間と効果的に対話できるようにすることです。この対話は、音声認識や音声合成などの口頭で行うことも、テキスト分類、テキストの要約、感情分析などの書面で行うこともできます。

簡単に言えば、NLP は、ソフトウェアを使用して、話し言葉、書き言葉、または自然言語を操作および理解する方法です。

ES における自然言語処理 (NLP)

NLP モデルを Elastic プラットフォームに統合する際に、モデルをアップロードおよび管理するための優れたユーザー エクスペリエンスを提供します。

NLP デモ

ESに対応したopennlpプラグインをダウンロード

ダウンロードアドレス:https ://github.com/spinscale/elasticsearch-ingest-opennlp

opennlp プラグインを ESplugins パスに配置します

NER モデルをダウンロードする

NER: 構造化されていないテキストから構造を構築し、名前、場所、組織などの詳細を抽出しようとします。

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 を再起動して確認する

  • NLP をサポートするパイプラインを作成する

    PUT _ingest/pipeline/opennlp-pipeline
    {
        "description": "A pipeline to do named entity extraction",
        "processors": [
            {
                "opennlp": {
                    "field": "message"
                }
            }
        ]
    }
    
  • データの追加

    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."
    }
    
  • データを見る

    GET my-nlp-index/_doc/1
    GET my-nlp-index/_doc/2
    

おすすめ

転載: blog.csdn.net/al6nlee/article/details/130469023