python - 你能修复我的代码来计算词汇丰富度吗?
问题描述
我正在尝试使用 LexicalRichness ( https://pypi.org/project/lexicalrichness/ )。我复制并粘贴了代码:
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))
但它不起作用(错误信息是:TypeError: 'module' object is not callable)
你可以帮帮我吗?先感谢您!
解决方案
检查此行的大小写:lex = LexicalRichness(text)
推荐阅读
- javascript - Dynamic hide/show divs after click on respective buttons with jQuery
- ruby-on-rails - 在新标签 Rails 中显示 base64 编码数据
- python - How to solve nonlinear simultaneous equations for geometric progression?
- gradle - Publish BOM (as pom.xml) using gradle plugin java-platform
- javascript - How Can I count items in a list in Vanilla Javascript?
- database - 通过 Keycloak 使用外部数据库
- concurrency - 当一个值的所有者可以读取它而另一个线程更改它时,Rust 如何防止数据竞争?
- sql - 如何在没有条件的情况下从表中删除最后一行?
- machine-learning - 多线程训练神经网络时没有数据访问同步正常吗?
- javascript - JS对象数组,按时间戳分组值