Skip to content

Instantly share code, notes, and snippets.

@nurandi
Last active August 29, 2015 14:14
Show Gist options
  • Save nurandi/6bc8748fafc5197265ee to your computer and use it in GitHub Desktop.
Save nurandi/6bc8748fafc5197265ee to your computer and use it in GitHub Desktop.
# Menghitung frequensi per kata
text = readLines("pidato-presiden.txt")
text = unlist(strsplit(text, "\\W+"))
text = tolower(text)
text = data.frame(table(text))
# Menghapus stop-words
stopw = readLines("stopwords-id.txt")
text = text[!is.element(text$text, stopw),]
# Generate word-cloud
wordcloud(text$text, text$Freq, random.order=FALSE, rot.per=0.25, colors=brewer.pal(8, "Dark2"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment