在NLTK中导入WordNet [英] Import WordNet In NLTK

查看:955
本文介绍了在NLTK中导入WordNet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想导入 wordnet 字典,但是当我导入字典表单 wordnet 我看到这个错误:

I want to import wordnet dictionary but when i import Dictionary form wordnet i see this error :

 for l in open(WNSEARCHDIR+'/lexnames').readlines():
IOError: [Errno 2] No such file or directory: 'C:\\Program Files\\WordNet\\2.0\\dict/lexnames'

我在此目录中安装wordnet2.1,但我无法导入
请帮我解决这个问题

I install wordnet2.1 in this directory but i cant import please help me to solve this problem

import nltk
from nltk import *
from nltk.corpus import wordnet
from wordnet import Dictionary

print '-----------------------------------------'
print Dictionary.length


推荐答案

以下作品对我来说:

>>> nltk.download()
# Download window opens, fetch wordnet
>>> from nltk.corpus import wordnet as wn

现在我有一个 WordNetCorpusReader 调用 wn 。我不知道你为什么要找一个字典类,因为在 docs 。 NLTK书籍在第2.5节中解释了你可以使用 nltk.corpus.wordnet 模块。

Now I've a WordNetCorpusReader called wn. I don't know why you're looking for a Dictionary class, since there's no such class listed in the docs. The NLTK book, in section 2.5, explains what you can do with the nltk.corpus.wordnet module.

这篇关于在NLTK中导入WordNet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆