简体   繁体   English

从 gensim 导入 Lemmatization 的问题

[英]Problem with importing Lemmatization from gensim

I am trying to use Gensim packages as written below:我正在尝试使用 Gensim 包,如下所示:

import re, numpy as np, pandas as pd
from pprint import pprint

# Gensim
import gensim, spacy, logging, warnings
import gensim.corpora as corpora
from gensim.utils import lemmatize, simple_preprocess
from gensim.models import CoherenceModel
import matplotlib.pyplot as plt

But i keep getting the error:但我不断收到错误:

ImportError: cannot import name 'lemmatize' from 'gensim.utils' (/Users/xxx/opt/anaconda3/envs/virt_env/lib/python3.9/site-packages/gensim/utils.py)

I am using gensim v4.0.1, Python 3.8, numpy 1.20.0.我正在使用 gensim v4.0.1、Python 3.8、numpy 1.20.0。

Has anyone encountered this kinda problem lately?最近有人遇到过这种问题吗? Thank you谢谢

Gensim only ever previously wrapped the lemmatization routines of another library ( Pattern ) – which was not a particularly modern/maintained option, so was removed from Gensim-4.0. Gensim 以前只包装过另一个库( Pattern )的词形还原例程——这不是一个特别现代/维护的选项,因此从 Gensim-4.0 中删除。

Users should choose & apply their own lemmatization operations, if any, as a preprocessing step before applying Gensim's algorithms.用户应在应用 Gensim 算法之前选择并应用他们自己的词形还原操作(如果有)作为预处理步骤。 Some Python libraries offering lemmatization include:一些提供词形还原的 Python 库包括:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM