0
是否可以使用不基於英語字母表的語言(如烏爾都語,泰米爾語等)來實現Word2Vec模型?如果有的話可以有人建議我一個途徑。Word2Vec在非英語語言中的實現?
是否可以使用不基於英語字母表的語言(如烏爾都語,泰米爾語等)來實現Word2Vec模型?如果有的話可以有人建議我一個途徑。Word2Vec在非英語語言中的實現?
是的,我認爲它應該是可能的,只要你有一個用於你的語言的分詞器(即分詞器),並且如果你有小的數據並且想用一些基本形式表示來代替被壓縮的詞形式的話,可能還有一個lemmatizer或者詞幹分析器。
下面是用Python訓練模型gensim一個基本的例子:
from gensim import models
training_corpus = "corpus.txt"
with open(training_corpus,'r') as f:
plain_text = f.read()
sentences = plain_text.split("\n") # Assume one sentence per line
tokenized = []
for sentence in sentences:
# White-space-based word splitting, replace with a better tokenizer
tokens = sentence.strip().lower().split(" ")
tokenized.append(tokens)
# Train your model, see gensim documentation for parameters
model = models.Word2Vec(tokenized, min_count=3, size=50)
試試看。 – Djokester
只是預處理的數據,並將其轉換成numberized格式,創建字典(字,ID)。然後將編號文件傳遞給word2vec。你將會開始。只需在查詢時間內輸入,使用字典並將其轉換爲數字版本,然後將其傳遞給訓練有素的模型! – user3639557