gingerit
gingerit copied to clipboard
Long text strings cause a KeyError: 'Corrections'
When passing GingerIt a 700+ character string, it throws KeyError: 'Corrections'.
from gingerit.gingerit import GingerIt
text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin vitae felis sed felis convallis egestas vel ornare massa. Fusce vehicula odio at sem pharetra condimentum. Pellentesque mattis tincidunt bibendum. Integer ultrices odio lorem. Sed venenatis turpis a commodo malesuada. Nunc bibendum tincidunt sem in sodales. Suspendisse non ligula ac ligula venenatis imperdiet eu ut ex. Fusce aliquet, ligula et tristique dignissim, nisi lorem accumsan libero, in porttitor velit erat et tortor. Fusce at libero aliquam, porttitor ligula quis, pellentesque leo. Fusce vitae diam ac quam suscipit pharetra vel hendrerit nisi. Curabitur eu magna sit amet enim porta lacinia. In hac habitasse platea proin."
ginger_parser = GingerIt()
ginger_grammar_results = ginger_parser.parse(text)
Traceback (most recent call last):
File "\grammar-checker-1.py", line 11, in <module>
ginger_grammar_results = ginger_parser.parse(text)
File "C:\Program Files (x86)\Python38-32\lib\site-packages\gingerit\gingerit.py", line 27, in parse
return self._process_data(text, data)
File "C:\Program Files (x86)\Python38-32\lib\site-packages\gingerit\gingerit.py", line 39, in _process_data
for suggestion in reversed(data['Corrections']):
KeyError: 'Corrections'
Is this a bug? I'm assuming that it's an API limitation, but it doesn't seem to be documented anywhere.
I'm having the exact same problem with the latest version of GingerIt, with the exact same traceback
Hi, I am getting same issue with 600+ characters. Anyone managed to resolve it on their end ?
Hi, I am facing the same issue the same issue! Did anybody find a workaround?
@Sidd-Amateur-Dvlper @Akshar-code - It's most likely just an undocumented API limitation. If that's the case, then you'll need to split your paragraphs apart into smaller ones and make multiple API calls.
@Sidd-Amateur-Dvlper @Akshar-code - It's most likely just an undocumented API limitation. If that's the case, then you'll need to split your paragraphs apart into smaller ones and make multiple API calls.
Thanks, thats the solution i went though. Rgds
as mentioned earlier by @Pikamander2:
"it's most likely just an undocumented API limitation."
Even on their official website, it throws a limitation issue - limitation appears on both UI and API response.
- https://www.gingersoftware.com/grammarcheck
| screenshot A | screenshot B |
|---|---|
![]() |
![]() |

