You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
def pattern_stopiteration_workaround():
try:
print(lexeme('gave'))
except:
pass
def main():
pattern_stopiteration_workaround()
#Add your other code here
Basically, the pattern code will fail the first time you run it, so you first need to run it once and catch the Exception it throws.
It's worked well enough for my own scripts, but I don't know if it fixes every possible issue.
Ideally though, somebody should fork the clips/pattern project since it's no longer maintained.
When running the following code:
I get the following error:
However, if I run
conjugate("ben", PRESENT, 3, SG)
again in the same shell it works as expected.The text was updated successfully, but these errors were encountered: