tenseflow icon indicating copy to clipboard operation
tenseflow copied to clipboard

"RuntimeError: generator raised StopIteration" from module pattern/text

Open snej opened this issue 4 years ago • 7 comments

I got past the previous error by giving in and installing MySQL (via homebrew.) Then I installed the SpaCy English model as directed. But basic CLI usage as in your example fails:

$  python3
Python 3.9.1 (default, Dec 17 2020, 03:56:09) 
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from tenseflow import change_tense
>>> change_tense('I will go to the store.', 'past')
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/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 "/Users/snej/Code/tenseflow/tenseflow/change_tense.py", line 116, in change_tense
    out.append(conjugate(words[-1].text, tense=this_tense, person=person, number=number))
  File "/usr/local/lib/python3.9/site-packages/pattern/text/__init__.py", line 2208, in conjugate
    b = self.lemma(verb, parse=kwargs.get("parse", True))
  File "/usr/local/lib/python3.9/site-packages/pattern/text/__init__.py", line 2172, in lemma
    self.load()
  File "/usr/local/lib/python3.9/site-packages/pattern/text/__init__.py", line 2127, in load
    for v in _read(self._path):
RuntimeError: generator raised StopIteration
>>> 

snej avatar Dec 22 '20 02:12 snej

Same issue. Did you resolve it? @snej , @bendichter

hablema avatar Apr 26 '22 08:04 hablema

git clone https://github.com/bendichter/tenseflow.git

I was getting the same issue, but cloning the repository first helped

mepiyush2000 avatar May 01 '23 07:05 mepiyush2000

There are still people using this? chatGPT would probably be easier and better

bendichter avatar May 06 '23 01:05 bendichter

Huh? That’s like using a sledgehammer to crack open an walnut. (A sledgehammer you can’t even use yourself, you have to send the walnut to the cloud.)

Besides, there’s no assurance that if you tell ChatGPT “change the following text from third to first person…” that it won’t start confabulating and making its own random changes to the text. Especially if the text is long enough to exceed its token window.

snej avatar May 06 '23 23:05 snej

That's all technically true, but I'd recommend at least trying it for your application. There are many nuances of this that my solution handles poorly.

bendichter avatar May 06 '23 23:05 bendichter

I was able, with some hacking, to get it to a state where it converted large swathes of a novel-in-progress from 1st to 3rd person or vice versa. I had to proofread and fix some mistakes, but it was a big help.

snej avatar May 07 '23 16:05 snej

That's great to hear!

bendichter avatar May 07 '23 18:05 bendichter