ステップ3:テキストの整理

Rで学ぶBag-of-Wordsによるテキストマイニング

Ted Kwartler

Instructor

qdap によるテキスト整理

# qdap cleaning function
qdap_clean <- function(x) {
  x <- replace_abbreviation(x)
  x <- replace_contraction(x)
  x <- replace_number(x)
  x <- replace_ordinal(x)
  x <- replace_symbol(x)
  x <- tolower(x)
  return(x)
}
Rで学ぶBag-of-Wordsによるテキストマイニング

tm によるテキスト整理

# tm cleaning function
tm_clean <- function(corpus) {
  tm_clean <- tm_map(corpus, removePunctuation)
  corpus <- tm_map(corpus, stripWhitespace)
  corpus <- tm_map(corpus, removeWords,
              c(stopwords("en"), "Google", "Amazon", "company"))
  return(corpus)
}
Rで学ぶBag-of-Wordsによるテキストマイニング

コーパスのクリーニング

 

クリーンなコーパス

Rで学ぶBag-of-Wordsによるテキストマイニング

練習しましょう

Rで学ぶBag-of-Wordsによるテキストマイニング

Preparing Video For Download...