word-cloud

How do I remove words from a wordcloud?

我们两清 提交于 2019-12-05 03:34:41
问题 I'm creating a wordcloud using the wordcloud package in R, and the help of "Word Cloud in R". I can do this easily enough, but I want to remove words from this wordcloud. I have words in a file (actually an excel file, but I could change that), and I want to exclude all these words, of which there are a couple hundred. Any suggestions? require(XML) require(tm) require(wordcloud) require(RColorBrewer) ap.corpus=Corpus(DataframeSource(data.frame(as.character(data.merged2[,6])))) ap.corpus=tm

R: add title to wordcloud graphics / png

╄→гoц情女王★ 提交于 2019-12-04 17:57:27
问题 I have some working R code that generates a tag cloud from a term-document matrix. Now I want to create a whole bunch of tag clouds from many documents, and to inspect them visually at a later time. To know which document(s)/corpus the tag-cloud picture belongs to, I'd lke to add a title to the generated graphic. How do I do that? Maybe this is obvious, but I'm still a beginner with R graphics. My own corpus is too big to list it here, but the code from this SO question (combined with the

Making a wordcloud, but with combined words?

空扰寡人 提交于 2019-12-04 16:55:41
I am trying to make a word cloud of publications keywords. for example: Educational data mining; collaborative learning; computer science...etc My current code is as the following: KeywordsCorpus <- Corpus(VectorSource(subset(Words$Author.Keywords, Words$Year==2012))) KeywordsCorpus <- tm_map(KeywordsCorpus, removePunctuation) KeywordsCorpus <- tm_map(KeywordsCorpus, removeNumbers) # added tolower KeywordsCorpus <- tm_map(KeywordsCorpus, tolower) KeywordsCorpus <- tm_map(KeywordsCorpus, removeWords, stopwords("english")) # moved stripWhitespace KeywordsCorpus <- tm_map(KeywordsCorpus,

How to put a wordcloud in a grob?

∥☆過路亽.° 提交于 2019-12-04 16:47:53
I've created a simple wordcloud: require(wordcloud) words <- c('affectionate', 'ambitious', 'anxious', 'articulate', 'artistic', 'caring', 'contented', 'creative', 'cynical', 'daring', 'dependable', 'easygoing', 'energetic', 'funny', 'generous', 'genuine', 'goodlistener', 'goodtalker', 'happy', 'hardworking', 'humerous', 'impulsive', 'intelligent', 'kind', 'loyal', 'modest', 'optimistic', 'outgoing', 'outrageous', 'passionate', 'perceptive', 'physicallyfit', 'quiet', 'rational', 'respectful', 'romantic', 'shy', 'spiritual', 'spontaneous', 'sweet', 'thoughtful', 'warm') freqs <- c(134, 53, 0, 5

change specific word color in wordcloud

不羁岁月 提交于 2019-12-04 10:09:17
问题 I would like to build a word cloud with R (I have done so with the package wordcloud ) and then color specific words a certain color. Currently the behavior of the function is to color words according to frequency (which can be useful) but word size already does this so I'd want to use color for additional meaning. Any idea on how to color specific words in wordcloud? (If there's another wordcloud function in R I'm unaware of I'm more than willing to go that route.) A mock example and my

WordCloud from data frame with frequency python

左心房为你撑大大i 提交于 2019-12-04 09:07:07
i have a dataframe as bellow Int64Index: 14830 entries, 25791 to 10668 Data columns (total 2 columns): word 14830 non-null object coef 14830 non-null float64 dtypes: float64(1), object(1) i try to make word cloud with coef as a frequency instead count for ample text = df['word'] WordCloud.generate_from_text(text) TypeError: generate_from_text() missing 1 required positional argument: 'text' or text = np.array(df['word']) WordCloud.generate_from_text(text) TypeError: generate_from_text() missing 1 required positional argument: 'text' How can i improve this code & made word cloud like this from

d3.js Tag Cloud size from a Json/array?

筅森魡賤 提交于 2019-12-04 07:31:13
I am modifying this code: https://github.com/jasondavies/d3-cloud <script> d3.layout.cloud().size([300, 300]) .words([ "Hello", "world", "normally", "you", "want", "more", "words", "than", "this"].map(function(d) { return {text: d, size: 10 + Math.random() * 90}; })) .rotate(function() { return ~~(Math.random() * 2) * 90; }) .fontSize(function(d) { return d.size; }) .on("end", draw) .start(); function draw(words) { d3.select("body").append("svg") .attr("width", 300) .attr("height", 300) .append("g") .attr("transform", "translate(150,150)") .selectAll("text") .data(words) .enter().append("text"

geom_wordcloud : is this a pipe dream

懵懂的女人 提交于 2019-12-03 22:37:00
I deal a bit with textual data across various grouping variables. I'm thinking of creating a method to make faceted wordcloud plots using Ian Fellows' wordcloud package. I like the way ggplot2 facets social variables. I'm deciding how to approach this problem (faceted wordcloud plot). Is it possible to use Fellows' work as a geom (I've never made a geom but may learn if this is doable) or will ggplot not play nicely because one is grid and one is base (and wordcloud also uses some C coding) or some other problem? How difficult is this (I know this is dependent on my abilities but would like

How do I remove words from a wordcloud?

Deadly 提交于 2019-12-03 20:25:45
I'm creating a wordcloud using the wordcloud package in R, and the help of " Word Cloud in R ". I can do this easily enough, but I want to remove words from this wordcloud. I have words in a file (actually an excel file, but I could change that), and I want to exclude all these words, of which there are a couple hundred. Any suggestions? require(XML) require(tm) require(wordcloud) require(RColorBrewer) ap.corpus=Corpus(DataframeSource(data.frame(as.character(data.merged2[,6])))) ap.corpus=tm_map(ap.corpus, removePunctuation) ap.corpus=tm_map(ap.corpus, tolower) ap.corpus=tm_map(ap.corpus,

How do I print lda topic model and the word cloud of each of the topics

爷,独闯天下 提交于 2019-12-03 11:03:58
问题 from nltk.tokenize import RegexpTokenizer from stop_words import get_stop_words from gensim import corpora, models import gensim import os from os import path from time import sleep import matplotlib.pyplot as plt import random from wordcloud import WordCloud, STOPWORDS tokenizer = RegexpTokenizer(r'\w+') en_stop = set(get_stop_words('en')) with open(os.path.join('c:\users\kaila\jobdescription.txt')) as f: Reader = f.read() Reader = Reader.replace("will", " ") Reader = Reader.replace("please"