Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
snej opened this issue Dec 22, 2020 · 7 comments
Open

Comments

@snej
Copy link
Contributor

snej commented Dec 22, 2020

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
>>> 
@hablema
Copy link

hablema commented Apr 26, 2022

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

@mepiyush2000
Copy link

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

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

@bendichter
Copy link
Owner

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

@snej
Copy link
Contributor Author

snej commented May 6, 2023

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.

@bendichter
Copy link
Owner

bendichter commented May 6, 2023

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.

@snej
Copy link
Contributor Author

snej commented May 7, 2023

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.

@bendichter
Copy link
Owner

That's great to hear!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants