language_tool_python
language_tool_python copied to clipboard
Errno 111
When running this code `import language_tool_python import pandas as pd from tqdm.auto import tqdm
tool = language_tool_python.LanguageTool('en-US') tool._url = 'http://localhost:9888/v2/' # Manually set the server URL
def count_grammar_mistakes(text): matches = tool.check(text) return len(matches)
sample_text = "I wants much foods" print(f"Number of grammar mistakes in the sample text: {count_grammar_mistakes(sample_text)}") `
I get this error:
LanguageToolError: http://localhost:9888/v2/: HTTPConnectionPool(host='localhost', port=9888): Max retries exceeded with url: /v2/check?language=en-US&text=I+wants+many+foods (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused'))
This is on a Windows machine, running the code from a Jupyter Notebook in VSC under WSL. The server is up and works when I feed it
http://localhost:9888/v2/check?language=en-US&text=I+wants+much+foods
This happens even when I pause my firewall for a few minutes. Any ideas?