Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Stemming Algorithms AI LAB 정 동 환. 2 Stemming algorithm 개념  Stemming Algorithm  입력된 단어의 어근 (root) 만을 추출하는 알고리즘.  Stemmer Stemming algorithm 을 구현한.

Similar presentations


Presentation on theme: "1 Stemming Algorithms AI LAB 정 동 환. 2 Stemming algorithm 개념  Stemming Algorithm  입력된 단어의 어근 (root) 만을 추출하는 알고리즘.  Stemmer Stemming algorithm 을 구현한."— Presentation transcript:

1 1 Stemming Algorithms AI LAB 정 동 환

2 2 Stemming algorithm 개념  Stemming Algorithm  입력된 단어의 어근 (root) 만을 추출하는 알고리즘.  Stemmer Stemming algorithm 을 구현한 프로그램. Stemmer “engineering” “engineer” Document Break into word stoplist Stemming words text Non-stoplist words Term weighting Stemmed words Assign doc id’s documents Database Term weights Document numbers and field numbers Interface User queriesdocuments Relevance judgments Parse query Stemming ranking Boolean operations Ranked Docs set queries query Query term Stemmed words  Stemming in IR

3 3 Stemming 의 잇점  Stemming algorithm 을 사용한 IR 의 잇점  imporive retrieval effectiveness.  인덱스 파일의 크기가 작아짐.  Stemming 알고리즘의 문제점  overstemming : 너무 많이 잘림. 연관성이 없는 term 들이 conflation 됨.  Understemming: 너무 적게 잘림. 연관성 있는 term 들이 conflation 안 됨.  다른 의미의 단어를 같은 어간으로 취급. wand : 지팡이, wander : 돌아다니다. 인덱스 화일 Keyword HitsLink user users using “use” 로 대치 (conflation) 4 6 2 Postings 화일 Doc.# Link

4 4 Stemmer 의 종류  Stemmer 의 종류.  Affix removal stemmer -- most common.  Successor variety stemmer. -- complicated, not used much.  Table lookup stemmer.  N-gram stemmer.  Table lookup  모든 인덱스 term 과 term 의 stem 을 테이블에 저장.  Impractical because of storage overhead. Termstem engineering engineered engineer

5 5 Stemmer 의 종류  Successor Variety stemmer  successor variety 값을 사용해서 stem 추출. D : text/document 내 word 의 집합 D  i ii ii ii i letters  i 의 successor variety(S  i) = 3 “  i 바로 뒤에 나오는 다른 character 의 수를  i 의 S  i 로 정의함 ”  Example Test word : READABLE Corpus : ABLE, APE, BEATABLE, FIXABLE, READ, READABLE, READING, READS, RED, ROPE, RIPE. Prefix successor variety letters R READ REA RE READAB READA READABLE READABL 3213111132131111 E, I, O A, D D A, I, S B L E BLANK

6 6 Successor variety Stemmer  Successor Variety in Large body of text  Hafer, Weiss report 2,000 terms to be a stable number.  Successor variety 값 들을 이용해 Term 나눔. cutoff method peak and plateau method complete word method entropy method  stem 을 선택 함. if (first segment occurs in <=12 words in corpus first segment is stem else (second segment is stem) 2 3 4 5 1 i SiSi RE AD A B L E stem suffix Sharply increases stem suffix prefix stem

7 7 N-gram stemmer  N-gram  term 안의 n 개의 연속적인 character slice. statistics --> st ta at ti is st ti ic cs unique digram -> at cs ic is st ta ti A = 7 statistical --> st ta at ti is st ti ic ca al unique digram -> al at ca ic is st ta ti B = 8 common digram -> at, ic, is,st, ta, ti C = 6  Dice’s coefficient S = 2C / ( A + B ) DB 내의 모든 term 들의 쌍에 대해 S 를 구함. word1 word2 word3 ….word n-1 word1 word2 S 21 word3 S 31 S 32 | word n-1 S n-1 S n-2 S n3 Sn (n-1) Similarity matrix  terms are clustered using “single clustering method”

8 8 Affix removal stemmer  복잡한 접미사 (Complex suffix) 를 단계별 로 하나씩 제거.  Ex) generalizations ---> generalization --> generalize step1 step2 -->general --> gener step3 step4  각 단계별로 rule 을 가짐. Rule 에 의해 action 이 취해짐.  일률적으로 rule 을 적용시키지 않고 조건에 따라 적용. FACT|UAL EQ|UAL  conditions measure [C](VC) m [V] V:vowel( 모음 ) C :consonant( 자음 ) Measure Examples m = 0 TR, TREE m = 1 TROUBLE, IVY m = 2 TROUBL ES, PRIV ATE

9 9 Affix removal stemmer  Conditions * : stem 이 문자 X 로 끝남. *v* : stem 이 모음을 포함. *d : stem 이 연속된 2 개의 자음으로 끝남. *o : stem 이 c-v-c 로 끝남. 마지막 consonant 는 w,x,y 가 아님.  Action old_suffix --> new_suffix  Steps Step1a Step1b Step1b1 Step1c Step2 Step3 Step4 Step5a Step5b

10 10 Porter’s Algorithm Stem(word) { word 가 alphabet 으로만 이루어 졌는지 검사. 아니면 return; /* 각 step 별 Rule 적용 */ ReplaceEnd(word, 스텝 1a 의 Rule) ReplaceEnd(word, 스텝 1b 의 Rule) if ( 스텝 1b 의 Rule 중 106, 107 이 적용되었으면 ) ReplaceEnd(word, 스텝 1b1 의 Rule) ReplaceEnd(word, 스텝 1c 의 Rule) ReplaceEnd(word, 스텝 2 의 Rule) ReplaceEnd(word, 스텝 3 의 Rule) ReplaceEnd(word, 스텝 4 의 Rule) ReplaceEnd(word, 스텝 5a 의 Rule) ReplaceEnd(word, 스텝 5b 의 Rule) } \0 word Global end ReplaceEnd(word, rule) Struct RuleList step1a_rules[] { 101, “sses”, “ss” 3, 1, -1, NULL, 102, “ies”, “I” 2, 0, -1, NULL. } Struct RuleList step1b_rules[] { } Struct RuleList step5b_rules[] Global

11 11 RuleList 구조체 Struct RuleList step1a_rules[] = { 101, “sses”, “ss” 3, 1, -1, NULL, 102, “ies”, “i” 2, 0, -1, NULL, RuleList 구조체 Rule id 대치되어야 될 suffix 대치할 문자열 대치되어야 할 문자열 길이 보다 1 작은값 대치할 문자열 보다 1 작은값 대치가 발생할 수 있는 최소의 measure 값 조건을 채크 하기 위한 함수로의 포인터

12 12 ReplaceEnd() Stem ReplaceEnd(word, rule) { while( 한 스텝내 모든 rule 에 대해 ) { if (rule 에서 정의한 suffix 가 발견되면 ) { if(m 값이 조건에 만족하면 ) { if (condition 이 만족되면 ) { suffix 대치 ; } 적용된 rule id 를 리턴 ; } AddAnE() RemoveAnE() ContainsVowel() EndWithCVC() *o 를 check

13 13 wordSize() v Condition 을 check 하기 위해 [C](VC) m [V] 에서 m 값을 구하는 함수 v DFA 를 사용 함. v 상태전이도 0 start 1 2 v c v or ‘y’ c m 증가 v c

14 14 예 generalizations ---> generalization ----> generalizate ---> generaliz step1astep2 step4 Tom Kalafu 10/09/95 Class Summary: We went over Indexing which includes lexical analysis or tokenization, stopword removal, stemming, and plural removal. We reviewed some lexical analysis basics; like grammars, finite state machines, turing machine theory, and the UNIX tools lex and yacc. We then learned how finite state machines, which save space and are quick, can help in stopword removal. We then went over conflation methods, or more specifically, stemming and plural removal methods. We reviewed an example to see that it's not too clear how to handle multiple dictionary entries, short words like 'kings', and spelling variations. We were then introduced to different measures for the purpose of evaluating conflation methods, since conflation is not a perfect science. Near the end of class, we were introduced to the next unit involving word processing, document management, markup and the OHCO model.


Download ppt "1 Stemming Algorithms AI LAB 정 동 환. 2 Stemming algorithm 개념  Stemming Algorithm  입력된 단어의 어근 (root) 만을 추출하는 알고리즘.  Stemmer Stemming algorithm 을 구현한."

Similar presentations


Ads by Google