TypeError: clean() 得到了一个意外的关键字参数



我正在使用python在Colab Notebook上进行情感分析。 这是我使用Cleantext和spaCy的代码。

def prep(text):
cleaned = clean(text, fix_unicode=True, to_ascii=True, lower=False, no_line_breaks=True, no_urls=True,
no_emails=True, no_phone_numbers=False, no_numbers=False, no_digits=True, no_currency_symbols=True, 
no_punct=True, replace_with_url="URL_ADDRESS", replace_with_email="EMAIL_ADDRESS",
replace_with_phone_number="<PHONE>", replace_with_number="<NUMBER>",
replace_with_digit="INTEGER", replace_with_currency_symbol="CUR", lang="en")
doc = nlp(cleaned)
processed =' '.join([token.lemma_ if str(token) not in ['Our','our','We','we','us'] else str(token) for token in doc])
return processed

使用此功能预处理数据在本地 jupyter 笔记本上工作正常,但在 Colab 上,我得到了TypeError: clean() got an unexpected keyword argument如何解决此问题?

谢谢

你应该更新你的包。

pip install clean-text[gpl]==0.4.0

相关内容

最新更新