How to check if wordnet is already installed?

倖福魔咒の 提交于 2021-01-28 07:54:22

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!