Skip to content

RunTimeError #283

Open
Open

Description

@vizzerdrix55

Hello there
I use pattern.de and installed in on Jupyter Notebook

I get the following error, when I try to run lemma-command in a for loop with massive (more than 10'000) tokens to be processed:

As there anything that I can do?

additional information:
Python 3.7.1 (default, Dec 14 2018, 13:28:58)
IPython 7.2.0

--- Logging error ---
Traceback (most recent call last):
File "/anaconda3/lib/python3.7/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 "", line 12, in getInfinitive
inf = lemma(verb_token)
File "/anaconda3/lib/python3.7/site-packages/pattern/text/init.py", line 2172, in lemma
self.load()
File "/anaconda3/lib/python3.7/site-packages/pattern/text/init.py", line 2127, in load
for v in _read(self._path):
RuntimeError: generator raised StopIteration

Activity

  1. DHOFM commented on Aug 5, 2019

    @DHOFM

    This is a strange coincidence I had the same problem today. See my post here, how to fix it :)
    #282

  2. vizzerdrix55 commented on Aug 6, 2019

    @vizzerdrix55
    Author

    Hello @DHOFM, I found out, that the Error only appears after the second time of processing a script. When I restart the kernel, there is no Error. I did the fixing you explained without success. I understood your approach of #282 like this:
    Replace the following lines 608 and 609 of /anaconda3/lib/python3.7/site-packages/pattern/text/__init__.py:

    yield line
    raise StopIteration
    

    with

    try:
    
        yield line
    except:
        StopIteration
    return
    
  3. DHOFM commented on Aug 6, 2019

    @DHOFM

    @vizzerdrix55 : Yes - that is what works for me, but I am not on Anaconda, I am on Mac OS but I do not think thats the difference. I use pattern3 for python3 so my path is .../lib/python3.7/site-packages/pattern3/text

    What also is different in your code is you do not return only in an Exception so your code is:

    except:
        StopIteration
    return
    

    and my example is:

    except StopIteration:
             return
    
    
  4. vizzerdrix55 commented on Aug 6, 2019

    @vizzerdrix55
    Author

    @DHOFM You are right. With the colon at the right place, the Error StopIteration doesn't appear anymore. Now I receive IndexError after the second time I run the script. I created a new Issue #284

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions