2
>>> t = Tokenizer(num_words=3)
>>> l = ["Hello, World! This is so&#$ fantastic!", "There is no other world like this one"]
>>> t.fit_on_texts(l)
>>> t.word_index
{'fantastic': 6, 'like': 10, 'no': 8, 'this': 2, 'is': 3, 'there': 7, 'one': 11, 'other': 9, 'so': 5, 'world': 1, 'hello': 4}
我預計t.word_index
只有前3個單詞。我究竟做錯了什麼?Keras Tokenizer num_words似乎沒有工作
另請參見此問題:https://github.com/fchollet/keras/issues/7836 – petezurich
謝謝!以下內容也有助於https://github.com/fchollet/keras/issues/7551 –