'module'对象没有属性'word_tokenize'

时间:2014-08-30 12:21:45

标签: python parsing nltk

这是第一次玩python,我正在尝试复制并运行一些在线可用的代码,以了解它们是如何工作的,但其中一些不起作用。这是我在尝试使用NLTK复制在python中执行词性的程序时遇到的问题的示例。

import nltk
import re
import time

exampleArray = ['The incredibly intimidating NLP scares people who are sissies.']

def processLanguage():
    try:
        for item in exampleArray:
        tokenized = nltk.word_tokenized(item)
        tagged = nltk.pos_tag(tokenized)

    except Exception, e:
        print str(e)


processLanguage()

问题是当我运行此代码时,我收到此消息:

'module' object has no attribute 'word_tokenize'
'module' object has no attribute 'word_tokenized'

你能告诉我如何解决这个问题。

0 个答案:

没有答案