klay

KLAY - Korean Language AnalYzer (한국어 형태소 분석기)


Project maintained by ks-shim Hosted on GitHub Pages — Theme by mattgraham

1. KLAY

Build Status Coverage Status

Korean Language AnalYzer using KOMORAN’s dictionaries.

2. Architecture

Performance와 동시에 확장성을 고려하였으며 Readability에 많은 신경을 썼습니다. 그래서 조금 더 자바(Java)스럽게 Design하였습니다.

2-1. Tokenization

Chain of Responsibiility 패턴을 사용하여 구현하였습니다. ChainedTokenizationRule 인터페이스를 구현하여 Rule을 쉽게 추가할 수 있습니다. 현재는 아래와 같은 Rule을 순차적으로 적용하고 있습니다.

tokenization_diagram

2-2. Analysis

마찬가지로 Chain of Responsibility 패턴을 사용하여 구현하였습니다. ChainedAnalysisRule 인터페이스를 구현하여 Rule을 쉽게 추가할 수 있습니다. 현재는 아래와 같은 Rule을 순차적으로 적용하고 있습니다.

HMM(Viterbi)는 MorphSequence 클래스를 사용하여 계산되어집니다.

analysis_diagram

2-3. Dictionary

Lucene의 Trie를 변형하여 적용하였습니다.

dictionary_diagram

3. Example

    //***********************************************************************
    // 1. configuration and creating Klay object ...
    //***********************************************************************
    Klay klay = new Klay(Paths.get("data/configuration/klay.conf"));

    //***********************************************************************
    // 2. start morphological analysis.
    //***********************************************************************
    String text = "너무기대안하고갔나....................재밌게봤다";
    Morphs morphs = klay.doKlay(text);

    //***********************************************************************
    // 3. print result.
    //***********************************************************************
    Iterator<Morph> iter = morphs.iterator();
    while(iter.hasNext()) {
        System.out.println(iter.next());
    }

4. Performance

4-1. 사양 및 데이터

5. Elasticsearch Plugin Download

6. Resources Download

7. KLAY for python

8. Maven

<dependency>
  <groupId>io.github.ks-shim.klay</groupId>
  <artifactId>klay-common</artifactId>
  <version>0.3.8</version>
</dependency>
<dependency>
  <groupId>io.github.ks-shim.klay</groupId>
  <artifactId>klay-dictionary</artifactId>
  <version>0.3.8</version>
</dependency>
<dependency>
  <groupId>io.github.ks-shim.klay</groupId>
  <artifactId>klay-core</artifactId>
  <version>0.3.8</version>
</dependency>
<repositories>
  <repository>
      <id>oos</id>
      <url>https://s01.oss.sonatype.org/content/groups/public/</url>
  </repository>
</repositories>

9. Dictionary build