Short description
Project description
MIT License
Copyright (c) [year] [fullname]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
模块介绍
分词统计
1,导入模块
from scripy_utils.word_ans_util import WordCloudUtil
2,中文词云
characters = """对素食者和肠胃疾病患者来说,藜麦的发现是一个奇迹。藜麦不含麸质,富含镁和铁,比其他种子含有更多的蛋白质,包括人体无法独自生成的必需的氨基酸。美国宇航局宣布,藜麦是地球上营养最均衡的食物之一,是宇航员的理想之选。产于安第斯山的藜麦有一个令西方消费者神往的传说:印加人非常重视藜麦,认为它是神圣的,并且称之为“万谷之母”。不过,藜麦的爱好者却通过媒体发现了一个令人不安的事实。从2006年到2013年,玻利维亚和秘鲁的藜麦价格上涨了两倍。2011年,《独立报》称,玻利维亚的藜麦消费量“5年间下降了34%,当地家庭已经吃不起这种主食了,它已经变成了奢侈品”。《纽约时报》援引研究报告称,藜麦种植区的儿童营养不良率正在上升。2013年,《卫报》用煽动性标题提升了人们对这个问题的关注度:“素食者的肚子能装下藜麦令人反胃的事实吗?”该报称,贫穷的玻利维亚人和秘鲁人正在食用更加便宜的“进口垃圾食品”。《独立报》2013年一篇报道的标题是“藜麦:对你有利--对玻利维亚人有害”。这些消息传遍了全球,在健康饮食者之中引发了一场良心危机。在社交媒体、素食博客和健康饮食论坛上,人们开始询问食用藜麦是否合适。"""
# 找适配中文的字体
font_path = fr"G:\ContentPro\PythonPro\PiPyPro\static\ttf\simhei.ttf"
# 词云的背景图片
mask_img_path = fr"G:\ContentPro\PythonPro\PiPyPro\爬虫使用\scripy_utils\media\wordcloud_imgs\2.jpg"
# 生成词云的存储位置
cloud_output_path = "img.jpg"
word_cloud = WordCloudUtil(characters, font_path=font_path, cloud_output_path=cloud_output_path,
mask_img_path=mask_img_path)
word_cloud.create_wordcloud()
更多方法请看模块,或者联系作者一起探讨。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file scripy_utils-0.0.3.tar.gz
.
File metadata
- Download URL: scripy_utils-0.0.3.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a34fd9a8d68ae7b9d13c62547a0be4fc21cb64d1b4316fff572204a9fef3c4d0 |
|
MD5 | 7e7829a743286fd213109caf77b24dea |
|
BLAKE2b-256 | c9287ce543087fe6f5e0b57946075c601c380ef0a958da00a7a846be0de7b7b2 |
File details
Details for the file scripy_utils-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: scripy_utils-0.0.3-py3-none-any.whl
- Upload date:
- Size: 1.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c95ac37b28877831f529514630f0d9db2dc98c07144becf3cb1daac70f23f58f |
|
MD5 | ffa1e80a623fed0693c699dc31d87bac |
|
BLAKE2b-256 | 3142a0c041a23d855c09d059393b009632bf704a49b5e8206b5657f7262b29f6 |