我制作了一个函数来根据数据进行词干,但它会出错


def stem(text):
y=[]

for i in text.split():
y.append(ps.stem(i))

return " ".join(y)    
new_df['tags'].apply(stem())
error:stem() missing 1 required positional argument: 'text'

试试这个代码。。

def stem(text):
y=[]
for i in text.split():
y.append(ps.stem(i))
return " ".join(y)
new_df['tags']=new_df['tags'].apply(stem)

最新更新