2016-09-07 8 views
0

私は、その後に各postsをトークン化しようとWord2Vecを使用して出力がないのはなぜですか?

index posts 
0  <div class="content">A number of <br/><br/>three ... </div> 
1  <div class="content">Stack ... <br/><br/>overflow ... </div> 
... 

のように見えるデータフレームDF持っている:私は、以下を使用してWord2Vecを実行

sentences=[] 
for post in DF["posts"]: 
    sentences += utility.tosentences(post, tokenizer) 

を:

logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s',\ 
level=logging.INFO) 

num_features = 100 
min_word_count = 7 
num_workers = 2 
context = 5 
downsampling = 1e-5 

print "Training model..." 
model = word2vec.Word2Vec(sentences,  workers=num_workers, \ 
     size=num_features, min_count = min_word_count, \ 
     window = context, sample = downsampling) 

model.init_sims(replace=True) 

Word2Vec.load() 
model_name = "what" 
model.save(model_name) 
print "finished" 

私はその後、以下をテストしました

model.doesnt_match("travel no Warning health".split()) 

しかし、出力はまったく出力されませんでした。

私は上記の大きな出力の意味を理解していません。なぜこれは機能しないのですか?

答えて

0

機能model.doesnt_match()は何も出力しません。値を返します。 を出力して、出力を確認します。

word2vec tutorialからコピー貼り付けしていた場合:これらのコマンドを対話型コンソールで実行した場合の出力が表示されます。 (また、何をしているのかを理解していることを前提としています)

関連する問題