Curățarea și preprocesarea textului

Text Mining cu Bag-of-Words în R

Ted Kwartler

Instructor

Funcții comune de preprocesare

preprocessing_functions copy.png

Text Mining cu Bag-of-Words în R

Preprocesare în practică

preprocessing.png

# Make a vector source: coffee_source
coffee_source <- VectorSource(coffee_tweets)

# Make a volatile corpus: coffee_corpus coffee_corpus <- VCorpus(coffee_source)
# Apply various preprocessing functions tm_map(coffee_corpus, removeNumbers) tm_map(coffee_corpus, removePunctuation)
tm_map(coffee_corpus, content_transformer(replace_abbreviation))
Text Mining cu Bag-of-Words în R

Alt pas de preprocesare: stemizarea cuvintelor

# Stem words
stem_words <- stemDocument(c("complicatedly", "complicated","complication"))
stem_words
"complic" "complic" "complic"
# Complete words using single word dictionary
stemCompletion(stem_words, c("complicate"))
     complic      complic      complic 
"complicate" "complicate" "complicate"
# Complete words using entire corpus
stemCompletion(stem_words, my_corpus)
Text Mining cu Bag-of-Words în R

Să exersăm!

Text Mining cu Bag-of-Words în R

Preparing Video For Download...