Recently want to see a film, to know the review, just learning Python crawler, do a small example.Code modified based on third-party source link http://python.jobbole.com/88325/#comment-94754#Coding:utf-8 fromLib2to3.pgen2.grammarImport Line__author__=' Hang'ImportWarningswarnings.filterwarnings ("Ignore")ImportJieba#Word breaker PackageImportNumPy#NumPy Calculation PackageImportReImportPandas as PDImportMatplotlib.pyplot as PltImportUrllib2 fromBs4Im
(TXT):TenWordlist_jieba = jieba.cut (TXT)#split text, return to list OneTxt_jieba =" ". Join (Wordlist_jieba)#stitching a list into a string that breaks with spaces A returnTxt_jieba - -Stopwords = {'these'70A'those who'70A'because'70A'so': 0}#noise word theMask_pic = Numpy.array (Image.open (Os.path.join (Cur_path,'love.jpg'))) - -With open (Os.path.join (Cur_path,'Select the day note. txt') ) as FP: -TXT =Fp.read () +TXT =Chinese_jieba (TXT)
"" "" "" "" "" "" "" "" "" "" "" "" "Masked Wordcloud ================ Using a mask From PIL import Image import numpy as NP import Matplotlib.pyplot as PLT from Wordcloud import Wordcloud, stopwords ' this I want to get rid of the word "reply" in the data, because it belongs to impurities, directly removed will be reported coding errors, with #-*-Coding:utf-8-*-can not be resolved, so find this method, change the default encoding, do not know what th
A long time ago wrote an article how to use micro-blogging data to make the word cloud picture out, before the incomplete, and can only use their own data, now reorganize, anyone's micro-blogging data can be produced, even Python small white can be done in minutes. preparatory work
This environment is based on Python3, theoretically Python2.7 is also feasible, first installs the necessary third party to rel
Wordclou: Generating word clouds from textI. Word cloud settings1Wc=wordcloud (width=400, height=200,#Canvas long, wide, default (400,200) pixels2Margin=1,#the distance between the word and the word3Background_color=' White',#Background Color4Min_font_size=3,max_font_size=none,#minimum, maximum font size displayed5MAX_
All about SkyDrive.
Office 2013 is closely integrated with Microsoft's SkyDrive Network Service, where SkyDrive or Windows Live accounts can be seen everywhere.
All components of Office 2013 have a Windows Live account in the upper-right corner
With the SkyDrive sync feature, we can save documents to the cloud, or open documents from the cloud to edit them, and actually do what the Office 2013 demo sho
either be a character vector, or Corpus. If it is a vector and freq isMissing, standard stop words is removed prior to plotting.Installation:Install.packages (' Wordcloud ')Example:Wordcloud (c (Letters, letters, 0:9), seq (1, +, Len = 62))Specific Use examples:1. Example of direct image displayClick ( here) to collapse or open
#加载wordcloud包
Library (Wordcloud)
#指定字体颜色范围 or use the ready-made theme template colors=brewer.pal (8, "DARK2") in the R color package
Color
This article describes the PHP implementation of the word frequency to generate a tag cloud method. Share to everyone for your reference. Specifically as follows:
Given a piece of text, analyze the word frequency distribution of text, generate tag cloud
I hope this article will help you with your PHP program
{ -n++; - } - Else /*when the character is a space or a.*/ + { - if(n)/*if n is not 0*/ + { A if(CNT)/*CNT After the second time, preceded by a space*/ at { -printf" "); - } -printf"%d", n);/*if n is not 0, output n*/ -cnt++;/*CNT After the second time, preceded by a space*/ - } inn =0;/*when the character is a space or a., clear 0 N*/ - } to } +} NetEase
1. Prepare text data2. Pip Install Jieba3. Pip Install Wordcloud4. Download fonts such as SONGTI.TTC (salutation under Mac system and place fonts under project folder) fromOsImportPath fromScipy.miscImportImreadImportMatplotlib.pyplot as PltImportJieba fromWordcloudImportWordcloudtext=cleaned_comments #文本数据cut_text=' '. Join (Jieba.lcut (text))Print(cut_text) Color_mask= Imread ("cat.jpg") Cloud=Wordcloud (Font_path='SONGTI.TTC', the # font is best pl
Sometimes we want to save Word documents to the cloud network disk, but some of the domestic network disk to register, and send free capacity is not small, in Word2013, with the SkyDrive function, you can always save the document to the cloud disk, the following is a detailed procedure method.
① We click the menu bar--FILE--Save as--xxx SkyDrive, click the brows
New image file After selecting channels panel, new ALPHA1 channel: input text;
• Make Izumo stone dot texture: filter->noise->add noise, reference value: Amount:240;distribution:gaussian. The following figure action:
• Ctrl+d to remove the selection range, make diffusion effect: Filter->stylize->diffuse,mode select Normal;
• Drag ALPHA1 to the new channel icon to copy the ALPHA2, Alpha2 Gaussian Blur: Filter->blur->gaussian Blur, take 0.3-0.7 fuzzy effect;
• Return to RGB mode
sentenceS1 =SNOWNLP (s.sentences[0]) s1.sentiments0.8849970682062196#Positive Emotion#analysis It's hard to love one more dayS1 = SNOWNLP (s.sentences[-2]) s1.sentiments0.21646625648493734#This is a bad mood.Iv. ConclusionLife is learned everywhere, every kind of code learning will make your life colorful, immersed in the Jay of the beautiful song, with emotional code analysis Jay feelings of the world, feel the world all in the code with the beating.Article Source: 1190000010108177Mattered per
Very simple:ImportWordcloudImportJiebaImportTimestart=Time.perf_counter () F=open ('Xyy.txt','R', encoding='GBK')#The coding format here is not well understood, some with utf-8, some with GBKt=F.read () f.close () LS=jieba.lcut (t) txt=' '. Join (LS) W=wordcloud. Wordcloud (font_path='MSYH.TTC', width=1000,height=700,stopwords={}) w.generate (TXT) w.to_file ('getaway. png') Dur=time.perf_counter ()-StartPrint('time-consuming {0:.2}s'. Format (dur))Console output: Time consuming 7.4sFile output:P
A cool feature of Python is that it's easy to implement the word cloud. The GitHub has open source code on this project: Https://github.com/amueller/word_cloud Note that the Wordcloud folder is deleted when you run the routine The function of the word cloud is partly based on NLP, partly based on the image, as an
The following is the generated word cloud
My environment: mac,anaconda,python2.7, and a variety of Python libraries to use first Anaconda
Anaconda is a Python release that can be used for scientific computing, supporting Linux, MAC, and Windows systems, with built-in scientific computing packages in common use. It solves two big pain points in official Python. First: Provides the package management function
Recently collected the day Cat search page about the windbreaker baby information and 14,676 comments data. So I thought about making a word cloud about the comment data.Let's take a look at the effect chart:
From the above picture can see clothes, good, quality, good, like the larger keywords, that the baby in the day cat should be sold better. The specific implementation process is documented below.[TOC]
"' Import osimport Jieba # Word packet import NumPy # NumPy Compute Package Import Codecs # codecs provides the open method to specify the language encoding of the opened file, It is automatically converted to the internal Unicodeimport Pandas # Statistics Toolkit on read, import matplotlib.pyplot as Pltfrom wordcloud import Wordcloud, Imagecolorgenerator # Word Cloud
Word cloud is a way to display, although in absolute terms there is no way to give too much information, but can give people a stronger visual feeling.
This thing is mainly fun.
The individual modified a little on the basis of the original author to suit his environment. The source code is as follows:
Author: Digging numberLink: https://www.zhihu.com/question/28975391/answer/100796070Source: KnowCopyright b
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.