konlpy
konlpy copied to clipboard
jpype getting a NullPointerException when calling kkma.sentences
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(" ")
[]