0
Ich versuchte, die englischen Stoppwörter aus dem Text zu entfernen, bevor ich eine Wortwolke baute, aber es hat nicht funktioniert. Ich habe mehrere Beiträge gelesen und ohne Glück versucht, was vorgeschlagen wurde. Jede Hilfe wird geschätzt.R Wortwolke - kann englische Stoppwörter nicht entfernen
library(tm)
library(wordcloud)
library(RColorBrewer)
library(SnowballC)
textdata <- c(A secur breach expos privat inform of student loan borrow from Aug. 20-22 dure a comput softwar upgrade. User of the DOE Direct Loan Web site were abl to view inform other than their own if they use certain option when access the program web pages. SSNs were among the data element expos online. Softwar compani Affiliat Comput Servic (ACS) creat the technolog for the Direct Loan Servic featur on the DoE site.)
#Create corpus and clean data
txt <- Corpus(VectorSource(textdata))
txtCorpus <- tm_map(txt, removePunctuation)
txtCorpus <- tm_map(txt, removeNumbers)
txtCorpus <- tm_map(txt, content_transformer(tolower))
txtCorpus <- tm_map(txtCorpus, removeWords, stopwords("english"))
txtCorpus <- tm_map(txt, stripWhitespace); #inspect(docs[1])
txtCorpus <- tm_map(txt, stemDocument)
#Creat tdm
tdm <- TermDocumentMatrix(txtCorpus)
m <- as.matrix(tdm)
v <- sort(rowSums(m),decreasing=TRUE)
d <- data.frame(word = names(v),freq=v, stringsAsFactors = FALSE)
head(d, 10)
Ausgabe
word freq
the the 8469
and and 5790
inform inform 2629
was was 2487
secur secur 2249
were were 1901
social social 1890