【发布时间】:2019-04-12 10:10:07
【问题描述】:
我有一个函数:
def remove_stopwords(text):
return [[word for word in simple_preprocess(str(doc), min_len = 2) if word not in stop_words] for doc in texts]
我的输入是一个带有标记语句的列表:
input = ['This', 'is', 'an', 'example', 'of', 'my', 'input']
假设stop_words包含单词:'this'、'is'、'an'、'of'和'my',那么我想得到的输出是:
desired_output = ['example', 'input']
但是,我现在得到的实际输出是:
actual_output = [[], [], [], ['example'], [], [], ['input']]
如何调整我的代码以获得此输出?
【问题讨论】:
标签: python apply tokenize gensim