Visualize common words
Now that you have a corpus filled with words used in both the chardonnay and coffee tweets files, you can clean the corpus, convert it into a TermDocumentMatrix, and then a matrix to prepare it for a commonality.cloud().
The commonality.cloud() function accepts this matrix object, plus additional arguments like max.words and colors to further customize the plot.
commonality.cloud(tdm_matrix, max.words = 100, colors = "springgreen")
Cet exercice fait partie du cours
Text Mining with Bag-of-Words in R
Instructions
- Create
all_cleanby applying the predefinedclean_corpus()function toall_corpus. - Create
all_tdm, aTermDocumentMatrixfromall_clean. - Create
all_mby convertingall_tdmto a matrix object. - Create a
commonality.cloud()fromall_mwithmax.words = 100andcolors = "steelblue1".
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
# Clean the corpus
___ <- ___(___)
# Create all_tdm
___ <- ___(___)
# Create all_m
___ <- ___(___)
# Print a commonality cloud
___(___, ___, ___)