myint/language-check

Can't reproduce example with EN language

everron opened this issue · 0 comments

Hello there,

I have used this lib to check for grammar errors in French and it works perfectly fine :

>>> #!/usr/bin/env python
... #-*- coding: utf-8 -*-
...
>>> import language_check
>>> tool = language_check.LanguageTool('fr')
>>> text = u'A sentence with a error in the Hitchhiker’s Guide tot he Galaxy'
>>> matches = tool.check(text)
>>> len(matches)
>>> 1

However, when I switch to another language (english) it fails :

#!/usr/bin/env python
#-*- coding: utf-8 -*-
... 
import language_check
tool = language_check.LanguageTool('en-GB')
text = u'A sentence with a error in the Hitchhiker’s Guide tot he Galaxy'
matches = tool.check(text)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/language_check/__init__.py", line 246, in check
    root = self._get_root(self._url, self._encode(text, srctext))
  File "/usr/local/lib/python2.7/site-packages/language_check/__init__.py", line 310, in _get_root
    cls._terminate_server()
  File "/usr/local/lib/python2.7/site-packages/language_check/__init__.py", line 401, in _terminate_server
    cls._server.terminate()
AttributeError: 'NoneType' object has no attribute 'terminate'

I am running it with Python 2.7 on MacOS sierra

#EDIT

Problem solved by restarting my computer