问题
I know that we can check for resources like this:
try:
nltk.data.find('tokenizers/punkt')
except LookupError:
nltk.download('punkt')
But I can't find the way to do this for wordnet:
try:
nltk.data.find('wordnet') # ????/wordnet
except LookupError:
nltk.download('wordnet')
How can I make this check?
回答1:
You can do:
nltk.find('corpora/wordnet')
来源:https://stackoverflow.com/questions/57925041/how-to-check-if-wordnet-is-already-installed