Keras Tokenizer num_words doesn't seem to work

后端 未结 3 1893
日久生厌
日久生厌 2020-12-15 05:17
>>> t = Tokenizer(num_words=3)
>>> l = [\"Hello, World! This is so&#$ fantastic!\", \"There is no other world like this one\"]
>>> t.f         


        
3条回答
  •  既然无缘
    2020-12-15 05:34

    There is nothing wrong in what you are doing. word_index is computed the same way no matter how many most frequent words you will use later (as you may see here). So when you will call any transformative method - Tokenizer will use only three most common words and at the same time, it will keep the counter of all words - even when it's obvious that it will not use it later.

提交回复
热议问题