简体   繁体   中英

Problem with importing Lemmatization from gensim

I am trying to use Gensim packages as written below:

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.

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.

Users should choose & apply their own lemmatization operations, if any, as a preprocessing step before applying Gensim's algorithms. Some Python libraries offering lemmatization include:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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