tm
-packageでRでテキストマイニングを行っています。すべてが非常にスムーズに動作します。しかし、ステミング後に1つの問題が発生します(http://en.wikipedia.org/wiki/Stemming)。明らかに、同じ幹を持ついくつかの単語がありますが、それらが「一緒に投げ込まれていない」ことは重要です(これらの単語は異なることを意味します)。tm-packageによるテキストマイニング - 単語のステミング
例については、以下の4つのテキストを参照してください。ここでは、 "講師"または "講義"( "関連"と "関連")を交換することはできません。しかし、これは手順4で行われたことです。
いくつかのケース/単語に対してこれを手動で実装する方法はありますか?(例:「講師」と「講義」は2つの異なるものとして保持されます)
texts <- c("i am member of the XYZ association",
"apply for our open associate position",
"xyz memorial lecture takes place on wednesday",
"vote for the most popular lecturer")
# Step 1: Create corpus
corpus <- Corpus(DataframeSource(data.frame(texts)))
# Step 2: Keep a copy of corpus to use later as a dictionary for stem completion
corpus.copy <- corpus
# Step 3: Stem words in the corpus
corpus.temp <- tm_map(corpus, stemDocument, language = "english")
inspect(corpus.temp)
# Step 4: Complete the stems to their original form
corpus.final <- tm_map(corpus.temp, stemCompletion, dictionary = corpus.copy)
inspect(corpus.final)
これはステミングのポイントです。あなたは根本的な言葉を得るためにそれを行います。相違を保持したい場合は、相殺しないでください。 –
私は知っています。しかし、場合によってはそれを元に戻すエレガントな方法はありませんか? – majom