recursion + keyerror issue with some wordnet synsets
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- python
调研方向
使用 pattern.en.wordnet 重现报告的调用,尤其是对 pos="VB" 的 "deny" 执行 s[4].hypernyms(recursive=True)。阅读 pattern/text/en/wordnet/init.py 中 Synset.hypernyms 附近的代码,以及 pywordnet/wordnet.py 中 getTarget、getSynset 和 _entityCache.get 附近的代码。对于此重现,递归和 KeyError 都得到解决即视为完成。
由索引模型根据 Issue 内容生成。
描述
Ran into an odd recursion and keyerror errors with a wordnet synset of "deny". Note that I abbreviated the 990 iterations of a part of the output.
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> from pattern.en import wordnet as wn
>>> from pattern import __version__ as pattver
>>> pattver
'2.6'
>>> s = wn.synsets("deny", pos="VB")
>>> print(s[4].hypernyms(recursive=True))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
**** CHUNK REPEATED 990 TIMES ****
File "[HOME_DIR]/anaconda/envs/snorkel/lib/python2.7/site-packages/pattern/text/en/wordnet/__init__.py", line 244, in hypernyms
[p.extend(s.hypernyms(True, depth)) for s in list(p)]
**** CHUNK REPEATED 990 TIMES ****
File "[HOME_DIR]/anaconda/envs/snorkel/lib/python2.7/site-packages/pattern/text/en/wordnet/__init__.py", line 236, in hypernyms
p = [Synset(p.getTarget()) for p in self._synset.getPointers(wn.HYPERNYM)]
File "[HOME_DIR]/anaconda/envs/snorkel/lib/python2.7/site-packages/pattern/text/en/wordnet/pywordnet/wordnet.py", line 722, in getTarget
synset = getSynset(self.pos, self.targetOffset)
File "[HOME_DIR]/anaconda/envs/snorkel/lib/python2.7/site-packages/pattern/text/en/wordnet/pywordnet/wordnet.py", line 1090, in getSynset
return _dictionaryFor(pos).getSynset(offset)
File "[HOME_DIR]/anaconda/envs/snorkel/lib/python2.7/site-packages/pattern/text/en/wordnet/pywordnet/wordnet.py", line 827, in getSynset
return _entityCache.get((pos, offset), loader)
File "[HOME_DIR]/anaconda/envs/snorkel/lib/python2.7/site-packages/pattern/text/en/wordnet/pywordnet/wordnet.py", line 1310, in get
if value == None:
File "[HOME_DIR]/anaconda/envs/snorkel/lib/python2.7/site-packages/pattern/text/en/wordnet/pywordnet/wordnet.py", line 472, in __cmp__
return _compareInstances(self, other, ('pos', 'offset'))
File "[HOME_DIR]/anaconda/envs/snorkel/lib/python2.7/site-packages/pattern/text/en/wordnet/pywordnet/wordnet.py", line 1108, in _compareInstances
elif a.__class__ != b.__class__:
RuntimeError: maximum recursion depth exceeded in cmp
>>> print(s[4].hypernyms(recursive=True))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "[HOME_DIR]/anaconda/envs/snorkel/lib/python2.7/site-packages/pattern/text/en/wordnet/__init__.py", line 244, in hypernyms
[p.extend(s.hypernyms(True, depth)) for s in list(p)]
File "[HOME_DIR]/anaconda/envs/snorkel/lib/python2.7/site-packages/pattern/text/en/wordnet/__init__.py", line 236, in hypernyms
p = [Synset(p.getTarget()) for p in self._synset.getPointers(wn.HYPERNYM)]
File "[HOME_DIR]/anaconda/envs/snorkel/lib/python2.7/site-packages/pattern/text/en/wordnet/pywordnet/wordnet.py", line 722, in getTarget
synset = getSynset(self.pos, self.targetOffset)
File "[HOME_DIR]/anaconda/envs/snorkel/lib/python2.7/site-packages/pattern/text/en/wordnet/pywordnet/wordnet.py", line 1090, in getSynset
return _dictionaryFor(pos).getSynset(offset)
File "[HOME_DIR]/anaconda/envs/snorkel/lib/python2.7/site-packages/pattern/text/en/wordnet/pywordnet/wordnet.py", line 827, in getSynset
return _entityCache.get((pos, offset), loader)
File "[HOME_DIR]/anaconda/envs/snorkel/lib/python2.7/site-packages/pattern/text/en/wordnet/pywordnet/wordnet.py", line 1309, in get
del this.history[timestamp]
KeyError: 1003
- 主要语言
- Python
- 星标
- 8.9k
- 派生
- 1.6k
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
clips/pattern 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 72/100
-
难度 1/5 1 小时以内 新手友好度 72/100
-
难度 1/5 1 小时以内 新手友好度 65/100
-
难度 1/5 1 小时以内 新手友好度 45/100
-
难度 4/5 3-5 天 新手友好度 30/100
相似的 Issue
-
namespace operations
难度 1/5 1 小时以内 新手友好度 82/100
EclipseFdn/open-vsx.org#13573 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
collective/icalendar#1854 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
rancher/rancher-ai-agent#412 ·
维护者通常 6 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
TUDelftGeodesy/DePSI#134 ·
-
难度 2/5 1-3 小时 新手友好度 88/100
HenriquesLab/rxiv-maker#335 ·