文档中提到该功能已被弃用,并将在未来被移除。另一行提示“请使用tensorflow/transform或tf.data。”我在网上搜索了但没找到答案。以下是我收到警告的代码行:
# 将文本转换为数字向量vocab_processor = tf.contrib.learn.preprocessing.VocabularyProcessor(max_sequence_length,min_frequency=min_word_frequency)
回答:
我也没有解决这个问题。这里有一组解释:
tf.contrib.learn.preprocessing:
已弃用。仅Python的预处理功能不适合TensorFlow。请使用tf.data,并考虑使用tensorflow/transform处理更复杂的用例。
https://github.com/tensorflow/tensorflow/blob/r1.8/tensorflow/contrib/learn/README.md
这个例子应该有帮助…但它并没有解释太多https://github.com/tensorflow/transform/blob/master/examples/sentiment_example.py
review_indices = tft.compute_and_apply_vocabulary( review_tokens, top_k=VOCAB_SIZE)