Textstat 未运行函数

Textstat 未运行函数

我刚刚找到了如何在 Python 空闲时安装 textstat 的链接,并成功让它工作了。但是,当我导入 textstat 时,一切似乎都很好,直到我尝试运行一个函数。它一直告诉我那些不是定义的函数。我可以进入计算机上的 textstat 文件夹,查看代码,并发现它们是在代码中定义的。我做错了什么?

Python 2.7.8 (default, Jul 13 2014, 17:11:32) 
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
Type "copyright", "credits" or "license()" for more information.
>>> import textstat
>>> import nltk
>>> from nltk.book import
SyntaxError: invalid syntax
>>> from nltk.book import*
*** Introductory Examples for the NLTK Book ***
Loading text1, ..., text9 and sent1, ..., sent9
Type the name of the text or sentence to view it.
Type: 'texts()' or 'sents()' to list the materials.
text1: Moby Dick by Herman Melville 1851
text2: Sense and Sensibility by Jane Austen 1811
text3: The Book of Genesis
text4: Inaugural Address Corpus
text5: Chat Corpus
text6: Monty Python and the Holy Grail
text7: Wall Street Journal
text8: Personals Corpus
text9: The Man Who Was Thursday by G . K . Chesterton 1908
>>> flesch_reading_ease(text1)

Traceback (most recent call last):
  File "<pyshell#4>", line 1, in <module>
    flesch_reading_ease(text1)
NameError: name 'flesch_reading_ease' is not defined
>>> 

相关内容