国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術文章
文章詳情頁

基于python生成英文版詞云圖代碼實例

瀏覽:11日期:2022-07-25 13:47:32

 使用wordcloud模塊,生成云圖,測試文本為:

Betty Botter bought some butter but she said the butter’s bitter. If I put it in my batter it will make my batter bitter. So, she bought some better butter, better than the bitter butter and she put it in her batter and her batter was not bitter. So ’twas good that Betty Botter bought some better butter.

生成云圖代碼:

#導入生成云圖模塊from wordcloud import WordCloudwith open('F:/python入門/數據2/fenci_test2.txt' ,encoding='utf-8')as file: #讀取文本 text=file.read() #設置詞云的字體、背景顏色、寬、高、字數 wordcloud=WordCloud(font_path='C:/Windows/Fonts/Tahoma.ttf', background_color='black',width=600, height=300,max_words=50).generate(text) #生成圖片 image=wordcloud.to_image() #顯示圖片 image.show()

結果:

基于python生成英文版詞云圖代碼實例

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持好吧啦網。

標簽: Python 編程
相關文章:
主站蜘蛛池模板: 建平县| 青州市| 探索| 东乡族自治县| 桂东县| 绿春县| 扶绥县| 晴隆县| 五寨县| 乐至县| 锡林郭勒盟| 南雄市| 庐江县| 德惠市| 建平县| 阜南县| 晋江市| 广丰县| 延边| 佛冈县| 康定县| 青岛市| 普宁市| 友谊县| 元朗区| 通州区| 星子县| 河池市| 墨脱县| 兴国县| 平泉县| 修武县| 长沙市| 克拉玛依市| 湄潭县| 昌宁县| 张家港市| 普陀区| 浦城县| 安国市| 稻城县|