【发布时间】:2021-09-29 07:20:05
【问题描述】:
Tensorflow Tokenizer 将文本标记化并编码为机器可读的向量。首先我们在大量文本上调用fit_on_texts 来构建字典,然后我们在输入文本上调用fit_on_sequences 来构建相应的向量编码。
What does Keras Tokenizer method exactly do?
但是,似乎没有内置的反向操作方法,用于根据字典从数字向量中检索文本。
在 Python 中可以实现类似的东西
# map predicted word index to word
out_word=''
for word, index in tokenizer.word_index.items():
if index==yhat:
out_word=word
break
有没有一种从数字中检索文本的好方法,换句话说,有没有内置的 fit_to_sequences 反向操作?
【问题讨论】:
-
你在 Tokenizer texts_to_sequences 中有两个主要的方法来获取序列和sequence_to_texts 来做逆向,我不知道你所说的反向 fit_to_sequences 是什么意思
标签: python tensorflow machine-learning encoding embedding