ニューラルネットワークの進歩により、コンピュータービジョン、音声認識、自然言語処理(NLP)などの分野の開発につながりました。 NLPで最も影響力のある最近の開発の1つは、単語の埋め込みの使用です。ここでは、単語は連続空間のベクトルとして表され、それらの間の多くの構文と意味関係を捉えています。
Aravecは、アラビア語のNLP研究コミュニティに無料の使用と強力な単語埋め込みモデルを提供することを目的とした、事前に訓練された分散ワード表現(Word Embedding)オープンソースプロジェクトです。 Aravecの最初のバージョンは、3つの異なるアラビア語コンテンツドメインの上に構築された6つの異なる単語埋め込みモデルを提供します。ツイートとウィキペディアこのホワイトペーパーでは、モデルの構築に使用されるリソース、採用されたデータクリーニング手法、実行された前処理ステップ、および採用された単語が作成された作成技術の詳細について説明しています。
Aravecの3番目のバージョンは、2つの異なるアラビア語コンテンツドメインの上に構築された16の異なる単語埋め込みモデルを提供します。ツイートとウィキペディアアラビア語の記事。このバージョンと以前のバージョンの主な違いは、2つの異なるタイプのモデル、UnigramsおよびN-Gramsモデルを作成したことです。一連の統計的手法を利用して、各データドメインの最も一般的な使用されているnグラムを生成しました。
1,169,075,128トークン以上の総トークン。
NGRAMSモデルの表現方法をご覧ください。
その他のクエリについては、結果ページをご覧ください。
Abu Bakr Soliman, Kareem Eisa, and Samhaa R. El-Beltagy, “AraVec: A set of Arabic Word Embedding Models for use in Arabic NLP”, in proceedings of the 3rd International Conference on Arabic Computational Linguistics (ACLing 2017), Dubai, UAE, 2017.
これらのモデルは、Gensim Pythonライブラリを使用して構築されました。これらの手順に従って、モデルの1つを読み込み、使用するための簡単なコードを次に示します。
gensim > = 3.4およびnltk > = 3.2をpipまたはcondaを使用してインストールするPIPインストールGensim NLTK
CondaはGensim NLTKをインストールします
Twittert-CBOWなど]ノートブックコード
# -*- coding: utf8 -*-
import gensim
import re
import numpy as np
from nltk import ngrams
from utilities import * # import utilities.py module
# ============================
# ====== N-Grams Models ======
t_model = gensim . models . Word2Vec . load ( 'models/full_grams_cbow_100_twitter.mdl' )
# python 3.X
token = clean_str ( u'ابو تريكه' ). replace ( " " , "_" )
# python 2.7
# token = clean_str(u'ابو تريكه'.decode('utf8', errors='ignore')).replace(" ", "_")
if token in t_model . wv :
most_similar = t_model . wv . most_similar ( token , topn = 10 )
for term , score in most_similar :
term = clean_str ( term ). replace ( " " , "_" )
if term != token :
print ( term , score )
# تريكه 0.752911388874054
# حسام_غالي 0.7516342401504517
# وائل_جمعه 0.7244222164154053
# وليد_سليمان 0.7177559733390808
# ...
# =========================================
# == Get the most similar tokens to a compound query
# most similar to
# عمرو دياب + الخليج - مصر
pos_tokens = [ clean_str ( t . strip ()). replace ( " " , "_" ) for t in [ 'عمرو دياب' , 'الخليج' ] if t . strip () != "" ]
neg_tokens = [ clean_str ( t . strip ()). replace ( " " , "_" ) for t in [ 'مصر' ] if t . strip () != "" ]
vec = calc_vec ( pos_tokens = pos_tokens , neg_tokens = neg_tokens , n_model = t_model , dim = t_model . vector_size )
most_sims = t_model . wv . similar_by_vector ( vec , topn = 10 )
for term , score in most_sims :
if term not in pos_tokens + neg_tokens :
print ( term , score )
# راشد_الماجد 0.7094649076461792
# ماجد_المهندس 0.6979793906211853
# عبدالله_رويشد 0.6942606568336487
# ...
# ====================
# ====================
# ==============================
# ====== Uni-Grams Models ======
t_model = gensim . models . Word2Vec . load ( 'models/full_uni_cbow_100_twitter.mdl' )
# python 3.X
token = clean_str ( u'تونس' )
# python 2.7
# token = clean_str('تونس'.decode('utf8', errors='ignore'))
most_similar = t_model . wv . most_similar ( token , topn = 10 )
for term , score in most_similar :
print ( term , score )
# ليبيا 0.8864325284957886
# الجزائر 0.8783721327781677
# السودان 0.8573237061500549
# مصر 0.8277812600135803
# ...
# get a word vector
word_vector = t_model . wv [ token ]いくつかの最も類似したクエリを使用して、n-gramsモデルから削除できるものをご覧ください。結果ページをご覧ください
| モデル | ドキュメント番号 | 語彙番号 | vec-size | ダウンロード |
|---|---|---|---|---|
| Twitter-Cbow | 66,900,000 | 1,476,715 | 300 | ダウンロード |
| Twitter-Cbow | 66,900,000 | 1,476,715 | 100 | ダウンロード |
| Twitter-Skipgram | 66,900,000 | 1,476,715 | 300 | ダウンロード |
| Twitter-Skipgram | 66,900,000 | 1,476,715 | 100 | ダウンロード |
| Wikipedia-Cbow | 1,800,000 | 662,109 | 300 | ダウンロード |
| Wikipedia-Cbow | 1,800,000 | 662,109 | 100 | ダウンロード |
| Wikipedia-Skipgram | 1,800,000 | 662,109 | 300 | ダウンロード |
| Wikipedia-Skipgram | 1,800,000 | 662,109 | 100 | ダウンロード |
| モデル | ドキュメント番号 | 語彙番号 | vec-size | ダウンロード |
|---|---|---|---|---|
| Twitter-Cbow | 66,900,000 | 1,259,756 | 300 | ダウンロード |
| Twitter-Cbow | 66,900,000 | 1,259,756 | 100 | ダウンロード |
| Twitter-Skipgram | 66,900,000 | 1,259,756 | 300 | ダウンロード |
| Twitter-Skipgram | 66,900,000 | 1,259,756 | 100 | ダウンロード |
| Wikipedia-Cbow | 1,800,000 | 320,636 | 300 | ダウンロード |
| Wikipedia-Cbow | 1,800,000 | 320,636 | 100 | ダウンロード |
| Wikipedia-Skipgram | 1,800,000 | 320,636 | 300 | ダウンロード |
| Wikipedia-Skipgram | 1,800,000 | 320,636 | 100 | ダウンロード |
Abu Bakr Soliman, Kareem Eisa, and Samhaa R. El-Beltagy, “AraVec: A set of Arabic Word Embedding Models for use in Arabic NLP”, in proceedings of the 3rd International Conference on Arabic Computational Linguistics (ACLing 2017), Dubai, UAE, 2017.