当前位置:网站首页>Dragon Boat Festival wellbeing, use blessing words to generate word cloud
Dragon Boat Festival wellbeing, use blessing words to generate word cloud
2022-06-13 06:20:00 【Jia ming】
You will see :
- With the help of wordcloud+jieba Word cloud generation
- How to batch modify file names
List of articles
1. Blessing words text preparation
source :https://zhuanlan.zhihu.com/p/351042572
wordcloud.txt
The flowers are charming , Alcohols , If you don't get drunk, everyone will get drunk ; The water is clear , Honey is thick , Honey is not sweet, everyone is sweet ; Happy holidays , Dumplings are fragrant , Dumplings are not charming, people are fascinated by themselves . Dragon Boat Festival , Every man is happy when he is not happy !
It is forbidden to ignore me during the Dragon Boat Festival , Don't eat brown. Forget me , Don't pack brown and don't help me , Don't miss me in your spare time , It is forbidden not to send funny information to me , Happy Dragon Boat Festival !
Today is the Dragon Boat Festival , May you ride the dragon boat of good luck , Drink a cup of realgar wine , Pick a long-lived wormwood leaf , Wear an auspicious sachet , Eat a sweet dumpling , Have a peaceful family , One more happy smile . I wish you a happy Dragon Boat Festival , Family reunion , All the best !
nail : This year's Dragon Boat Festival , Did your boss send you zongzi or something ? B : The boss lost his temper this year .
This year's rice dumplings are very special , With happy fillings ‘ Zongzi ’ Happiness , With peace fillings ‘ Zongzi ’ health , With auspicious fillings ‘ Zongzi ’ Ruyi , With wealth filling ‘ Zongzi ’ Good luck , You have to put away , Wish you a happy Dragon Boat Festival .
Today's Dragon Boat Festival , Let me trust the poet , Please eat more zongzi ; Occasionally busy , It doesn't mean forgetting ; The arrival of summer , May you be in a good mood , Once dropped greetings , This moment will be compensated together , All the care , Condense this message , I wish you a happy Dragon Boat Festival .
Booming Flowers and a Full Moon , Beautiful scenery often ; Dragon Boat Festival , I can't do without you ; Thousands of words , Bless forever ; Zongzi conveys affection , The sachet keeps you safe ; Realgar wine adds auspiciousness ; Best wishes , I wish you a happy Dragon Boat Festival !
The Dragon Boat Festival is coming , For you in advance “ End ” Best wishes : wish you happiness and good health , All the best , Happy Dragon Boat Festival ! Wormwood , Malanghuang , The beauty of the world is the Dragon Boat Festival .
Guidelines for the work of the Dragon Boat Festival , Based on friendship , Take the mobile phone as the platform , By means of SMS , Take blessing as the goal , Take you as the object of work , Take the smile as the assessment standard , After the work is finished, please have a rice dumpling feast .
Often miss you , I like your green appearance , Fall in love with your beautiful heart , I can't help but want to kiss you , I want to say out loud ‘ I love you! ~~ traditional Chinese rice-pudding ’, ha-ha , It's the Dragon Boat Festival , May you be happy with me , All the best .
Hoe in the Dragon Boat Festival , Sweat dripping under the grass . For Chinese food , Life is not afraid of hardship . Friends send blessings , Cool can relieve summer heat . A great career , Opportunities abound . Health is always there , Happiness is not lost ! Happy Dragon Boat Festival !
“ End ” With warm blessing ,“ Dance ” From the soft thoughts ,“ section ” Save all your time ,“ I wish ” Fu dear friend ,“ quasi ” Send a special message ,“ fast ” The speed at which the vehicle is dispatched ,“ Happy ” In your heart .
Everyone praises you for being quick and studious , What to learn is like , I remember the day you learned to sing from Andy Lau , It's really like . Here comes the Dragon Boat Festival , I think you should imitate Quyuan's suicide by jumping into the river , how ?
Just you ,“ Zongzi ” Is being cared for ; Kind you ,“ Zongzi ” To be protected ; Lovely you ,“ Zongzi ” Is loved by others . Today is the Dragon Boat Festival , I hope you today ,“ Zongzi ” Is to be blessed . Happy Dragon Boat Festival !
Light misty rain , A touch of sadness , The light moon , Go to the West Tower , Light fish swim in the water , A faint butterfly falls on the hydrangea , Light rouge, light wine , Light wine can relieve light sorrow , Light miss to friends , I wish you a happy Dragon Boat Festival !
What to eat at the Dragon Boat Festival ? traditional Chinese rice-pudding , Hang your stomach before eating , It tastes delicious , Insufficient stomach after eating . What do you play on the Dragon Boat Festival ? texting , Get excited before you start , Happy in the hair , Don't worry about it . May you enjoy the Dragon Boat Festival , Have fun !
The Dragon Boat Festival is a provincial custom : Shandong morning wine , It is said that it can ward off evil spirits and poisons ; Shaanxi Xing'an Temple race , Xingping plays puppets during the Dragon Boat Festival ; Youxian County, Hunan Province, for the dragon head , The straw boat splashed over the water to send the plague ; Jiading, Jiangsu, celebrated the Dragon Boat Festival , Whether rich or poor, buy minnows .
“ Zongzi ” I want to tell you , How much I miss ;“ Zongzi ” Want to tell you , My blessing is so romantic . The annual Dragon Boat Festival , Text messages are heard , ah ! I wish you a happy Dragon Boat Festival .
《 Red bean 》 Send Acacia ,《 Glutinous rice 》 Wish ,《 Big red dates 》 Report peace ,《 free range eggs 》 Love is full of ,《 Lotus leaf 》 Pack a bag , I wish you good luck in the Dragon Boat Festival , The whole family is happy , Smooth and smooth !
When you open your eyes , I hope you can see my blessing , I wish you a sunny mood ; Before you close your eyes , I want you to receive my greetings , Have a good dream at night , I wish you a happy Dragon Boat Festival !
Write the calamus Bamboo Leaf Cup alone , Pengcheng fragrant grass steps back for the first time . I don't want to die in Oujiang , How can the boat come here .
To be a stranger in a foreign land alone , Every festival “ Zongzi ” miss one's family . I know where my brother is , the trials of a long journey “ Zongzi ” It's love . The Dragon Boat Festival , To eat “ Zongzi ”, I wish you “ Zongzi ” Across the world ,“ Zongzi ” It's lucky ! Happy Dragon Boat Festival !
2. Download the pictures
3. Batch modify the image name
Write a function to batch file names , It should be noted that we only deal with a certain file type , such as .jpeg
file .
therefore , We need to Pass two parameters filePostFix
and rootdir
,filePostFix
Indicates the file suffix that needs to be modified ,rootdir
Indicates the path to traverse the file .
To achieve selective selection of files , The core code is if i[-len(filePostFix):] == filePostFix:
, Indicates that only the selected suffix file name is modified .
The default modified file name here is an incrementing number + Form of file suffix .
Use os Provided rename Method to change the name ,os.rename(oldname, newname)
.
def renameFiles(rootdir="./", filePostFix=".jpeg"):
# Get all the files in this directory , Put it in the list
fileList = os.listdir(rootdir)
index = 0
for i in fileList:
if i[-len(filePostFix):] == filePostFix:
# Get old file name ( Is the path + file name )
oldname = rootdir + os.sep + fileList[index] # os.sep Add system separator
# Set a new file name
newname = rootdir + os.sep + str(index) + filePostFix
os.rename(oldname, newname) # use os Module rename Method to rename the file
index += 1
Modified effect :
4. Read pictures in batch to generate word cloud
First, judge whether it is a picture file by the suffix of the file name , And then use jieba
The provided word segmentation tool divides the text into phrases , Use numpy
Of array
Method to read an image as a word cloud tool wordcloud
Parameters of , Finally using wordcloud
Read in text and pictures to generate word clouds .
def wordPic(rootdir="./", filePostFix=".jpeg"):
fileList = os.listdir(rootdir)
for i in fileList:
if i[-len(filePostFix):] == filePostFix:
with open("wordcloud.txt", encoding="utf-8") as fp:
text = fp.read()
# The string that receives the participle
word_list = jieba.cut(text)
# The participle is followed by a space between the individual individuals
text = " ".join(word_list)
# Read in template
mask = np.array(image.open(i))
wordcloud = WordCloud(
# Add mask layer
mask=mask,
font_path="C:\Windows\Fonts\SIMHEI.ttf",
background_color='white',
).generate(text)
wordcloud.to_image()
# image_produce.show()
wordcloud.to_file("word_pic" + i) # Save word cloud pictures
边栏推荐
- Detailed explanation of Yanghui triangle
- 《MATLAB 神经网络43个案例分析》:第10章 离散Hopfield神经网络的分类——高校科研能力评价
- Echart柱状图:堆叠柱状图显示value
- Time complexity and space complexity
- Fichier local second Search Tool everything
- Uni app provincial and urban linkage
- 万能播放器 PotPlayer 的下载与安装,直播流 m3u8 导入
- Wechat applet (pull-down refresh data) novice to
- Status management --provider
- Hbuilderx: installation of hbuilderx and its common plug-ins
猜你喜欢
万能播放器 PotPlayer 的下载与安装,直播流 m3u8 导入
智能数字资产管理助力企业决胜后疫情时代
HBuilderX:HBuilderX安装以及其常用插件安装
AI realizes "Resurrection" of relatives | old photo repair | old photo coloring, recommended by free app
A glimpse of [wechat applet]
【ONE·Data || 带头双向循环链表简单实现】
php 分布式事务 原理详解
Echart histogram: echart implements stacked histogram
Dart class inherits and implements mixed operators
Echart histogram: stacked histogram displays value
随机推荐
Echart line chart: different colors are displayed when the names of multiple line charts are the same
二分查找
USB 0xc0000011 error
Recommend a capacity expansion tool to completely solve the problem of insufficient disk space in Disk C and other disks
Complete USB debugging assistant
Solution: vscode open file will always overwrite the last opened label
Intelligent digital asset management helps enterprises win the post epidemic Era
超有范的 logo 在线设计制作工具
端午安康,使用祝福话语生成词云吧
USB debugging assistant
Applet pull-up loading data
Relationship between fragment lifecycle and activity
[JS] handwriting call(), apply(), bind()
Wechat applet: click the event to obtain the current device information (basic)
[written examination questions of meituan]
Echart折线图:当多条折线图的name一样时也显示不同的颜色
USB status error and its cause (error code)
Echart histogram: echart implements stacked histogram
万能播放器 PotPlayer 的下载与安装,直播流 m3u8 导入
Binary search