0
私は、このマニュアルに従ってみました:私は次のコードスニペットを持って nbviewer.jupyter.org/github/skipgram/modern-nlp-in-python/blob/master/executable/Modern_NLP_in_Python.ipynb :word2veベクトルをデータとして、行ラベルとして用語を使用してDataFrameを作成する方法は?
ordered_vocab = [(term, voc.index, voc.count)
for term, voc in food2vec.vocab.iteritems()]
ordered_vocab = sorted(ordered_vocab, key=lambda (term, index, count): -count)
ordered_terms, term_indices, term_counts = zip(*ordered_vocab)
word_vectors = pd.DataFrame(food2vec.syn0norm[term_indices, :],
index=ordered_terms
はそれを実行するために取得するには、私は次のように変更があります。
ordered_vocab = [(term, voc.index, voc.count)
for term, voc in word2vecda.wv.vocab.items()]
ordered_vocab = sorted(ordered_vocab)
ordered_terms, term_indices, term_counts = zip(*ordered_vocab)
word_vectorsda = pd.DataFrame(word2vecda.wv.syn0norm[term_indices,],index=ordered_terms)
word_vectorsda [:20]
をしかし、私はデータフレームを印刷する前に、最後の行は私に私の周り私の頭を取得することはできませんエラーを与えます。これは、noneTypeオブジェクトがこの行に含まれないことを返します。私には、Term_indicesがそれを追跡しているように見えますが、なぜそれは得られませんか?
TypeError: 'NoneType' object is not subscriptable
何か助けてもらえますか?任意の入力大歓迎 ベストニールス
ありがとう –