갈루아의 반서재

Stemming 어간추출


예를 들면, "es", "ed", "s" 와 같은 common word endings english 을 제거하는 알고리즘을 이용한다. 

SnowballC  패키지의 wordStem() 의 기능을 이용한다(Bouchet-Valat, 2014)


많은 경우에 데이터 분석을 위해 어간을 추출할 필요가 있다. 예를 들어, "example" 과 "examples" 은 동일한 "exampl" 에서 비롯되었다고 할 수 있기 때문이다. 아래 결과를 통해 추출전과 추출후를 비교해보자. 


> doc[[3]]

<<PlainTextDocument (metadata: 7)>>

STRICKLAND: All right. So it will be prior to August 14th or whatever date it is.

> doc[[6]]

<<PlainTextDocument (metadata: 7)>>

STRICKLAND: Way prior, yes. Way prior.

> doc[[10]]

<<PlainTextDocument (metadata: 7)>>

STRICKLAND: Anything else?


> library(SnowballC)

> doc <- tm_map(doc, stemDocument)

> inspect(doc[3])

<<VCorpus (documents: 1, metadata (corpus/indexed): 0/0)>>


[[1]]

<<PlainTextDocument (metadata: 7)>>

STRICKLAND: All right. So it will be prior to August 14th or whatev date it is. // 상단의 붉은 색 텍스트와 비교해볼 것


> inspect(doc[6])

<<VCorpus (documents: 1, metadata (corpus/indexed): 0/0)>>


[[1]]

<<PlainTextDocument (metadata: 7)>>

STRICKLAND: Way prior, yes. Way prior.


> inspect(doc[10])

<<VCorpus (documents: 1, metadata (corpus/indexed): 0/0)>>


[[1]]

<<PlainTextDocument (metadata: 7)>>

STRICKLAND: Anyth else?