Git Product home page Git Product logo

handic's Introduction

HanDic: morphological analysis dictionary for contemporary Korean

HanDic(한딕)は,形態素解析エンジンMeCabで現代韓国語を解析するための辞書です.12万を超える辞書項目,書きことばを中心とした6000文以上の学習用データで構築されています.

著作権の問題があるため学習用データ自体の配布はしませんが,学習用モデルファイルはパッケージに含まれています.

Requirements

  • MeCab
  • Python or Perl

Installation

git clone

$ git clone https://github.com/okikirmui/handic.git

もしくはZIPファイルをダウンロード

cloneしたリポジトリ配下のseedディレクトリに移動

$ cd handic/seed/

ZIPファイルをダウンロードした場合は解凍し,seedディレクトリに移動

$ cd handic-master/seed/

バイナリ辞書の作成

$ /usr/local/libexec/mecab/mecab-dict-index -f utf8 -t utf8

パラメータ学習用のモデルファイルmodelが同梱されているので,それを使って配布用辞書を作成(インストール先が/usr/local/lib/mecab/dic/handicの場合)

$ /usr/local/libexec/mecab/mecab-dict-gen -o /usr/local/lib/mecab/dic/handic -m model

解析用バイナリ辞書の作成

$ cd /usr/local/lib/mecab/dic/handic
$ /usr/local/libexec/mecab/mecab-dict-index -f utf8 -t utf8

Usage

実行時に辞書を指定する

MeCab実行時に-dオプションでHanDic辞書ファイルのあるディレクトリを指定します.

$ mecab -d /usr/local/lib/mecab/dic/handic

この方法では,実行するたびに辞書を指定する必要があります.

設定ファイルで辞書を指定する

ホームディレクトリに.mecabrcを作成して,dicdirにHanDic辞書ファイルのあるディレクトリを記述します.

dicdir = /usr/local/lib/mecab/dic/handic

この方法では,常にHanDicを使って解析することになります.

入力を与える

HanDicは,UTF-8エンコーディングされたテキストを入力として形態素解析を行います. また,入力は通常のハングル(Hangul Syllables「ハングル音節文字」領域の文字,いわゆる「完成型ハングル」)ではなく,初声・中声・終声の字母に分解した入力(Hangul Jamo「ハングル字母」領域の文字)である必要があります. 例えば完成型ハングルの「몸」(U+BAB8)は,字母に分解すると「ㅁ」(U+1106)「ㅗ」(U+1169)「ㅁ」(U+11B7)となります.

こうした字母への分解は,任意のスクリプトを使って行っても構いません.なお,本プロジェクトではtoolsディレクトリにPerl用スクリプトk2jamo.plとPython用スクリプトk2jamo.pyを同梱しています.

コマンドラインやターミナルで,k2jamo.plを使ってinput.txt(例)を解析する場合:

$ perl k2jamo.pl input.txt | mecab -d /usr/local/lib/mecab/dic/handic

あるいはコマンドラインやターミナルで直接入力をする場合:

$ echo "겨울 방학 때 뭐 했어요?" | perl k2jamo.pl | mecab -d /usr/local/lib/mecab/dic/handic

のように行うことができます.

Author

  • Yoshinori Sugai(Kindai University)

Copyrights

Copyright (c) 2011- Yoshinori Sugai. All rights reserved.

''HanDic'' is under BSD-3-Clause.

handic's People

Contributors

okikirmui avatar

Watchers

 avatar  avatar

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.