1

I just found the link on how to install textstat on my python idle and I was successful in getting it to work. However, when I import textstat everything seems fine until I try to run a function. It keeps telling me that those are not defined functions. I can go into the textstat folder on my computer, look at the code, and see that they are defined within the code. What am I doing wrong?

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
>>> 
4
  • did you try textstat.flesch_reading_ease(text1) ?
    – hytromo
    Nov 21, 2014 at 19:59
  • Yes, I just tried and it didn't like that either. Told me the module has no attribute 'flesch_reading_ease' Nov 21, 2014 at 22:12
  • Ah, now I have it semi-working. You had to type print textstat.flesch_reading_ease(text1) However, now it is finding problems with every line of code within the module. Is it probably because I am using python 2.7 and not 2.6? If this is the case should I find a way to download 2.6 and transfer textstat to run on that? Nov 21, 2014 at 22:59
  • No, python 2.7 and 2.6 are near the same, no way that this could cause a problem in each line. Nov 24, 2014 at 7:49

0

You must log in to answer this question.

Browse other questions tagged .