kr.ac.kaist.swrc.jhannanum.plugin.MajorPlugin.MorphAnalyzer.ChartMorphAnalyzer
Class Exp

java.lang.Object
  extended by kr.ac.kaist.swrc.jhannanum.plugin.MajorPlugin.MorphAnalyzer.ChartMorphAnalyzer.Exp

public class Exp
extends java.lang.Object

This class for expansion of morphological analysis regarding rules such as elision, contractions, and irregular rules.

Author:
Sangwon Park (hudoni@world.kaist.ac.kr), CILab, SWRC, KAIST

Field Summary
private  MorphemeChart mc
          The lattice style morpheme chart
private  java.lang.String[][] pset
          The list for expansion rules.
private  int pset_end
          The last index of pset
private  TagSet tagSet
          Morpheme tag set
 
Constructor Summary
Exp(MorphemeChart mc, TagSet tagSet)
          Constructor.
 
Method Summary
private  java.lang.String insert(java.lang.String str1, int cur, java.lang.String str2)
          Inserts the string str2 to the specified position of the string str1.
private  int pcheck(java.lang.String base, int idx, java.lang.String rule)
          It checks pset whether the rule is applied to the specified index of given string.
 void prule(int from, java.lang.String str1, java.lang.String str2, SegmentPosition sp)
          Check the rules on the given string, and expand the morpheme chart.
private  java.lang.String replace(java.lang.String str1, int cur, java.lang.String str2)
          Replaces the character at the specified position of the string str1 with the first character of the string str2.
private  void rule_eomi_u(int from, java.lang.String prev, java.lang.String str, int cur)
          It expands the morpheme chart regarding the elision rule '으', '스', '느'.
private  void rule_gut(int from, java.lang.String prev, java.lang.String str, int cur)
          It expands the morpheme chart regarding the rules about '것'.
private  void rule_i(int from, java.lang.String prev, java.lang.String str, int cur)
          It expands the morpheme chart regarding the rule '이'.
private  void rule_irr_word(int from, java.lang.String prev, java.lang.String str, int cur)
          It expands the morpheme chart regarding the irregular rules about 'ㄷ', 'ㅅ', 'ㅂ', 'ㅎ', '르', '러'.
private  void rule_irr_word2(int from, java.lang.String prev, java.lang.String str, int cur)
          It expands the morpheme chart regarding the irregular rules about '우', '여'.
private  void rule_johwa(int from, java.lang.String prev, java.lang.String str, int cur)
          It expands the morpheme chart regarding the vowel harmony rules.
private  void rule_NP(int from, java.lang.String prev, java.lang.String str)
          It expands the morpheme chart regarding the rules about personal pronoun.
private  void rule_rem(int from, java.lang.String prev, java.lang.String str, int cur)
          It expands the morpheme chart regarding the elision rules about 'ㄹ', 'ㅡ', 'ㅏ', 'ㅓ'.
private  void rule_shorten(int from, java.lang.String prev, java.lang.String str, int cur)
          It expands the morpheme chart regarding the contration rules about 'ㅗ', 'ㅜ', 'ㅚ', 'ㅣ'.
private  int strcmp(java.lang.String s1, int i1, java.lang.String s2, int i2)
          C style string compare method.
private  int strncmp(java.lang.String s1, int i1, java.lang.String s2, int i2, int len)
          C style string compare method for the specified length.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pset_end

private int pset_end
The last index of pset


mc

private MorphemeChart mc
The lattice style morpheme chart


tagSet

private TagSet tagSet
Morpheme tag set


pset

private java.lang.String[][] pset
The list for expansion rules.

Constructor Detail

Exp

public Exp(MorphemeChart mc,
           TagSet tagSet)
Constructor.

Parameters:
mc - - the lattice style morpheme chart
tagSet - - morpheme tag set
Method Detail

insert

private java.lang.String insert(java.lang.String str1,
                                int cur,
                                java.lang.String str2)
Inserts the string str2 to the specified position of the string str1.

Parameters:
str1 - - the string where the other string is going to be inserted
cur - - the index of the str1 for insertion
str2 - - the string to insert
Returns:
the new string that str2 is inserted to str1 at the specified position

pcheck

private int pcheck(java.lang.String base,
                   int idx,
                   java.lang.String rule)
It checks pset whether the rule is applied to the specified index of given string.

Parameters:
base - - the string to check
idx - - the index of the string
rule - - the name of the rule to check
Returns:
0 - the rule is not applied, otherwise applied

prule

public void prule(int from,
                  java.lang.String str1,
                  java.lang.String str2,
                  SegmentPosition sp)
Check the rules on the given string, and expand the morpheme chart.

Parameters:
from - - the index for the start of segment position
str1 - - the front part of the string
str2 - - the next part of the string
sp - - the segment position

replace

private java.lang.String replace(java.lang.String str1,
                                 int cur,
                                 java.lang.String str2)
Replaces the character at the specified position of the string str1 with the first character of the string str2.

Parameters:
str1 - - base string
cur - - index of the character to
str2 - - the first character of the string is used to replace
Returns:
the string with the new character replaced

rule_eomi_u

private void rule_eomi_u(int from,
                         java.lang.String prev,
                         java.lang.String str,
                         int cur)
It expands the morpheme chart regarding the elision rule '으', '스', '느'.

Parameters:
from - - the start index for the segment position
prev - - the passed part of the string
str - - the next part of the string to check
cur - - the current index of the string for checking the rules

rule_gut

private void rule_gut(int from,
                      java.lang.String prev,
                      java.lang.String str,
                      int cur)
It expands the morpheme chart regarding the rules about '것'.

Parameters:
from - - the start index for the segment position
prev - - the passed part of the string
str - - the next part of the string to check
cur - - the current index of the string for checking the rules

rule_i

private void rule_i(int from,
                    java.lang.String prev,
                    java.lang.String str,
                    int cur)
It expands the morpheme chart regarding the rule '이'.

Parameters:
from - - the start index for the segment position
prev - - the passed part of the string
str - - the next part of the string to check
cur - - the current index of the string for checking the rules

rule_irr_word

private void rule_irr_word(int from,
                           java.lang.String prev,
                           java.lang.String str,
                           int cur)
It expands the morpheme chart regarding the irregular rules about 'ㄷ', 'ㅅ', 'ㅂ', 'ㅎ', '르', '러'.

Parameters:
from - - the start index for the segment position
prev - - the passed part of the string
str - - the next part of the string to check
cur - - the current index of the string for checking the rules

rule_irr_word2

private void rule_irr_word2(int from,
                            java.lang.String prev,
                            java.lang.String str,
                            int cur)
It expands the morpheme chart regarding the irregular rules about '우', '여'.

Parameters:
from - - the start index for the segment position
prev - - the passed part of the string
str - - the next part of the string to check
cur - - the current index of the string for checking the rules

rule_johwa

private void rule_johwa(int from,
                        java.lang.String prev,
                        java.lang.String str,
                        int cur)
It expands the morpheme chart regarding the vowel harmony rules.

Parameters:
from - - the start index for the segment position
prev - - the passed part of the string
str - - the next part of the string to check
cur - - the current index of the string for checking the rules

rule_NP

private void rule_NP(int from,
                     java.lang.String prev,
                     java.lang.String str)
It expands the morpheme chart regarding the rules about personal pronoun.

Parameters:
from - - the start index for the segment position
prev - - the passed part of the string
str - - the next part of the string to check

rule_rem

private void rule_rem(int from,
                      java.lang.String prev,
                      java.lang.String str,
                      int cur)
It expands the morpheme chart regarding the elision rules about 'ㄹ', 'ㅡ', 'ㅏ', 'ㅓ'.

Parameters:
from - - the start index for the segment position
prev - - the passed part of the string
str - - the next part of the string to check
cur - - the current index of the string for checking the rules

rule_shorten

private void rule_shorten(int from,
                          java.lang.String prev,
                          java.lang.String str,
                          int cur)
It expands the morpheme chart regarding the contration rules about 'ㅗ', 'ㅜ', 'ㅚ', 'ㅣ'.

Parameters:
from - - the start index for the segment position
prev - - the passed part of the string
str - - the next part of the string to check
cur - - the current index of the string for checking the rules

strcmp

private int strcmp(java.lang.String s1,
                   int i1,
                   java.lang.String s2,
                   int i2)
C style string compare method.

Parameters:
s1 - - string 1
i1 - - start index of string 1 for comparing
s2 - - string 2
i2 - - strart index of string 2 for comparing
Returns:
0 : equal, > 0 : string 1 is higher in alphabetical order, < 0 : string 1 is lower in alphabetical order

strncmp

private int strncmp(java.lang.String s1,
                    int i1,
                    java.lang.String s2,
                    int i2,
                    int len)
C style string compare method for the specified length.

Parameters:
s1 - - string 1
i1 - - start index of string 1 for comparing
s2 - - string 2
i2 - - strart index of string 2 for comparing
len - - the number of characters to compare
Returns:
0 : equal, > 0 : string 1 is higher in alphabetical order, < 0 : string 1 is lower in alphabetical order