-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
KeyError during POS tagging using the French model #1052
Comments
Thanks @raphael0202 for debug.
in following file :
solve the problem. Again, thanks for spacy's contributors 👍 |
Trained a Hungarian PoS model and run into the same problem. |
Having the same issue with the Spanish model:
results in:
|
I can confirm the KeyError originally reported in this issue. Looks like it is still around. In my experience, the error seems to appear whenever the model encounters a linebreak ("\n"). If I feed a simple string, all works fine. If my string includes a linebreak ("\n"), the KeyErrror appears. Similarly, if I load some text from a file and that file has linebreaks in it, the KeyError appears. If I split the text loaded from the file in lines on the linebreak ("\n") and parse each line separatedly, there is no error. I assume I'm using version 1.8.2 of spacy (there doesn't seem to be a __version__ attribute so I'm not sure) on Ubuntu 17.04 and using files in UTF-8 with Linux-style linebreaks.
|
I ran into this issue using Rasa NLU, parsing the following string
|
I also have a key error when trying to use the Dutch parser for text from text files. I checked the tag_map.py file and it already includes 'SP': {POS: SPACE}. Any other ideas what I can try? |
Also, my text is cleaned of \n, so i'm not sure why this error comes up. |
This is the error I get: KeyError: 119560` |
Solved it. I was looking into the wrong tag_map.py I hope this is helpful for other people. |
The same problem occurs with the English model too (web-core-sm). Spacy 1.9 returns SP as the tag but in the alpha it's returned as an empty string |
Working on this in the v2 branch. Thanks for your patience with this frustrating problem. |
Fixed 🎉 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Related to #683
Minimal example to reproduce the bug:
The error comes from
morphology.pyx
(line 76):'SP' is not defined in the French tag map, so its ID is not in
self.reverse_index
, leading to the KeyError. Here is the associatedmorphology
tag_map:I added the following tag map to FrenchDefaults:
and got a core dumped with
nlp('\n')
:Your Environment
The text was updated successfully, but these errors were encountered: