konlpy icon indicating copy to clipboard operation
konlpy copied to clipboard

jpype getting a NullPointerException when calling kkma.sentences

Open alvations opened this issue 9 years ago • 0 comments

I'm not sure which line is causing this problem when the input is an empty line.

>>> from konlpy.tag import Kkma
>>> kkma = Kkma()
>>> kkma.sentences('')
[]
>>> kkma.sentences(' ')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.4/dist-packages/konlpy/tag/_kkma.py", line 81, in sentences
    sentences = self.jki.morphAnalyzer(phrase)
jpype._jexception.RuntimeExceptionPyRaisable: java.lang.NullPointerException

Maybe returning an empty line while catching the exception is more appropriate. E.g.

>>> kkma.sentences(" ")
[]

alvations avatar Feb 09 '17 03:02 alvations