-2

I am trying to use LexicalRichness (https://pypi.org/project/lexicalrichness/). I copied and pasted the code:

import lexicalrichness
from lexicalrichness import LexicalRichness

text = """Measure of textual lexical diversity, computed as the mean length of sequential words in
                a text that maintains a minimum threshold TTR score.

                Iterates over words until TTR scores falls below a threshold, then increase factor
                counter by 1 and start over. McCarthy and Jarvis (2010, pg. 385) recommends a factor
                threshold in the range of [0.660, 0.750].
                (McCarthy 2005, McCarthy and Jarvis 2010)"""

use_TextBlob=True
lex = lexicalrichness(text)

print(lex.words)
print(lex.terms)
print(lex.ttr)
print(lex.rttr)
print(lex.cttr)
print(lex.msttr(segment_window=25))
print(lex.mattr(window_size=25))
print(lex.mtld(threshold=0.72))
print(lex.hdd(draws=42))

But it doesn't work (the error message is: TypeError: 'module' object is not callable)

Could you help me? Thank you in advance!

Andrea
  • 47
  • 5
  • Please update your question with the full error traceback. – quamrana Jun 21 '21 at 19:15
  • 4
    Replace `lex = lexicalrichness(text)` by `lex = LexicalRichness(text)`: the first in lower case is the module, the second in camel case is the class. – Corralien Jun 21 '21 at 19:16

1 Answers1

1

Check this line for capitalisation: lex = LexicalRichness(text)

DSteman
  • 1,388
  • 2
  • 12
  • 25