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

Error in check - Probability must be <= 1 but was Infinity #80

Open
Kailegh opened this issue Sep 6, 2023 · 3 comments
Open

Error in check - Probability must be <= 1 but was Infinity #80

Kailegh opened this issue Sep 6, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@Kailegh
Copy link

Kailegh commented Sep 6, 2023

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 !

@jxmorris12 jxmorris12 added the bug Something isn't working label Oct 14, 2023
@jxmorris12
Copy link
Owner

Hi @Kailegh! Can you share a text that throws this error so I can reproduce? Thanks.

@Kailegh
Copy link
Author

Kailegh commented Oct 30, 2023

Problem is that it is not consistent, I have tried a lot of times and there is no certain text that raises the Error, I havent been able to discover a patron

@jxmorris12
Copy link
Owner

That's strange. But then maybe you could just wrap your code in a retry loop that checks the same text again in the unlikely situation where you see this error? (tenacity is quite good for this sort of thing.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants