word-cloud

Generate word cloud from single-column Pandas dataframe

北城以北 提交于 2019-12-22 08:42:44
问题 I have a Pandas dataframe with one column: Crime type. The column contains 16 different "categories" of crime, which I would like to visualise as a word cloud, with words sized based on their frequency within the dataframe. I have attempted to do this with the following code: To bring the data in: fields = ['Crime type'] text2 = pd.read_csv('allCrime.csv', usecols=fields) To generate the word cloud: wordcloud2 = WordCloud().generate(text2) # Generate plot plt.imshow(wordcloud2) plt.axis("off"

Spaces in wordcloud

Deadly 提交于 2019-12-22 07:51:22
问题 I currently use wordle for many artsy uses of the word cloud. I think that R's word cloud, potentially, has better control. 1) How do you keep a word capitalized in the word cloud? [SOLVED] 2) How do keep two words as one chunk in the wordcloud? (wordle uses the ~ operator to accomplish this, R's word cloud merely prints the ~ as is) [For instance where there's a ~ between "to" and "be" I'd like a space in the word cloud] require(wordcloud) y<-c("the", "the", "the", "tree", "tree", "tree",

create wordcloud in python for foreign language (Hebrew)

纵然是瞬间 提交于 2019-12-21 21:35:18
问题 I want to create a wordcloud. When my string is in English, everything works fine: from wordcloud import WordCloud from matplotlib import pyplot as plt text="""Softrock 40 - close to the 6 MHz that the P6D requires (6.062 according) - https://groups.yahoo.com/neo/groups/softrock40/conversations/messages I want the USB model that has a controllable (not fixed) central frequency.""" wordcloud = WordCloud().generate(text) plt.imshow(wordcloud, interpolation='bilinear') plt.axis("off") plt.show()

text wordcloud plotting error

拈花ヽ惹草 提交于 2019-12-21 04:42:38
问题 I have the following code for plotting a word cloud, and am getting the subsequent error. wordcloud(dm$word, dm$freq, scale=c(8,.2),min.freq=2, + max.words=Inf, random.order=FALSE, rot.per=.15, colors=rainbow >Warning message: In wordcloud(dm$word, dm$freq, scale = c(8, 0.2), min.freq = 2,:health insurance could not be fit on page. It will not be plotted. Unable to view plot. I do not understand why this is happening. Please help. 回答1: Try with smaller scale, for example: wordcloud

Increase resolution with word-cloud and remove empty border

…衆ロ難τιáo~ 提交于 2019-12-18 10:35:57
问题 I am using word cloud with some txt files. How do I change this example if I wanted to 1) increase resolution and 2) remove empty border. #!/usr/bin/env python2 """ Minimal Example =============== Generating a square wordcloud from the US constitution using default arguments. """ from os import path import matplotlib.pyplot as plt from wordcloud import WordCloud d = path.dirname(__file__) # Read the whole text. text = open(path.join(d, 'constitution.txt')).read() wordcloud = WordCloud()

wordcloud for a csv file in python

被刻印的时光 ゝ 提交于 2019-12-13 17:25:15
问题 i have a csv file with 2 columns (dataframe) column 1 contains a sentence i love banana and column 2 contains a classe i have 5 classes i need a wordcloud for each class in fact each all the senetences corresponding to each classe it possible to do it ? it try this code but id does not working import matplotlib.pyplot as plt cloud = WordCloud(background_color="white", max_words=20, stopwords=stopwords) tuples = tuple([tuple(x) for x in df.Phrase.value_counts().reset_index().values]) a = cloud

How to create a Simple tag cloud? Using C# and Styling with css

亡梦爱人 提交于 2019-12-13 03:59:22
问题 I'm finding it impossible to create a tag cloud, I can't find any walkthrough’s or tutorials. (ones that work at least). I'm just looking for a simple, basic example of a working tag cloud and I can spice it up after that. The best link i found is: http://www.geekzilla.co.uk/View960C74AE-D01B-428E-BCF3-E57B85D5A308.htm But it's out dated and I can't download the source file, and there are many gaps in the code. 回答1: This isn't a really hard problem. Essentially a tag cloud is just a way of

text mining with tm package in R ,remove words starting from [http] or any other specifc word

一世执手 提交于 2019-12-12 07:28:44
问题 I am new to R and text mining. I had made a word cloud out of twitter feed related to some term. The problem that I'm facing is that in the wordcloud it shows http:... or htt... How do I deal about this issue I tried using metacharacter * but I still doubt if I'm applying it right tw.text = removeWords(tw.text,c(stopwords("en"),"rt","http\\*")) somebody into text-minning please help me with this. 回答1: If you are looking to remove URLs from your string, you may use: gsub("(f|ht)tp(s?)://(.*)[.

Creating n-grams word cloud using python

家住魔仙堡 提交于 2019-12-12 04:11:39
问题 I am trying to generate word cloud using bi-grams. I am able to generate the top 30 discriminative words but unable to display words together while plotting. My word cloud image still looks like a uni-gram cloud. I have used the following script and sci-kit learn packages. def create_wordcloud(pipeline): """ Create word cloud with top 30 discriminative words for each category """ class_labels = numpy.array(['Arts','Music','News','Politics','Science','Sports','Technology']) feature_names

Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : there is no package called ‘Rcpp’ [duplicate]

三世轮回 提交于 2019-12-12 03:02:21
问题 This question already has answers here : Error in loadNamespace(name) : there is no package called 'Rcpp' (6 answers) Closed 3 years ago . Basically I want to use wordcloud function. I'm working through R console. But I could use Rstudio if thats the problem. When I use wordcloud(r_stats_text_corpus) Error: could not find function "wordcloud" I also tried library("wordcloud") Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : there is no package called ‘Rcpp’ Error: