Git Product home page Git Product logo

khaiii's Introduction

khaiii

khaiii는 "Kakao Hangul Analyzer III"의 첫 글자들만 모아 만든 이름으로 카카오에서 개발한 세 번째 형태소분석기입니다. 두 번째 버전의 형태소분석기 이름인 dha2 (Daumkakao Hangul Analyzer 2)를 계승한 이름이기도 합니다.

형태소는 언어학에서 일정한 의미가 있는 가장 작은 말의 단위로 발화체 내에서 따로 떼어낼 수 있는 것을 말합니다. 즉, 더 분석하면 뜻이 없어지는 말의 단위입니다. 형태소분석기는 단어를 보고 형태소 단위로 분리해내는 소프트웨어를 말합니다. 이러한 형태소분석은 자연어 처리의 가장 기초적인 절차로 이후 구문 분석이나 의미 분석으로 나아가기 위해 가장 먼저 이루어져야 하는 과정으로 볼 수 있습니다. (한국어 위키피디아에서 인용)

데이터 기반

기존 버전이 사전과 규칙에 기반해 분석을 하는 데 반해 khaiii는 데이터(혹은 기계학습) 기반의 알고리즘을 이용하여 분석을 합니다. 학습에 사용한 코퍼스는 국립국어원에서 배포한 21세기 세종계획 최종 성과물을 저희 카카오에서 오류를 수정하고 내용을 일부 추가하기도 한 것입니다.

전처리 과정에서 오류가 발생하는 문장을 제외하고 약 85만 문장, 천만 어절의 코퍼스를 사용하여 학습을 했습니다. 코퍼스와 품사 체계에 대한 자세한 내용은 코퍼스 문서를 참고하시기 바랍니다.

알고리즘

기계학습에 사용한 알고리즘은 신경망 알고리즘들 중에서 Convolutional Neural Network(CNN)을 사용하였습니다. 한국어에서 형태소분석은 자연어처리를 위한 가장 기본적인 전처리 과정이므로 속도가 매우 중요한 요소라고 생각합니다. 따라서 자연어처리에 많이 사용하는 Long-Short Term Memory(LSTM)와 같은 Recurrent Neural Network(RNN) 알고리즘은 속도 면에서 활용도가 떨어질 것으로 예상하여 고려 대상에서 제외하였습니다.

CNN 모델에 대한 상세한 내용은 CNN 모델 문서를 참고하시기 바랍니다.

성능

정확도

v0.3

CNN 모델의 주요 하이퍼 파라미터는 분류하려는 음절의 좌/우 문맥의 크기를 나타내는 win 값과, 음절 임베딩의 차원을 나타내는 emb 값입니다. win 값은 {2, 3, 4, 5, 7, 10}의 값을 가지며, emb 값은 {20, 30, 40, 50, 70, 100, 150, 200, 300, 500}의 값을 가집니다. 따라서 이 두 가지 값의 조합은 6 x 10으로 총 60가지를 실험하였고 아래와 같은 성능을 보였습니다. 성능 지표는 정확률과 재현율의 조화 평균값인 F-Score입니다.

win 파라미터의 경우 3 혹은 4에서 가장 좋은 성능을 보이며 그 이상에서는 오히려 성능이 떨어집니다. emb 파라미터의 경우 150까지는 성능도 같이 높아지다가 그 이상에서는 별 차이가 없습니다. 최 상위 5위 중 비교적 작은 모델은 win=3, emb=150으로 F-Score 값은 97.11입니다. 이 모델을 large 모델이라 명명합니다.

v0.4

띄어쓰기 오류에 강건한 모델을 위한 실험을 통해 모델을 개선하였습니다. v0.4 모델은 띄어쓰기가 잘 되어있지 않은 입력에 대해 보다 좋은 성능을 보이는데 반해 세종 코퍼스에서는 다소 정확도가 떨어집니다. 이러한 점을 보완하기 위해 base 및 large 모델의 파라미터를 아래와 같이 조금 변경했습니다.

  • base 모델: win=4, emb=35, F-Score: 94.96
  • large 모델: win=4, emb=180, F-Score: 96.71

속도

v0.3

모델의 크기가 커지면 정확도가 높아지긴 하지만 그만큼 계산량 또한 많아져 속도가 떨어집니다. 그래서 적당한 정확도를 갖는 모델 중에서 크기가 작아 속도가 빠른 모델을 base 모델로 선정하였습니다. F-Score 값이 95 이상이면서 모델의 크기가 작은 모델은 win=3, emb=30이며 F-Score는 95.30입니다.

속도를 비교하기 위해 1만 문장(총 903KB, 문장 평균 91)의 텍스트를 분석해 비교했습니다. base 모델의 경우 약 10.5초, large 모델의 경우 약 78.8초가 걸립니다.

v0.4

모델의 크기가 커짐에 따라 아래와 같이 base, large 모델의 속도를 다시 측정했으며 v0.4 버전에서 다소 느려졌습니다.

  • base 모델: 10.8 -> 14.4
  • large 모델: 87.3 -> 165

사용자 사전

신경망 알고리즘은 소위 말하는 블랙박스 알고리즘으로 결과를 유추하는 과정을 사람이 따라가기가 쉽지 않습니다. 그래서 오분석이 발생할 경우 모델의 파라미터를 수정하여 바른 결과를 내도록 하는 것이 매우 어렵습니다. 이를 위해 khaiii에서는 신경망 알고리즘의 앞단에 기분석 사전을 뒷단에 오분석 패치라는 두 가지 사용자 사전 장치를 마련해 두었습니다.

기분석 사전

기분석 사전은 단일 어절에 대해 문맥에 상관없이 일괄적인 분석 결과를 갖는 경우에 사용합니다. 예를 들어 아래와 같은 엔트리가 있다면,

입력 어절 분석 결과
이더리움* 이더리움/NNP

문장에서 이더리움으로 시작하는 모든 어절은 신경망 알고리즘을 사용하지 않고 이더리움/NNP로 동일하게 분석합니다.

세종 코퍼스에서 분석 모호성이 없는 어절들로부터 자동으로 기분석 사전을 추출할 경우 약 8만 개의 엔트리가 생성됩니다. 이를 적용할 경우 약간의 속도 향상도 있어서 base 모델에 적용하면 약 9.2초로 10% 정도 속도 향상이 있었습니다.

기분석 사전의 기술 방법 및 자세한 내용은 기분석 사전 문서를 참고하시기 바랍니다.

오분석 패치

오분석 패치는 여러 어절에 걸쳐서 충분한 문맥과 함께 오분석을 바로잡아야 할 경우에 사용합니다. 예를 들어 아래와 같은 엔트리가 있다면,

입력 텍스트 오분석 결과 정분석 결과
이 다른 것 이/JKS + _ + 다/VA + 른/MM + _ + 것/NNB 이/JKS + _ + 다르/VA + ㄴ/ETM + _ + 것/NNB

만약 khaiii가 위 "오분석 결과"와 같이 오분석을 발생한 경우에 한해 바른 분석 결과인 "정분석 결과"로 수정합니다. 여기서 "_"는 어절 간 경계, 즉 공백을 의미합니다.

오분석 패치의 기술 방법 및 자세한 내용은 오분석 패치 문서를 참고하시기 바랍니다.

빌드 및 설치

khaiii의 빌드 및 설치에 관해서는 빌드 및 설치 문서를 참고하시기 바랍니다.

Contributing

khaiii에 기여하실 분들은 CONTRIBUTING개발자를 위한 가이드 문서를 참고하시기 바랍니다.

License

This software is licensed under the Apache 2 license, quoted below.

Copyright 2018 Kakao Corp. http://www.kakaocorp.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this project except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

khaiii's People

Contributors

cynthia avatar flrngel avatar hubert-lee avatar hyunmoahn avatar krikit avatar nakosung avatar oss-kakao avatar violetblue avatar woowahan-jaehoon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

khaiii's Issues

[질문] 정확도 비교?

혹시 기존의 형태소 분석기와 정확도(f-score etc.)를 비교한 자료 깉은 것이 있을까요?
감사합니다.

python 패키지 설치시 khaiii-0.2.zip not found

안녕하세요, 우선 이렇게 좋은 형태소 분석기를 만들어주심에 감사를 드립니다.
설치를 하는 과정에서 아래와 같이 khaiii-0.2.zip를 python-package 디렉토리에서 찾지 못하는 현상이 발견되었습니다. 혹시 해당 과정에 대해서 리포팅된 버그나 짐작이 가시는 부분이 있으시다면 안내 부탁드립니다.

Ubuntu Server에서 설치시에도 동일한 에러가 발생하여, Mac에서도 재시도 하였으나 동일한 애러가 발생했습니다.

(ml-env)  ✘ codertimo@codertimo-macpro  ~/dev/khaiii/build/package_python   master  pip install .
Processing /Users/codertimo/dev/khaiii/build/package_python
Building wheels for collected packages: khaiii
  Running setup.py bdist_wheel for khaiii ... error
  Complete output from command /Users/codertimo/env/ml-env/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/bk/dnvhhrxs5hq_tzy2bm_ppk6h0000gn/T/pip-req-build-z06rgzdp/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/bk/dnvhhrxs5hq_tzy2bm_ppk6h0000gn/T/pip-wheel-igusk8av --python-tag cp37:
  running bdist_wheel
  running build
  error: [Errno 2] No such file or directory: 'khaiii-0.2.zip'

  ----------------------------------------
  Failed building wheel for khaiii
  Running setup.py clean for khaiii
Failed to build khaiii
Installing collected packages: khaiii
  Running setup.py install for khaiii ... error
    Complete output from command /Users/codertimo/env/ml-env/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/bk/dnvhhrxs5hq_tzy2bm_ppk6h0000gn/T/pip-req-build-z06rgzdp/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/bk/dnvhhrxs5hq_tzy2bm_ppk6h0000gn/T/pip-record-uud1pp16/install-record.txt --single-version-externally-managed --compile --install-headers /Users/codertimo/env/ml-env/bin/../include/site/python3.7/khaiii:
    running install
    running build
    error: [Errno 2] No such file or directory: 'khaiii-0.2.zip'

    ----------------------------------------
Command "/Users/codertimo/env/ml-env/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/bk/dnvhhrxs5hq_tzy2bm_ppk6h0000gn/T/pip-req-build-z06rgzdp/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/bk/dnvhhrxs5hq_tzy2bm_ppk6h0000gn/T/pip-record-uud1pp16/install-record.txt --single-version-externally-managed --compile --install-headers /Users/codertimo/env/ml-env/bin/../include/site/python3.7/khaiii" failed with error code 1 in /private/var/folders/bk/dnvhhrxs5hq_tzy2bm_ppk6h0000gn/T/pip-req-build-z06rgzdp/
You are using pip version 18.1, however version 19.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Makefile:162: recipe for target 'all' failed

See file:///usr/share/doc/gcc-5/README.Bugs for instructions.
CMakeFiles/obj_khaiii.dir/build.make:231: recipe for target 'CMakeFiles/obj_khaiii.dir/src/main/cpp/khaiii/khaiii_dev.cpp.o' failed
make[2]: *** [CMakeFiles/obj_khaiii.dir/src/main/cpp/khaiii/khaiii_dev.cpp.o] Error 4
c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See file:///usr/share/doc/gcc-5/README.Bugs for instructions.
CMakeFiles/obj_khaiii.dir/build.make:166: recipe for target 'CMakeFiles/obj_khaiii.dir/src/main/cpp/khaiii/Sentence.cpp.o' failed
make[2]: *** [CMakeFiles/obj_khaiii.dir/src/main/cpp/khaiii/Sentence.cpp.o] Error 4
c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See file:///usr/share/doc/gcc-5/README.Bugs for instructions.
CMakeFiles/obj_khaiii.dir/build.make:218: recipe for target 'CMakeFiles/obj_khaiii.dir/src/main/cpp/khaiii/khaiii_api.cpp.o' failed
make[2]: *** [CMakeFiles/obj_khaiii.dir/src/main/cpp/khaiii/khaiii_api.cpp.o] Error 4
CMakeFiles/Makefile2:215: recipe for target 'CMakeFiles/obj_khaiii.dir/all' failed
make[1]: *** [CMakeFiles/obj_khaiii.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-mexjgnop-build/setup.py", line 95, in
cmdclass={'build': CustomBuild}
File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/usr/lib/python3.6/distutils/command/install.py", line 589, in run
self.run_command('build')
File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/pip-mexjgnop-build/setup.py", line 50, in run
subprocess.check_call('make -j all resource', cwd=build_dir, shell=True)
File "/usr/lib/python3.6/subprocess.py", line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'make -j all resource' returned non-zero exit status 2.

Command "/usr/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-mexjgnop-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).
read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-2d9iydhc-record/install-record.txt --single-version-externally-managed --compile" fa
iled with error code 1 in /tmp/pip-mexjgnop-build/

pip install . 실행시 위와 같은 오류가 발생하는데, 구글 찾아봐도 잘 안나오네요 ㅜㅜ

우분투 : 16.04 입니다

Cmake Error version 3.51

cmake .. CMake Error at CMakeLists.txt:1 (cmake_minimum_required): CMake 3.10 or higher is required. You are running version 3.5.1

3.51 버전에서 make 가 안됩니다.

Default log level should probably be warn for everything

For most users, the logs that come out of info level aren't very useful - in particular under Python when they can't nicely pipe it to a standard logging framework.

Would it make sense to make the default ("all", "warn") instead of info?

If the project owners agree with this I can send in a PR.

pip install . 시 아스키코드 오류

Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-oh1p5ix3-build/setup.py", line 78, in <module>
    long_description=readme(),
  File "/tmp/pip-oh1p5ix3-build/setup.py", line 68, in readme
    return open('/khaiii/README.md').read()
  File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xeb in position 18: ordinal not in range(128)

ubuntu : 16.04
python : 3.6.7
입니다.

이거 오류 해결방법 아시는 분 계신가요? 구글링 해도 딱 맞는 해결방법을 못찾겠네요

hunter 파일을 다운받는데 오류가 발생합니다.

bulid 폴더 안에서 cmake ..을 실행했을 때 이러한 오류가 발생합니다.
제가 컴퓨터 전공은 아니라서 제 작업 환경이 이게 맞는지 모르겠지만
GCP vm을 이용하고 있고 ubuntu 16.x 에서 실행했습니다.

-- [hunter] Initializing Hunter workspace (70287b1ffa810ee4e952052a9adff9b4856d0d54)
-- [hunter] https://github.com/ruslo/hunter/archive/v0.23.34.tar.gz
-- [hunter] -> /home/SAMSUNG/.hunter/_Base/Download/Hunter/0.23.34/70287b1
CMake Error at Build/Hunter-prefix/src/Hunter-stamp/download-Hunter.cmake:157 (message):
Each download failed!

error: downloading 'https://github.com/ruslo/hunter/archive/v0.23.34.tar.gz' failed
     status_code: 1
     status_string: "Unsupported protocol"
     log:
     --- LOG BEGIN ---
     Protocol "https" not supported or disabled in libcurl

Closing connection -1

     --- LOG END ---
     error: downloading 'https://github.com/ruslo/hunter/archive/v0.23.34.tar.gz' failed
     status_code: 1
     status_string: "Unsupported protocol"
     log:
     --- LOG BEGIN ---
     Protocol "https" not supported or disabled in libcurl

Closing connection -1

     --- LOG END ---
     error: downloading 'https://github.com/ruslo/hunter/archive/v0.23.34.tar.gz' failed
     status_code: 1
     status_string: "Unsupported protocol"
     log:
     --- LOG BEGIN ---
     Protocol "https" not supported or disabled in libcurl

Closing connection -1

     --- LOG END ---
     error: downloading 'https://github.com/ruslo/hunter/archive/v0.23.34.tar.gz' failed
     status_code: 1
     status_string: "Unsupported protocol"
     log:
     --- LOG BEGIN ---
     Protocol "https" not supported or disabled in libcurl

Closing connection -1

     --- LOG END ---
     error: downloading 'https://github.com/ruslo/hunter/archive/v0.23.34.tar.gz' failed
     status_code: 1
     status_string: "Unsupported protocol"
     log:
     --- LOG BEGIN ---
     Protocol "https" not supported or disabled in libcurl

Closing connection -1

     --- LOG END ---
     error: downloading 'https://github.com/ruslo/hunter/archive/v0.23.34.tar.gz' failed
     status_code: 1
     status_string: "Unsupported protocol"
     log:
     --- LOG BEGIN ---
     Protocol "https" not supported or disabled in libcurl

Closing connection -1

     --- LOG END ---

make[2]: *** [Hunter-prefix/src/Hunter-stamp/Hunter-download] Error 1
make[1]: *** [CMakeFiles/Hunter.dir/all] Error 2
make: *** [all] Error 2

[hunter ** INTERNAL **] Build project failed
[hunter ** INTERNAL **] [Directory:/home/SAMSUNG/khaiii]

------------------------------ WIKI -------------------------------
https://github.com/ruslo/hunter/wiki/error.internal

CMake Error at cmake/HunterGate.cmake:87 (message):
Call Stack (most recent call first):
cmake/HunterGate.cmake:97 (hunter_gate_wiki)
cmake/HunterGate.cmake:346 (hunter_gate_internal_error)
cmake/HunterGate.cmake:510 (hunter_gate_download)
CMakeLists.txt:8 (HunterGate)

-- Configuring incomplete, errors occurred!

사용자 사전 추가시 중복 문제 발생

image

사용자 사전을 추가할 때 preanal.auto 파일에 있는 단어들과 중복될 경우 오류가 발생합니다.
사용자가 추가한 사전에 우선 순위를 줄 수 있는 방법은 없나요?

PyTorch 최신 버전 학습 지원

현재까지는 PyTorch 0.4.1 버전에서 학습이 정상적으로 이루어지고, 최신 버전인 1.1.0에서는 성능이 많이 떨어지는 것으로 나오는데, 원인을 분석하고 최신 버전에서도 원활히 학습이 되도록 수정합니다.

Change default branch to develop

Based on the guidelines posted, it seems like it would be sensible to change GH’s project settings to have the default branch as develop.

In the build instructions you can point the users to checkout the master branch to make it the stable branch. This is strange, but considering most people just copy and paste build instructions this shouldn’t be that much extra work on the user’s end.

This isn’t optimal, but otherwise you’ll end up with PRs constantly being thrown against master - the unfortunate reality is that people do not read documentation carefully so preventing human errors systematically is easier.

A long term solution would be to have Travis CI triggers for lint/build/test so PRs have that information.

띄어쓰기 없는 경우 분석오류

$ echo "갤럭시케이스" | ./bin/khaiii --rsc-dir=./share/khaiii
갤럭시케이스	갤럭시/NNP + 케이스/NNG

$ echo "아이폰케이스" | ./bin/khaiii --rsc-dir=./share/khaiii
아이폰케이스	아/NNP + 이/NNG + 폰케/NNP + 이스/NNG

사용자 사전에 아이폰 을 등록해도 바람직한 결과는 안나오네요.

사용자사전등록+정확한 띄어쓰기 이어야 원하는 결과가 나오는데...
해결방법은 없을까요?

v3.0 khaiii.khaiii.KhaiiiExcept: fail to find library: libkhaiii.so 에러 발생.

ubuntu (xubuntu) 18 환경에서, 설치매뉴얼을 따라 테스트하였습니다.

파이썬 예제를 실행하면, libkhaiii.so 를 찾지 못하는 에러가 발생합니다.

(vmecab) daewon@daewon-xubi64:~/github/kakao/khaiii/build/package_python$ python
Python 3.6.7 (default, Oct 22 2018, 11:32:17) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from khaiii import KhaiiiApi
>>> api = KhaiiiApi()
ERROR:root:current working directory: /home/daewon/github/kakao/khaiii/build/package_python
ERROR:root:library directory: /home/daewon/github/kakao/khaiii/build/package_python/khaiii/lib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/daewon/github/kakao/khaiii/build/package_python/khaiii/khaiii.py", line 171, in __init__
    raise KhaiiiExcept('fail to find library: {}'.format(lib_name))
khaiii.khaiii.KhaiiiExcept: fail to find library: libkhaiii.so
>>> exit()

package_python/khaiii/lib 폴더가 없습니다. build 디렉토리에 있는 lib 폴더를 위 에러메시지의 위치로 복사하면 에러가 없어집니다.


(vmecab) daewon@daewon-xubi64:~/github/kakao/khaiii/build$ ll
합계 120
drwxr-xr-x 11 daewon daewon  4096  2월 21 16:31 ./
drwxr-xr-x 12 daewon daewon  4096  2월 21 15:25 ../
-rw-r--r--  1 daewon daewon 17245  2월 21 15:54 CMakeCache.txt
drwxr-xr-x 11 daewon daewon  4096  2월 21 16:30 CMakeFiles/
-rw-r--r--  1 daewon daewon  3582  2월 21 15:54 CPackConfig.cmake
-rw-r--r--  1 daewon daewon  3861  2월 21 15:54 CPackSourceConfig.cmake
-rw-r--r--  1 daewon daewon   422  2월 21 15:54 CTestTestfile.cmake
-rw-r--r--  1 daewon daewon 35924  2월 21 15:54 Makefile
drwxr-xr-x  3 daewon daewon  4096  2월 21 16:30 Testing/
drwxr-xr-x  3 daewon daewon  4096  2월 21 15:26 _3rdParty/
drwxr-xr-x  3 daewon daewon  4096  2월 21 16:31 _CPack_Packages/
drwxr-xr-x  2 daewon daewon  4096  2월 21 16:14 bin/
-rw-r--r--  1 daewon daewon  3909  2월 21 15:54 cmake_install.cmake
-rw-r--r--  1 root   root     802  2월 21 16:30 install_manifest.txt
drwxr-xr-x  2 daewon daewon  4096  2월 21 16:11 lib/
drwxr-xr-x  3 daewon daewon  4096  2월 21 16:31 package_python/
drwxr-xr-x  3 daewon daewon  4096  2월 21 16:23 share/
drwxr-xr-x  2 daewon daewon  4096  2월 21 16:22 test/
(vmecab) daewon@daewon-xubi64:~/github/kakao/khaiii/build$ cp -r lib package_python/khaiii
(vmecab) daewon@daewon-xubi64:~/github/kakao/khaiii/build$ python 
Python 3.6.7 (default, Oct 22 2018, 11:32:17) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from khaiii import KhaiiiApi
>>> api = KhaiiiApi()
>>> 

설치시 특이사항으로는 (관련이 있는지는 모르겠지만), 시스템 기본 파이썬에 설치한 것이 아니고, venv 로 생성한 가상환경에 설치한 것입니다. 설치메뉴얼에선 pip install cmake 라고 나와 있었지만, sudo apt-get install cmake 로 cmake 를 설치하였습니다. 오늘 (19년 2월 21일) git clone 으로 받은 소스로 테스트하였습니다.

문의 드립니다.

한 문장에서 api.analyze 를 통해 명사만 뽑고 싶은데..방법이 있을런지요?
질문을 어디에 하는지 몰라 여기에 문의 드립니다.

띄어쓰기 모델과 함께 Multi-task 학습 실험

음절 기반으로 convolution 부분을 공유하고 마지막 fully connected layer만 다르게 하여 띄어쓰기(공백)를 분류하는 모델과, 형태소 태그를 분류하는 모델을 multi-task learning을 적용하여 한꺼번에 학습할 수 있지 않을까 생각합니다.

v0.2 긴급 패치

오늘 배포한 0.2 버전에 두가지 문제가 있어 긴급 패치를 합니다.

  1. 이슈 #10 pytorch 의존성을 제거했다고 생각했는데 하나의 모듈에 남은 부분이 있어 이를 수정합니다.
  2. 코드 내 버전이 0.1인 채로 배포가 되어 라이브러리가 libkhaiii.so.0.1로 생성됩니다.

두 부분을 수정하고 v0.2 태그를 옮기는 긴급 조치를 실행합니다. 혹시 불편을 겪으신 분이 계시다면 죄송합니다.

형태소 합성 관련

안녕하세요
형태소 합성, 즉 분석된 형태소 열을 원문장으로 복원하는 방법이 궁금한데요
혹시 참고할만한 방법이나 프로그램을 알려주시면 감사하겠습니다.

테스트 질문 : 디렉토리 디/NNG + 렉터리/NNG

1️⃣ 다음과 같은 빌드 설명서에 있는 문장을 실행해 보았습니다.

실행 프로그램과 리소스가 준비되면 build 디렉터리 아래에서 다음과 같이 실행해 봅니다.

2️⃣ 결과는 다음과 같습니다.

실행    실행/NNG
프로그램과      프로그램/NNG + 과/JC
리소스가        리소스/NNP + 가/JKS
준비되면        준비/NNG + 되/XSV + 면/EC
build   build/SL
디렉터리        디/NNG + 렉터리/NNG
아래에서        아래/NNG + 에서/JKB
다음과  다음/NNG + 과/JKB
같이    같이/MAG
실행해  실행/NNG + 하/XSV + 여/EC
봅니다. 보/VX + ㅂ니다/EF + ./SF

❓ 디렉토리가 디/NNG + 렉터리/NNG 로 분석되는 것이 맞나요?

doc 디렉토리의 내용을 docs로 이동

pull request 템플릿은 docs 디렉토리 아래에 있어야 적용이 됩니다. 덕분에 doc, docs 두개의 디렉토리가 되어 버렸는데, doc 아래의 내용을 docs로 이동하고 doc 디렉토리를 삭제합니다.

리눅스나 맥에서만 정상 작동된다는 사실을 명시해주시는게 어떨까요?

어제 윈도우 파워쉘로 빌드를 하려다가 실패를 했는데요.

지난 이슈들을 검색해보니 저 말고도 같은 시도를 하셨던 분들이 있는 듯 합니다.

cmake, gcc 등의 툴이 윈도우에서도 쓸 수 있다보니 문서를 읽을 때에는 윈도우에서 작동되지 않을거라는 생각이 들지 않았습니다.

빌드 및 실행 문서나 readme에 명시해주시면 안 될까요?

cmake .. 에서 발생하는 hunter 오류 질문입니다

C:\Users\Yae Gwon\khaiii\build>cmake ..
-- [hunter] Initializing Hunter workspace (70287b1ffa810ee4e952052a9adff9b4856d0d54)
-- [hunter] https://github.com/ruslo/hunter/archive/v0.23.34.tar.gz
-- [hunter] -> C:/.hunter/_Base/Download/Hunter/0.23.34/70287b1
지정된 파일을 찾을 수 없습니다
CMake Error: Generator: execution of make failed. Make command was: "nmake" "/nologo"

[hunter ** INTERNAL **] Build project failed
[hunter ** INTERNAL **] [Directory:C:/Users/Yae Gwon]

------------------------------ WIKI -------------------------------
https://github.com/ruslo/hunter/wiki/error.internal

CMake Error at cmake/HunterGate.cmake:87 (message):
Call Stack (most recent call first):
cmake/HunterGate.cmake:97 (hunter_gate_wiki)
cmake/HunterGate.cmake:346 (hunter_gate_internal_error)
cmake/HunterGate.cmake:510 (hunter_gate_download)
CMakeLists.txt:8 (HunterGate)

-- Configuring incomplete, errors occurred!

위와 같은 오류가 발생하는데

아무리 구글링을 해봐도 모르겠습니다..

환경변수를 잘못 설정한 것인지 hunter라는걸 사용해보지 않아서 잘 모르겠습니다..

도와주시면 감사하겠습니다!!

공백 음절의 임베딩을 더하는 모델 실험

현재 모델은 공백 음절도 다른 음절과 동일하게 문맥에서 하나의 음절로 위치를 차지하고 있는데, 이렇게 하지 않고 어절의 좌/우 경계에 해당하는 음절에 각각 ""와 "" 가상 음절의 임베딩을 elementwise로 더하는 것으로 실험을 해보려 합니다. 이 모델의 성능이 기존 모델과 비슷한 성능을 나타낸다면, 이때 공백 음절을 더할 때 dropout을 적용해 보려고 합니다. 그러면 기존에 dropout에 따라 공백이 들어가거나 빠지면서 위치도 들쑥날쑥해지는 문제도 해결할 수 있지 않을까 생각합니다.

CNN 모델 학습시 Error

........./kh2/khaiii/train# ./map_char_to_tag.py -c corpus --output corestore-dic restore.dic
Traceback (most recent call last):
File "./map_char_to_tag.py", line 23, in
from khaiii.munjong.sejong_corpus import Sentence, sents, Word
ImportError: No module named 'khaiii'

무엇이 문제인지 모르겠습니다.

알 수 없는 KhaiiiExcept가 발생합니다.

안녕하세요.

khaiii ver 0.3을 사용하고 있는데요. 다른 텍스트 파일들은 잘되는데, 한국어 위키피디아 텍스트에 대해서만 계속해서 KhaiiiExcept가 발생합니다.

해당 텍스트 라인은 이렇습니다.

"이런 상황에서 정몽준의 국민통합21에 입당하기 위한 김민석의 탈당은 노무현에게 반전의 계기가 되었다."

그리고 실행할때마다 전에 되던 라인에서 다시 죽을 때도 있고, 아닐 때도 있습니다.

데이터와 코드는 보안상 이슈로 공개할 수 없어 직접 타이핑하여 대신 공유합니다.
screen shot 2019-02-18 at 1 29 31 pm

from khaiii import KhaiiiApi

morph_analyzed_corpus_list = []
api = KhaiiiApi()

for idx in tqdm_notebook(range(len(corpus_list))):
line = corpus_list[idx]
temp = api.analyze(line)
morph_analyzed_corpus_list.append(temp)

==============================================
시스템 상황은,

ubuntu 16.04
Anaconda 4.5.12
python3.7
khaiii 0.3

입니다. 다른 정보가 더 필요하시면 추가로 공유하겠습니다.

pip install . 오류

Processing /data/khaiii/build/package_python
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-req-build-oaZYzh/setup.py", line 45
with zipfile.ZipFile(f'{_SRC_NAME}.zip', 'r') as src_zip:
^
SyntaxError: invalid syntax

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-req-build-oaZYzh/

Installing Python package clobbers installed Pytorch

As I understand the build process, it seems like the Python bindings do not necessarily have to depend on Pytorch, as it's used only for building the resources.

At the moment installing through setup.py clobbers the current environment's installed Pytorch to 0.4.1, which seems like a dealbreaker for anyone who wants to use this package as part of their analytics pipeline, who also uses Pytorch. (which, most likely is going to be a more recent version)

It feels like there are two ways forward for this:

  1. Only require Pytorch for the build process, remove dependency from bindings and possibly make the resource builder another package that does depend on it. (this would allow users to split environments, which is suboptimal but worse than overwriting the installed version)
  2. Respect and try to make use of whatever Pytorch version the user has.

2 seems like a bumpy road forward considering the stability of the API. Another option would be to have pre-built models as downloadable static resources so users don't have to deal with the resource building process - it does feel like something only seasoned users would be interested in.

Python binding construction/deconstruction non-idiomatic

The current initialization pattern looks like this:

import khaiii
api = khaiii.KhaiiiApi()
api.open()

Which effectively feels like a double construct. The issue is minor, but doesn't feel like idiomatic Python. Since calling the constructor is a contract that implies the caller is willing to do have the object ready, the second open() call feels rather odd. Same applies for the destructor, although this would be less of an issue since delete semantics are consistent and for most of the part the magical close() function will be obstructed away from the user.

What if, for example it worked like this by folding the two constructs into one?

from khaii import Khaiii
k = Khaii(library_path: str = '', resource_directory: str = '', options: dict = {})

khaiii.khaiii.KhaiiiExcept: resource directory not found 에러가 뜹니다.

https://github.com/kakao/khaiii/blob/master/doc/setup.md
여기 있는 페이지처럼 설치를 하고 python에서 import 까지 잘 되었는데요,

khaiii.khaiii.KhaiiiExcept: resource directory not found: /Users/Helianthus/khaiii-master/build/package_python/khaiii/share/khaiii

이런 에러가 뜹니다.

그래서 build/package_python/khaiii 폴더에 보니 share폴더가 없더라구요
build/share 폴더를 build/package_python/khaiii에 폭사해서 넣으니 잘 동작하는 것 확인했습니다.

혹시 빌드하는 곳에서 해당 파일이 잘 복사가 안되는 것 같은데 확인해주시면 감사하겠습니다.

python에서 실행결과와 ./bin/khaiii의 출력 결과가 다릅니다.

'게바라는 이때 결심했다고 한다.'
이문장을 python코드를 통해 분석하면

from khaiii import KhaiiiApi
api = KhaiiiApi()
for word in api.analyze('게바라는 이때 결심했다고 한다.'):
    print(word)

아래와 같이 출력됩니다.

게바라는 게/NNP + 바/NNG + 라는/ETM
이때 이때/NNG
결심했다고 결심/NNG + 하/XSV + 였/EP + 다고/EC
한다. 하/VV + ㄴ다/EF + ./SF

하지만, build/bin/khaiii를 실행하고 같은 문장을 입력하면 아래와 같이 출력됩니다.

게바라는 게바라/NNP + 는/JX
이때 이때/NNG
결심했다고 결심/NNG + 하/XSV + 였/EP + 다고/EC
한다. 하/VV + ㄴ다/EF + ./SF

'게바라'를 '게바'로 줄여서 입력해봐도 둘의 결과가 다릅니다.

python

게바는 게/NNG + 바/NNP + 는/JX
이때 이때/NNG
결심했다고 결심/NNG + 하/XSV + 였/EP + 다고/EC
한다. 하/VV + ㄴ다/EF + ./SF

bin

게바는 게바/NNP + 는/JX
이때 이때/NNG
결심했다고 결심/NNG + 하/XSV + 였/EP + 다고/EC
한다. 하/VV + ㄴ다/EF + ./SF

'게바라'를 '체게바라'로 줄여서 입력해봐도 둘의 결과가 다릅니다.

python

체게바라는 체/NNG + 게/NNP + 바/NNG + 이/VCP + 라는/ETM
이때 이때/NNG
결심했다고 결심/NNG + 하/XSV + 였/EP + 다고/EC
한다. 하/VV + ㄴ다/EF + ./SF

bin

체게바라는 체게바라/NNP + 는/JX
이때 이때/NNG
결심했다고 결심/NNG + 하/XSV + 였/EP + 다고/EC
한다. 하/VV + ㄴ다/EF + ./SF

flask restful server 대용량 KhaiiiApi 요청 시 메모리 누수 문의

flask 프레임워크를 이용하여 웹 서비스형태로 카이를 사용하고자 하였습니다.
아래 형태로 구성하여 사용 중인데 지속적으로 웹 요청 발생 시 메모리가 감소 없이
증가만 되고 있습니다. 결국에는 메모리 오버플로우를 발생시키는데 혹시
아래코드에 문제가 있을까요?

from flask import Flask, jsonify
from flask import Response
from collections import OrderedDict
from flask_cors import CORS
from flask_json import FlaskJSON, JsonError, json_response, as_json
from flask_restful import Resource, Api
from flask_restful import reqparse
from khaiii import KhaiiiApi
import logging
import gc

app = Flask(name)
api = Api(app)
app.debug = False
app.logger.disabled = True
log = logging.getLogger('werkzeug')
log.disabled = True

cors = CORS(app, resources={r"/analyze/": {"origin": ""}})

class Khaiii_Analyze(Resource):
def get(self):
try:
json = FlaskJSON(app)
json.init_app(app)

        parser = reqparse.RequestParser()
        parser.add_argument('keyword', type=str)
        args = parser.parse_args()

        khaiii_api = KhaiiiApi()
        khaiii_api.open()

        arr_word = khaiii_api.analyze(args['keyword'])
        result_word = []

        for idx in range(len(arr_word)):
             s = str(arr_word[idx])
             wordList = {'word': s}
             result_word.append(wordList)
             del(wordList)
             del(s)
             wordList = None
             s = None

        del(arr_word)
        del(parser)
        del(args)
        json_iter = iter(result_word)
        del(result_word)
        khaiii_api.close()
        del(khaiii_api)
        arr_word = None
        result_word = None
        khaiii_api = None

        json_str = json_response(items=json_iter, headers_={'content_type': 'application/json; charset=utf-8'})
        del(json)
        json = None
        gc.collect()

        return json_str

    except Exception as e:
        return {'Error': str(e)}

api.add_resource(Khaiii_Analyze, '/analyze')

if name == 'main':

음성인식 결과를 발음표기대로 산출할 수 있을까요?

안녕하세요. 초보라 도움을 구합니다. 음성인식을 이용하면 발음이 아니라 맞춤법에 따라 변환되어 결과를 제시하는데요. 예를 들어 /닭고기/는 발음상 [닥꼬기]로 실현되지만 STT를 활용하면 결과가 /닭고기/로 나타납니다. 저는 발음 그대로 산출해주는 게 필요한데요. 혹시 이렇게 하는 게 가능할까요? 저의 짧은 생각으로는 음성 전처리 부분에서 입력값을 사전에 있는 어휘로 바꾸는 것 같은데,,, 도와주세요,, ㅜㅜ

make resource 가 동작을 안합니다.

기분석사전 파일 preanal.manual2 파일을 추가하고
make resource를 하면 어떤 경우는 동작하는데

아래 한문장만 나오고 동작하지 않는 경우가 있습니다.
Built target resource
원인이 무엇일까요?

ModuleNotFoundError 발생

windows에서 우분투 앱을 사용해서 해보고 있는데(Windows에서 안 된다고 해주셨지만 우분투앱으로 가능한지 궁금해서...) Import 과정에서 다음과 같은 오류가 발생합니다.

ModuleNotFoundError: No module named 'khaiii.munjong'

echo $PYTHONPATH
/mnt/c/User/solugate/Desktop/test/khaiii/src/main/python

OS: Windows10
UbuntuApp: Ubuntu 18.04.1 LTS
gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
Python 3.6.7

make 오류

윈도우 환경에서 다음과 같은 오류가 생깁니다.

make: *** 타겟 `all'를 만들 규칙이 없음.  멈춤.

cmake .. 코드는 다 돌아갔고, makefile이 정상적으로 생기지 못한 것 같은데 해결을 못하겠네요...
혹시 몰라 \khaiii-master\build\CMakeFiles\CMakeError.log 내용 첨부합니다.

Performing C++ SOURCE FILE Test fma_compiles failed with the following output:
Change Dir: C:/Users/User/Downloads/khaiii-master/khaiii-master/build/CMakeFiles/CMakeTmp

Run Build Command:"C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe" "cmTC_f9ad4.vcxproj" "/p:Configuration=Debug" "/p:VisualStudioVersion=14.0"
Microsoft (R) Build Engine 버전 14.0.25420.1]

Copyright (C) Microsoft Corporation. All rights reserved.



빌드 시작: 2018-12-06 오전 5:29:47

1 노드의 "C:\Users\User\Downloads\khaiii-master\khaiii-master\build\CMakeFiles\CMakeTmp\cmTC_f9ad4.vcxproj" 프로젝트(기본 대상)입니다.

PrepareForBuild:

  "cmTC_f9ad4.dir\Debug\" 디렉터리를 만들고 있습니다.

  "C:\Users\User\Downloads\khaiii-master\khaiii-master\build\CMakeFiles\CMakeTmp\Debug\" 디렉터리를 만들고 있습니다.

  "cmTC_f9ad4.dir\Debug\cmTC_f9ad4.tlog\" 디렉터리를 만들고 있습니다.

InitializeBuildStatus:

  "AlwaysCreate"이(가) 지정되었기 때문에 "cmTC_f9ad4.dir\Debug\cmTC_f9ad4.tlog\unsuccessfulbuild"을(를) 만들고 있습니다.

ClCompile:

  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\CL.exe /c /Zi /W3 /WX- /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D fma_compiles /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo"cmTC_f9ad4.dir\Debug\\" /Fd"cmTC_f9ad4.dir\Debug\vc140.pdb" /Gd /TP /analyze- /errorReport:queue  -mfma "C:\Users\User\Downloads\khaiii-master\khaiii-master\build\CMakeFiles\CMakeTmp\src.cxx"

  x86용 Microsoft (R) C/C++ 최적화 컴파일러 버전 19.00.24215.1

  Copyright (c) Microsoft Corporation. All rights reserved.

  

  cl /c /Zi /W3 /WX- /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D fma_compiles /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo"cmTC_f9ad4.dir\Debug\\" /Fd"cmTC_f9ad4.dir\Debug\vc140.pdb" /Gd /TP /analyze- /errorReport:queue  -mfma "C:\Users\User\Downloads\khaiii-master\khaiii-master\build\CMakeFiles\CMakeTmp\src.cxx"

  

cl : 명령줄 warning D9002: 알 수 없는 '-mfma' 옵션을 무시합니다. [C:\Users\User\Downloads\khaiii-master\khaiii-master\build\CMakeFiles\CMakeTmp\cmTC_f9ad4.vcxproj]

  src.cxx

Link:

  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\link.exe /ERRORREPORT:QUEUE /OUT:"C:\Users\User\Downloads\khaiii-master\khaiii-master\build\CMakeFiles\CMakeTmp\Debug\cmTC_f9ad4.exe" /INCREMENTAL /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:/Users/User/Downloads/khaiii-master/khaiii-master/build/CMakeFiles/CMakeTmp/Debug/cmTC_f9ad4.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:/Users/User/Downloads/khaiii-master/khaiii-master/build/CMakeFiles/CMakeTmp/Debug/cmTC_f9ad4.lib" /MACHINE:X86 /SAFESEH  /machine:X86 cmTC_f9ad4.dir\Debug\src.obj

  cmTC_f9ad4.vcxproj -> C:\Users\User\Downloads\khaiii-master\khaiii-master\build\CMakeFiles\CMakeTmp\Debug\cmTC_f9ad4.exe

  cmTC_f9ad4.vcxproj -> C:/Users/User/Downloads/khaiii-master/khaiii-master/build/CMakeFiles/CMakeTmp/Debug/cmTC_f9ad4.pdb (Full PDB)

FinalizeBuildStatus:

  "cmTC_f9ad4.dir\Debug\cmTC_f9ad4.tlog\unsuccessfulbuild" 파일을 삭제하고 있습니다.

  "cmTC_f9ad4.dir\Debug\cmTC_f9ad4.tlog\cmTC_f9ad4.lastbuildstate"에 연결(touching)하고 있습니다.

"C:\Users\User\Downloads\khaiii-master\khaiii-master\build\CMakeFiles\CMakeTmp\cmTC_f9ad4.vcxproj" 프로젝트를 빌드했습니다(기본 대상).



빌드했습니다.



"C:\Users\User\Downloads\khaiii-master\khaiii-master\build\CMakeFiles\CMakeTmp\cmTC_f9ad4.vcxproj"(기본 대상)(1)->

(ClCompile 대상) -> 

  cl : 명령줄 warning D9002: 알 수 없는 '-mfma' 옵션을 무시합니다. [C:\Users\User\Downloads\khaiii-master\khaiii-master\build\CMakeFiles\CMakeTmp\cmTC_f9ad4.vcxproj]



    경고 1개

    오류 0개



경과 시간: 00:00:02.53


Source file was:
int main() { return 0; }
Determining if the include file pthread.h exists failed with the following output:
Change Dir: C:/Users/User/Downloads/khaiii-master/khaiii-master/build/CMakeFiles/CMakeTmp

Run Build Command:"C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe" "cmTC_472e3.vcxproj" "/p:Configuration=Debug" "/p:VisualStudioVersion=14.0"
Microsoft (R) Build Engine 버전 14.0.25420.1]

Copyright (C) Microsoft Corporation. All rights reserved.



빌드 시작: 2018-12-06 오전 6:18:15

1 노드의 "C:\Users\User\Downloads\khaiii-master\khaiii-master\build\CMakeFiles\CMakeTmp\cmTC_472e3.vcxproj" 프로젝트(기본 대상)입니다.

PrepareForBuild:

  "cmTC_472e3.dir\Debug\" 디렉터리를 만들고 있습니다.

  "C:\Users\User\Downloads\khaiii-master\khaiii-master\build\CMakeFiles\CMakeTmp\Debug\" 디렉터리를 만들고 있습니다.

  "cmTC_472e3.dir\Debug\cmTC_472e3.tlog\" 디렉터리를 만들고 있습니다.

InitializeBuildStatus:

  "AlwaysCreate"이(가) 지정되었기 때문에 "cmTC_472e3.dir\Debug\cmTC_472e3.tlog\unsuccessfulbuild"을(를) 만들고 있습니다.

ClCompile:

  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\CL.exe /c /Zi /W3 /WX- /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_472e3.dir\Debug\\" /Fd"cmTC_472e3.dir\Debug\vc140.pdb" /Gd /TC /analyze- /errorReport:queue "C:\Users\User\Downloads\khaiii-master\khaiii-master\build\CMakeFiles\CMakeTmp\CheckIncludeFile.c"

  x86용 Microsoft (R) C/C++ 최적화 컴파일러 버전 19.00.24215.1

  Copyright (c) Microsoft Corporation. All rights reserved.

  

  cl /c /Zi /W3 /WX- /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_472e3.dir\Debug\\" /Fd"cmTC_472e3.dir\Debug\vc140.pdb" /Gd /TC /analyze- /errorReport:queue "C:\Users\User\Downloads\khaiii-master\khaiii-master\build\CMakeFiles\CMakeTmp\CheckIncludeFile.c"

  

  CheckIncludeFile.c

C:\Users\User\Downloads\khaiii-master\khaiii-master\build\CMakeFiles\CMakeTmp\CheckIncludeFile.c(1): fatal error C1083: 포함 파일을 열 수 없습니다. 'pthread.h': No such file or directory [C:\Users\User\Downloads\khaiii-master\khaiii-master\build\CMakeFiles\CMakeTmp\cmTC_472e3.vcxproj]

"C:\Users\User\Downloads\khaiii-master\khaiii-master\build\CMakeFiles\CMakeTmp\cmTC_472e3.vcxproj" 프로젝트를 빌드했습니다(기본 대상). - 실패



빌드하지 못했습니다.



"C:\Users\User\Downloads\khaiii-master\khaiii-master\build\CMakeFiles\CMakeTmp\cmTC_472e3.vcxproj"(기본 대상)(1)->

(ClCompile 대상) -> 

  C:\Users\User\Downloads\khaiii-master\khaiii-master\build\CMakeFiles\CMakeTmp\CheckIncludeFile.c(1): fatal error C1083: 포함 파일을 열 수 없습니다. 'pthread.h': No such file or directory [C:\Users\User\Downloads\khaiii-master\khaiii-master\build\CMakeFiles\CMakeTmp\cmTC_472e3.vcxproj]



    경고 0개

    오류 1개



경과 시간: 00:00:01.36

CMake Error: The source directory "/tmp/pip-xxxx-build/khaiii-0.4" does not appear to contain CMakeLists.txt.

python package 설치를 위해 pip3 install . 명령을 실행하면 다음과 같은 오류가 나타납니다.

user@host:~/khaiii/build/package_python$ pip3 install .
Processing /khaiii_build/khaiii/build/package_python
Installing collected packages: khaiii
  Running setup.py install for khaiii ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-478gf4ho-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-bm0ekidn-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    running install
    running build
    CMake Error: The source directory "/tmp/pip-478gf4ho-build/khaiii-0.4" does not appear to contain CMakeLists.txt.
    Specify --help for usage, or press the help button on the CMake GUI.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-478gf4ho-build/setup.py", line 94, in <module>
        cmdclass={'build': CustomBuild}
      File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/lib/python3.6/distutils/command/install.py", line 589, in run
        self.run_command('build')
      File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/pip-478gf4ho-build/setup.py", line 49, in run
        subprocess.check_call('cmake ..', cwd=build_dir, shell=True)
      File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command 'cmake ..' returned non-zero exit status 1.

    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-478gf4ho-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-bm0ekidn-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-478gf4ho-build/

사용 환경은 다음과 같습니다.

  • OS : Ubuntu 18.04
  • GCC : 7.4.0
  • CMake : 3.13.3
  • Python : 3.6.8
  • pip : 9.0.1

base 모델과 large 모델의 분석 속도가 거의 동일합니다.

공개된 문서에 따르면 Base 모델과 Large 모델의 속도는 약 7.5배 정도의 차이가 있습니다.
제 서버에서 형태소 분석 속도를 측정해 보고 싶어, 약 1000개의 문장을 임의로 선정하여 테스트를 해보았는데요, 아래와 같이 속도가 유사합니다. (기분석을 제거한 경우는 설정을 몰라 preanal.auto 안에 내용을 모두 삭제한 후 재빌드하였습니다. )

Khaiii_Base(기분석 X) : 1.1763
Khaiii_Large(기분석 X) : 1.173
Khaiii_Base : 0.886
Khaiii_Large : 0.885

share/khaiii 폴더의 모델 파일로 짐작되는 파일들이 크기가 다른 것으로 봤을땐, 리소스는 제대로 적용 된것같은데,
(Base)
image
(Large)
image

속도가 거의 동일하게 측정 된 것이 이상하여 문의드립니다.

[제안]원본 코퍼스를 수정하는 코드를 배포하는 것으로 말뭉치를 공유하는 방법

안녕하세요, 좋은 내용 공유해주셔서 감사합니다.

저는 부족한 개인자원으로 한글 데이터 공유를 위한 단체인 ForkonLP를 운영하고 있는 박찬엽입니다.

코퍼스 공유 문제에 대해서, 언급하신 내용과 국립국어원의 답변을 잘 보았습니다.
현 상황에 대해서 음성 자료의 경우에서는 기본 자료를 수정하는 코드를 공유해주시는 사례를 보았습니다.

혹시 가능하시다면 세종 코퍼스의 카카오 내부 변환 또한 같은 방식을 사용할 수 있지 않을까 제안해봅니다.

원자료의 수정된 버전을 배포하는 것 또한 효율적인 방법이겠으나, 저작권이 특히 문제가 된다면 고려해볼 수 있지 않을까 생각합니다.

현재 원본 코퍼스 자체를 재배포하는 것은 대부분의 형태 분석 말뭉치가 채택하고 있는 cc-by-nc-nd를 볼 때 가능합니다.

국립국어원>데이터베이스 자료 > 말뭉치 파일

위 저작권은 저작권 표시, 비영리, 원본그대로 공유시 **복제, 배포, 전시, 공연 및 공중송신 (포맷 변경도 포함)**를 허용하고 있습니다.

포맷 변경 또한 내용의 변경이 없다면 허용하고 있기 때문에, 카카오 내의 코퍼스 배포는 아래 배포방법으로 가능해 보입니다.

  1. 원본 코퍼스의 재배포
  2. 재배포 부분에서의 다운로드 코드 공개
  3. 원본 코퍼스의 수정 코드 공개
  4. 자체 제작 코퍼스의 공개

카카오측의 적극적인 검토 부탁드립니다.

감사합니다.

p.s 모든 형태소 분석 코퍼스가 위의 라이선스를 따르는지는 확인하지 않았습니다. 의사가 있으시다면, 전수 조사하겠습니다.

make resource 에서 오류 발생

오류

 File "./bin/compile_model.py", line 40
    file_path = f'{rsc_src}/{model_size}.config.json'
                                                    ^
SyntaxError: invalid syntax

Makefile:37: '/home/storage/build/khaiii/build/share/khaiii/config.json' 타겟에 대한 명령이 실패했습니다
make[4]: *** [/home/storage/build/khaiii/build/share/khaiii/config.json] 오류 1
CMakeFiles/resource.dir/build.make:57: 'CMakeFiles/resource' 타겟에 대한 명령이 실패했습니다
make[3]: *** [CMakeFiles/resource] 오류 2
CMakeFiles/Makefile2:284: 'CMakeFiles/resource.dir/all' 타겟에 대한 명령이 실패했습니다
make[2]: *** [CMakeFiles/resource.dir/all] 오류 2
CMakeFiles/Makefile2:291: 'CMakeFiles/resource.dir/rule' 타겟에 대한 명령이 실패했습니다
make[1]: *** [CMakeFiles/resource.dir/rule] 오류 2
Makefile:275: 'resource' 타겟에 대한 명령이 실패했습니다
make: *** [resource] 오류 2

make all 까지 100% 진행이 다 되고
bin/khaiii 생성되고
build/khaiii/share/khaiii 폴더 밑에는 아무것도 없습니다.

파이썬 버전과 requirement에 버전은 전부 확인했는데 이상없었습니다.

환경은 linux, docker container 내부에서 git clone하여 실행시켰습니다.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.