python-3.x - 我已将 nltk 标签转换为 wordnet 标签。当我尝试对数据集应用词形还原时,我收到了这个错误。我该怎么办?
问题描述
----> 1 df8 = df7.apply (lambda x: [lemmamy.lemmatize(word, nltk_tag) for word, nltk_tag in x])
/opt/anaconda3/lib/python3.8/site-packages/pandas/core/series.py in apply(self, func, convert_dtype, args, **kwds) 4136 else: 4137 values = self.astype(object)。 _values -> 4138 mapped = lib.map_infer(values, f, convert=convert_dtype) 4139 4140 if len(mapped) and isinstance(mapped[0], Series):
pandas/_libs/lib.pyx 在 pandas._libs.lib.map_infer()
在 (x) ----> 1 df8 = df7.apply(lambda x: [lemmamy.lemmatize(word, nltk_tag) for word, nltk_tag in x])
in (.0) ----> 1 df8 = df7.apply(lambda x: [lemmamy.lemmatize(word, nltk_tag) for word, nltk_tag in x])
/opt/anaconda3/lib/python3.8/site-packages/nltk/stem/wordnet.py in lemmatize(self, word, pos) 36 37 def lemmatize(self, word, pos=NOUN): ---> 38 lemmas = wordnet._morphy(word, pos) 39 return min(lemmas, key=len) if lemmas else word 40
/opt/anaconda3/lib/python3.8/site-packages/nltk/corpus/reader/wordnet.py in _morphy(self, form, pos, check_exceptions) 1904 # 找到匹配项,否则你不能再继续 1905 - > 1906 例外 = self._exception_map[pos] 1907 替换 = self.MORPHOLOGICAL_SUBSTITUTIONS[pos] 1908
关键错误:无
解决方案
推荐阅读
- mysql - 试图在表中创建外键,SQL 抛出错误
- javascript - 加载完成后书签做一些事情
- cassandra - Cassandra 无法与任何同龄人八卦
- themes - Shopify 主题开发 - 部分和块开发
- jquery - 从 ajax 更新 Html.RenderPartialAsync()
- numpy - 有没有像张量流中那样的cumulative_logsumexp 的numpy 模拟?
- swift - 循环遍历多个列表
- java - KeyPairGeneration 在 RSA 的 Java 中不起作用
- node.js - crypto.createHmac 不是函数 + 角度
- elasticsearch-opendistro - 为 Open Distro 安装插件