language_tool_python
language_tool_python copied to clipboard
Error in check - Probability must be <= 1 but was Infinity
I am getting the following error when using the check function
matches = tool.check(text)
Traceback (most recent call last):
File "/home/text_quality/main_functions.py", line 51, in async_process
fragments = get_corrections(fragments=fragments, texts=None, words_to_ignore=words_to_ignore, tool=tool)
File "/home/text_quality/language_errors.py", line 43, in get_corrections
matches = tool.check(text)
File "/usr/local/lib/python3.8/site-packages/language_tool_python/server.py", line 129, in check
response = self._query_server(url, self._create_params(text))
File "/usr/local/lib/python3.8/site-packages/language_tool_python/server.py", line 226, in _query_server
raise LanguageToolError(response.content.decode())
language_tool_python.utils.LanguageToolError: Error: Internal Error: Probability must be <= 1 but was Infinity
ERROR 2023-09-06 06:04:02,427: While processing batch uuid 1d32a0fadf61549a0d24dc6647cd7044, there was error Error: Internal Error: Probability must be <= 1 but was Infinity
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/language_tool_python/server.py", line 220, in _query_server
return response.json()
File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 888, in json
return complexjson.loads(
File "/usr/local/lib/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
I cant find the source of the error, it is raised from different texts and I cant find a way of reproducing it. When I run my scripts it sometimes fails and sometimes just works fine.
I create the tool like this, and only execute it in a single process, since I wanted to reduce the probability of getting errors.
tool = language_tool_python.LanguageTool('es', config={"maxCheckThreads": 1,
'cacheSize': 1000,
'pipelineCaching': True,
})
I do not know if you could have a clue of why that happens
Thank you !