SpaCyは、数年前からエンティティ抽出プロジェクトを立ち上げようとするすべての企業にとってデファクトスタンダードとなっています。何がspaCyをこれほどまでに普及させたのでしょうか?また、2023年にエンティティ抽出プロジェクトを始めようとする人にとって、spaCyの良い代替品はあるのでしょうか?この記事では、これらの点について議論してみましょう。 SpaCy エンティティ抽出用 2015年にspaCyの最初のバージョンがリリースされ、瞬く間にエンタープライズグレードのエンティティ抽出(NERとも呼ばれる)の標準フレームワークとなった。 構造化されていないテキスト(例えばウェブからのもの)があり、そこから日付、名前、場所などの構造化されたデータを抽出したい場合、spaCyは非常に良いソリューションです。 SpaCyが面白いのは、約20の言語に対応した学習済みモデルがいくつか用意されている
こんにちは AIチームの戸田です 今回は日本語NLPライブラリであるGiNZAのv5から実装されたTransformerモデルによる固有表現抽出を試します。 固有表現抽出とは、入力となる自然文から地名や製品名などの固有名詞を抽出するタスクです。今回固有表現抽出に使用するデータセットとして、ストックマーク株式会社が作成したWikipediaを用いた日本語の固有表現抽出データセットを使用します。また、Transformerモデルは処理に時間がかかるので、環境はGoogle ColaboratoryのGPU環境を利用しました。 事前準備 wgetを使ってデータセットをダウンロードします。 wget https://raw.githubusercontent.com/stockmarkteam/ner-wikipedia-dataset/main/ner.json 必要なpythonライブラリをダ
自然言語処理ライブラリ(NLPライブラリ)であるGiNZAが、今日最新版をリリースしました。 今回はGiNZA v5とspaCyを用いて、試しに文章の類似度を計算してみたいと思います。 GiNZAとは GiNZAは日本語の自然言語処理ライブラリで、大きな特徴として「Universal Dependencies(UD)」という世界標準の言語表現を採用していることです。 UDを採用することで、 あらゆる自然言語に共通した処理を適用可能 他のライブラリとの連携が楽 といったメリットがあります。 今回のGiNZA v5の主な特徴は、以下の3点です。 spaCy v3に対応 transformerを採用したモデル(ja_ginza_electra)をリリース UD品詞解析精度が向上 1つ目のspaCyは、あらゆる自然言語に対応するUDを利用したNLPライブラリです。 spaCyは日本語のサポートが弱
R&Dチーム所属の伊藤です。GiNZAについて検索しようとして(地名の)銀座についての結果が出てくると悲しくなります。 今回はチャットボットの作成についてです。前から気になっていたRasaを試してみたので備忘録がてらまとめてみました。 はじめに 準備 ドメインの設定 intents entities slots responses forms actions モデルの設定 language pipeline policies モデルの訓練データ nlu rules stories エンドポイント設定 モデル訓練 チャットボット実行 おわりに はじめに RasaはRasa Technologies GmbHより提供されるオープンソースの対話システム作成フレームワークです。 Pythonで書かれており、自然言語理解のモデル訓練・推論環境や対話管理ツール、データベースやAPIに接続するためのエン
OpenTapioca is a simple and fast Named Entity Linking system for Wikidata. It is kept synchronous with Wikidata in real time, encouraging users to improve the results of their entity linking tasks by contributing back to Wikidata. A live instance is running at https://opentapioca.org/. To run it on a server that is powerful enough, I would need 50€/month: please help fund the service if you can. A
1. GiNZA のインストール(1) 「Google Colab」で以下のコマンドを実行。 !pip install -U ginza(2) メニュー「ランタイム → ランタイムを再起動」で「Google Colab」を再起動。 2. 固有表現抽出の実行「固有抽出表現」は、文章から人名や場所名などの「固有表現」(名前付きエンティティ)を抽出する処理です。 import spacy # GiNZAの準備 nlp = spacy.load('ja_ginza') # 固有表現抽出の実行 doc = nlp('夏目金之助(後の漱石)は、1867年2月9日に江戸の牛込馬場下にて、名主の夏目小兵衛直克・千枝夫妻の末子として出生した。') for ent in doc.ents: print( ent.text+','+ # テキスト ent.label_+','+ # ラベル str(ent.s
自然言語処理技術のなかでも固有表現抽出(Named Entity Recognition; NER)は情報抽出の処理をやろうとするときにとても役立つ。 応用は幅広く、会社名や個人名などの情報抽出処理、個人情報除去などのような抽出した情報に対する処理、代名詞の解析(照応解析・共参照解析)のような文脈解析処理などに用いられる。 最も簡単なNERの方法としては、辞書や形態素解析結果や正規表現などに基づくルールを用いて、単語列にラベリングする方法があるが、会社名など判断が難しいケースについては機械学習によってNERを行うことが有効なことが多い。機械学習ベースの既存の固有表現抽出器を使ってみたい場合には、GiNZAやKNPのようなNERモデルが同梱されているツールを使用してみるのがよい。 しかし公開モデルの性能では満足いかない場合に自分でモデルを構築しようとしても、公開データセットが見つけにくかった
概要 固有表現抽出を行いたかったので、spacyでnerのtrainを行ってみる。 例として既存のginzaのモデルでは「10,000円」はMONEYとして抽出されるけど「\10,000」は認識されない問題を解決するモデルを作成。 バージョン情報 ginza==2.2.0 Python 3.7.4 参考ページ ner(Named Entity Recognition)の学習については下記ページを参考にした。 https://medium.com/@manivannan_data/how-to-train-ner-with-custom-training-data-using-spacy-188e0e508c6 ginzaではtrain_ner.pyというスクリプトが用意されている。 https://github.com/megagonlabs/ginza/blob/develop/ginz
自然言語処理をするときはよくRasa NLUを使っているのですが、内部的にはspaCyが使われている模様です。どちらもパイプラインでモジュールをつなげていって自然言語処理をシンプルにするフレームワークだと理解しているのですが、spaCy単独で使うとどういう感じなのか把握したかったんで試してみます。 こちらのエントリを参考にspaCyの基本的な動きを確認。 https://qiita.com/moriyamanaoto/items/e98b8a6ff1c8fcf8e293 $ mkdir spacy-ner $ cd spacy-ner 必要なライブラリをインストール。GiNZAはspaCyフレームワークのっかった形で提供されている日本語の学習済みモデルを含むライブラリです。簡単にいえばspaCyを日本語で動かせるようにするものです。 $ pip install spacy $ pip in
「BERT/GPT-3/DALL-E 自然言語処理・画像処理・音声処理 人口知能プログラミング実践入門」を読んで、リクルートのAI研究機関「Megagon Labs」提供の「GINZA」という日本語の自然言語処理ライブラリがあることを知りました。 ※書籍へのリンクも記載していますが、このnoteは書籍の内容に従わずにあくまでも勝手に最新バージョンで試したことに対する内容です 興味を惹かれBERTくらいしか自然言語処理ライブラリの名前を知らなかったため興味を惹かれたのですが、書籍内のGINZAのバージョンは4.0.5であり少し古いバージョンでした。2021/08/26にv5がリリースされているようで、2021/10/01時点では最新は5.0.2 (2021/09/06)となっていました。 試そうとするもせっかく試すならば最新で試したいと思ったところ、v4からv5になった際にbraking c
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く