我编写了这个函数并得到了TypeError: unhashable type: 'list'
。我怎样才能修好它
def get_words(txt):
a=(lambda x: x not in STOP_WORDS), re.findall(r'\b(\w+)\b', txt)
return a
def sentence_words(text):
line = text.strip().lower()
sent_tokenize1=sent_tokenize(line)
sent_wordsmap=list(map(get_words,sent_tokenize1))
return sent_wordsmap
sent_word=sentence_words(text)
model = Word2Vec(sent_word, size=128, window=3, min_count=5, workers=4)
TypeError: unhashable type: 'list'
用这个替换你的
get_words
相关问题 更多 >
编程相关推荐