【发布时间】:2016-03-26 09:06:36
【问题描述】:
我正在尝试使用 Python 在终端中运行这段代码:
>>> from nltk.corpus import wordnet
>>> syn = wordnet.synsets('cookbook')[0]
>>> lemmas = syn.lemmas
>>> len(lemmas)
结果出现了错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: object of type 'instancemethod' has no len()
出了什么问题以及如何解决这个问题?
【问题讨论】:
-
同stackoverflow.com/questions/36234498/… ;P 印刷的NLTK书比较陈旧,请关注电子版:nltk.org/book。我发现 howtos 页面对参考很有用:nltk.org/howto
-
@alvas 哇,这太棒了,非常感谢!