我正在try 使用Spacy删除从CSV创建的Pandas 数据帧中的停用字. 我的问题是,我试图解释那些可能混合了单词和数字的单词.
My issue:个
如果数字分隔单词以使其包含停止字, 它将删除该词的这一部分.
Ex. With stop word at the end
Input: 'co555in'
Breaks up the word, separating it in 'co'+ 555 + 'in'
Removes 'in' because it is a stop word.
Output: 'co555'
Ex. Without stop word at the end
Input: 'co555inn'
Breaks up the word, separating it in 'co'+ 555 + 'inn'
Will not remove 'inn' because it is not a stop word.
Output: 'co555inn'
Current implementation:个
df[col] = df[col].apply(lambda text:
"".join(token.lemma_ for token in nlp(text)
if not token.is_stop))
所以我想要的是能够解释数字和单词的混合,而不是拼写过滤掉单词的一部分,如果数字分隔字符串,那么它包含一个停用词.