Open junho85 opened 4 years ago
pip install konlpy
sudo apt-get install openjdk-8-jdk
https://konlpy-ko.readthedocs.io/ko/v0.5.1/install/
from konlpy.tag import Okt
okt = Okt()
>>> text = "명사를 추출해 봅시다. 반갑습니다. hello world"
>>>
>>> print(okt.morphs(text))
['명사', '를', '추출', '해', '봅시다', '.', '반갑습니다', '.', 'hello', 'world']
>>> print(okt.morphs(text, stem=True))
['명사', '를', '추출', '하다', '보다', '.', '반갑다', '.', 'hello', 'world']
그런데 추출에 시간이 좀 걸림.
jvm 계속 실패뜸. openjdk13 이라서 그런가? openjdk8 설치
sdk use java 8.0.232.j9-adpt
여전히 안됨
>>> from konlpy.tag import Okt
>>> okt = Okt()
/Users/junho85/PycharmProjects/garden4/venv/lib/python3.7/site-packages/jpype/_core.py:210: UserWarning:
-------------------------------------------------------------------------------
Deprecated: convertStrings was not specified when starting the JVM. The default
behavior in JPype will be False starting in JPype 0.8. The recommended setting
for new code is convertStrings=False. The legacy value of True was assumed for
this session. If you are a user of an application that reported this warning,
please file a ticket with the developer.
-------------------------------------------------------------------------------
""")
JVMJ9VM015W Initialization error for library j9gc29(2): Failed to instantiate compressed references metadata. 200M requested
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/junho85/PycharmProjects/garden4/venv/lib/python3.7/site-packages/konlpy/tag/_okt.py", line 87, in __init__
jvm.init_jvm(jvmpath, max_heap_size)
File "/Users/junho85/PycharmProjects/garden4/venv/lib/python3.7/site-packages/konlpy/jvm.py", line 66, in init_jvm
'-ea', '-Xmx{}m'.format(max_heap_size))
File "/Users/junho85/PycharmProjects/garden4/venv/lib/python3.7/site-packages/jpype/_core.py", line 219, in startJVM
_jpype.startup(jvmpath, tuple(args), ignoreUnrecognized, convertStrings)
RuntimeError: Unable to start JVM
at loadJVM(native/common/jp_env.cpp:169)
at loadJVM(native/common/jp_env.cpp:179)
at startup(native/python/pyjp_module.cpp:159)
>>>
카카오 형태소 분석기(khaiii) 설치, 실행, 사전추가 2019.02.22 다음엔 이거 시도 해보자 https://hanshuginn.blogspot.com/2019/02/khaiii.html
miika 가 알려준거 https://cloud.google.com/natural-language/docs/quickstart-client-libraries#client-libraries-install-python 크레딧 없어도 한달에 5000단위 (1단위 = 1000자) 공짜라고 함.