clips / clips/pattern

RuntimeError: generator raised StopIteration in Dutch verb conjugation

Open
#295 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
8.9k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

When running the following code:

import pattern.nl
from pattern.nl import conjugate
from pattern.nl import PRESENT, SG, PAST
conjugate("ben", PRESENT, 3, SG)

I get the following error:

Traceback (most recent call last):
  File "/home/emma/miniconda3/lib/python3.7/site-packages/Pattern-3.6-py3.7.egg/pattern/text/__init__.py", line 609, in _read
    raise StopIteration
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/emma/miniconda3/lib/python3.7/site-packages/Pattern-3.6-py3.7.egg/pattern/text/__init__.py", line 2208, in conjugate
    b = self.lemma(verb, parse=kwargs.get("parse", True))
  File "/home/emma/miniconda3/lib/python3.7/site-packages/Pattern-3.6-py3.7.egg/pattern/text/__init__.py", line 2172, in lemma
    self.load()
  File "/home/emma/miniconda3/lib/python3.7/site-packages/Pattern-3.6-py3.7.egg/pattern/text/nl/inflect.py", line 246, in load
    _Verbs.load(self)
  File "/home/emma/miniconda3/lib/python3.7/site-packages/Pattern-3.6-py3.7.egg/pattern/text/__init__.py", line 2127, in load
    for v in _read(self._path):
RuntimeError: generator raised StopIteration

However, if I run conjugate("ben", PRESENT, 3, SG) again in the same shell it works as expected.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the first-call failure with the Dutch conjugation example, then inspect _read and the loading path in pattern/text/init.py and pattern/text/nl/inflect.py. Done means the initial conjugate("ben", PRESENT, 3, SG) call succeeds under the affected Python version, while the existing behavior remains covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.