{"id":35460896,"url":"https://github.com/okikirmui/nkhandic","last_synced_at":"2026-03-07T06:06:03.180Z","repository":{"id":258222619,"uuid":"784300116","full_name":"okikirmui/nkhandic","owner":"okikirmui","description":"NK-HanDic: morphological analysis dictionary for North Korean language","archived":false,"fork":false,"pushed_at":"2026-03-03T14:35:05.000Z","size":239389,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-03T17:48:28.434Z","etag":null,"topics":["dictionary","korean-text-processing","mecab","morphological-analysis","north-korean-language"],"latest_commit_sha":null,"homepage":"https://porocise.sakura.ne.jp/wiki/korean/mecab","language":"Perl","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/okikirmui.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-04-09T15:22:32.000Z","updated_at":"2026-03-03T14:35:13.000Z","dependencies_parsed_at":"2024-10-18T03:27:26.824Z","dependency_job_id":"81bae4f1-f786-4e3c-9ff7-98506a3f63f4","html_url":"https://github.com/okikirmui/nkhandic","commit_stats":null,"previous_names":["okikirmui/nkhandic"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/okikirmui/nkhandic","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okikirmui%2Fnkhandic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okikirmui%2Fnkhandic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okikirmui%2Fnkhandic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okikirmui%2Fnkhandic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/okikirmui","download_url":"https://codeload.github.com/okikirmui/nkhandic/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/okikirmui%2Fnkhandic/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30208819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T05:23:27.321Z","status":"ssl_error","status_checked_at":"2026-03-07T05:00:17.256Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dictionary","korean-text-processing","mecab","morphological-analysis","north-korean-language"],"created_at":"2026-01-03T08:08:47.510Z","updated_at":"2026-03-07T06:06:03.171Z","avatar_url":"https://github.com/okikirmui.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NK-HanDic: morphological analysis dictionary for North Korean language\n\n日本語Readme: [README_ja.md](README_ja.md)\n\nNK-HanDic(북한딕)은 형태소 분석 엔진 [MeCab](https://taku910.github.io/mecab/)(메카부)로 북한의 언어(조선어)를 분석하기 위해 개발된 분석 사전입니다.\n22만 개가 넘는 항목으로 구성되어 있고, 로동신문이나 북한 소설 등 문어를 중심으로 한 데이터로 학습, 구축되었습니다.\n\n저작권 문제로 학습 데이터 자체는 공개하지 않지만 모델 파일은 패키지에 포함되어 있습니다.\n\n## Quick Start(Python / pip)\n\nPython 패키지 **`nkhandic`** 을 사용하면 **사전 파일 구축 없이 바로 형태소 분석을 시작**할 수 있습니다. \n\n### 패키지 설치\n\n```bash\npip install nkhandic mecab-python3 jamotools\n```\n\n### 형태소 분석 예제\n\n```python\nimport nkhandic\n\ntext = \"우리의 경애하는 총비서동지께서는 어쩌면 그리도 위대하신가.\"\n\nprint(nkhandic.pos_tag(text))\nprint(nkhandic.tokenize_hangul(text, mode=\"surface\"))\nprint(nkhandic.convert_text_to_hanja_hangul(text))\n```\n\n**출력 결과**\n\n```python\n[('우리03', 'NP'), ('의10', 'JKG'), ('경애01', 'NNG'), ('하다02', 'XSV'), ('는03', 'ETM'), ('총비서', 'NNG'), ('동지006', 'NNG'), ('께서', 'JKS'), ('는01', 'JX'), ('어쩌면', 'MAG'), ('그리도', 'MAG'), ('위대02', 'XR'), ('하다02', 'XSA'), ('시', 'EP'), ('ㄴ가', 'EF'), ('.', 'SF')]\n['우리', '의', '경애', '하', '는', '총비서', '동지', '께서', '는', '어쩌면', '그리도', '위대', '하', '시', 'ㄴ가', '.']\n우리의 敬愛하는 總秘書同志께서는 어쩌면 그리도 偉大하신가.\n```\n\n### Python 패키지 (`nkhandic`)\n\n- PyPI: https://pypi.org/project/nkhandic/\n- MeCab Python 래퍼(`mecab-python3`), 한글 처리 페키지(`jamotools`)와 함께 사용\n\n## Dictionary Build\n\nPython을 사용하지 않을 경우, 로컬에서 MeCab으로 형태소 분석 처리를 할 경우에는 분석용 binary dictionary를 구축할 필요가 있습니다.\n\n### Requirements\n\n  - MeCab\n  - Python or Perl\n\n\u003e ⚠️ **중요**\n\u003e\n\u003e NK-HanDic은 **완성형 한글을 입력으로 사용하지 않습니다.**  \n\u003e 형태소 분석을 하기 전에 **반드시 Jamo(자모) 단위로 분해된 문자열**을 입력으로 사용해야 합니다.\n\u003e\n\u003e 자모 변환을 거치지 않은 입력에 대해서는 정상적인 분석 결과를 보장하지 않습니다.\n\n### 사전 빌드 절차(요약)\n\n`mecab-dict-index`, `mecab-dict-gen` 등의 위치는 `mecab-config --libexecdir`의 출력을 참조하십시오.\n아래에서는 `/usr/local/libexec/mecab`에 있다고 가정.\n\n```bash\n# git clone\ngit clone https://github.com/okikirmui/nkhandic.git\ncd handic\n# 색인\n/usr/local/libexec/mecab/mecab-dict-index -f utf8 -t utf8\n# 기학습 모델 파일 model을 사용하여 binary 사전 구축\n# /usr/local/lib/mecab/dic/nkhandic 디렉토리에 출력\n/usr/local/libexec/mecab/mecab-dict-gen -o /usr/local/lib/mecab/dic/nkhandic -m model\n# 배포용 사전 구축\n$ cd /usr/local/lib/mecab/dic/nkhandic\n$ /usr/local/libexec/mecab/mecab-dict-index -f utf8 -t utf8\n```\n\n분석할 때 실제로 필요한 파일은 `char.bin`, `dicrc`, `matrix.bin`, `sys.dic`, `unk.dic`입니다.\n\n\n## Usage\n\n### 실행시 사전을 지정\n\nMeCab를 실행할 때 `-d` 옵션으로 사전 파일이 포함된 디렉토리를 지정할 수 있습니다.\n\n```bash\n$ mecab -d /usr/local/lib/mecab/dic/nkhandic\n```\n\n위 방법으로는 실행할 때마다 사전을 지정할 필요가 있습니다.\n\n### 설정 파일에 사전 경로 기술\n\n홈 디렉토리에 `.mecabrc` 파일을 작성하여 `dicdir`에 HanDic 사전 파일이 포함된 디렉토리 경로를 기술할 수 있습니다.\n\n```text\ndicdir = /usr/local/lib/mecab/dic/nkhandic\n```\n\n위 방법으로는 항상 NK-HanDic으로 분석하게 됩니다.\n\n### 입력문\n\nNK-HanDic은 UTF-8 인코딩된 텍스트를 입력하여 형태소 분석을 실행합니다.\n입력할 때에는 완성형 한글(Hangul Syllables 영역의 문자)가 아니라 초성·중성·종성으로 분리한 첫가끝 코드(조합형, 한글 자모 영역의 문자)로 기술할 필요가 있습니다.\n예를 들어 완성형 한글의 '몸'(U+BAB8)은 한글 자모 영역의 글자를 사용하여 'ㅁ'(U+1106), 'ㅗ'(U+1169), 'ㅁ'(U+11B7)으로 나누어서 입력으로 주어야 합니다.\n\n이러한 변환 처리는 임의로 스크립트를 만들어서 처리해도 괜찮습니다.\n이 프로젝트에서는 Perl 스크립트 `k2jamo.pl`과 Python 스크립트 `k2jamo.py`를 제공하고 있습니다. `tools` 디렉토리를 참조하십시오.\n\n`k2jamo.pl`로 `input.txt`를 분석할 경우:\n\n```bash\n$ perl k2jamo.pl input.txt | mecab -d /usr/local/lib/mecab/dic/nkhandic\n```\n\n혹은 문장을 직접 입력할 경우:\n\n```bash\n$ echo \"다음과 같이 말씀하시였다.\" | perl k2jamo.pl | mecab -d /usr/local/lib/mecab/dic/nkhandic\n```\n\n처럼 처리할 수 있습니다.\n\n### 토큰화 처리(tokenize)\n\n출력 포맷을 지정하는 `-O` 옵션을 사용하여 토큰화 처리를 할 수 있습니다.\n출력 포맷으로 `tokenize`를 지정합니다.\n\n```bash\n$ echo \"우리의 경애하는 총비서동지께서는 어쩌면 그리도 위대하신가.\" | perl k2jamo.pl | mecab -d /usr/local/lib/mecab/dic/nkhandic -O tokenize\n```\n\n출력:\n\n```Text\n다음 과 같이 말씀 하 시여 ㅆ 다 .\n```\n\n## 품사 정보\n\n품사 정보에 관한 정보는 [품사 정보](docs/pos_detail.md) 문서를 참조하시기 바랍니다.\n\n## 사전 학습과 등록 항목\n\n### 사전 학습 방법\n\n사전 구축에 있어서 MeCab의 재학습(再學習) 기능([オリジナル辞書/コーパスからのパラメータ推定(일본어)](https://taku910.github.io/mecab/learn.html) 참조)을 이용하였습니다.\n현대 한국어 분석 사전 [HanDic](https://github.com/okikirmui/handic) 데이터에 아래에서 설명하는 조선어 항목(`z_NK.csv`)을 추가하여 HanDic 학습 모델을 바탕으로 조선어 데이터를 가지고 재학습하였습니다.\n구체적인 절차는 다음과 같습니다.\n\n`mecab-dict-index` 처리 후, 재학습 실행. 모든 파일이 같은 디렉토리에 있는 경우.\n\n사용하는 데이터는:\n\n- `handic_model`: HanDic 학습 모델\n- `corpus.txt`: 조선어 재학습용 말뭉치\n\n```bash\n# 재학습\n$ /usr/local/libexec/mecab/mecab-cost-train -p 2 -M handic_model -c 1.0 corpus.txt model\n# 사전 생성(final 디렉토리에 출력할 경우)\n$ /usr/local/libexec/mecab/mecab-dict-gen -o final -d . -m model\n# 분석용 binary 사전 구축\n$ cd final\n$ /usr/local/libexec/mecab/mecab-dict-index -f utf8 -t utf8\n```\n\n### 학습용 데이터\n\n재학습에 사용한 조선어 데이터 현황은 아래와 같습니다.\n\n| 자료    |  분야  |  기사/권 수  |  문장 수  |\n|--------|-------|-----------:|---------:|\n| 로동신문 | 사설 | 18 | 325 |\n| 로동신문 | 날짜별 기사 | 293 | 5,059 |\n| 로동신문 | 사회문화생활 | 24 | 428 |\n| 로동신문 | 전진하는 조선 | 17 | 538 |\n| 조선문학 | 소설 | 8 | 400 |\n| **합계** |   | **360** | **6,750** |\n\n자세한 목록은 [학습용 데이터](docs/data_list.md) 문서를 참조할 것.\n\n\u003e **주의**\n\u003e\n\u003e 예전 버전에서는 학습용 데이터에 조선어 교재를 많이 포함시켰으나 분석 성능 등을 고려해 현재 위와 같은 구성으로 사전을 구축하고 있습니다.\n\n### 등록된 항목\n\n사전 항목은 현대 한국어 분석 사전 [HanDic](https://github.com/okikirmui/handic)를 바탕으로 하여 추가로 다음과 같은 자료를 참조하여 등록하였습니다.\n\n  - [우리말샘](https://opendict.korean.go.kr/): 2024년 4월 시점의 전체 데이터 중 '북한말'로 기술된 항목\n  - 산업연구원DB [KIET 북한 산업·기업 DB](http://nkindustry.kiet.re.kr/comp/list.do): 북한 기업 목록\n  - [통일부 북한정보포털](https://nkinfo.unikorea.go.kr/nkp/word/nkword.do): ‘북한 지도’에서 ‘백화점’, ‘상점’, ‘휴양소’, ‘호텔’, ‘려관’, ‘야영소’, ‘대학’ 등의 검색어로 검색된 항목\n  - 통일부 북한정보포털에서 취득한 『북한 기관별 인명록(본권)』『북한 기관별 인명록(별책)』 2022, 2023에 기재된 기관명, 인명의 일부\n  - 현대 한국어 분석 사전 [HanDic](https://github.com/okikirmui/handic) 데이터 중 용언의 일부를 수정\n\n『조선말대사전』(2017년)을 참조하여 추가한 항목도 있습니다.\n\n## Author\n\n  - Yoshinori Sugai(스가이 요시노리/須賀井義教, Kindai University)\n\n## Reference\n\n  - 스가이 요시노리(2024), [`북한 조선어 형태소 분석 사전 구축에 관한 연구'](http://doi.org/10.33641/kolex.2024..44.33), 한국사전학 제44호, 서울: 한국사전학회, pp.33-63.\n\n## Copyrights\n\nCopyright (c) 2024- Yoshinori Sugai. All rights reserved.\n\n''NK-HanDic'' is under BSD-3-Clause.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fokikirmui%2Fnkhandic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fokikirmui%2Fnkhandic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fokikirmui%2Fnkhandic/lists"}