中文简易词云(chineseEasyWordcloud)
中文简易词云是一个Python库,旨在帮助初学者更轻松地制作中文词云。
注意: 请务必指定字体路径,否则默认字体无法正确显示中文
安装
你可以使用 pip命令来安装该库:
pip install chineseEasyWordcloud
使用方法
安装完成后,你可以在命令行中使用该库。运行以下命令查看可用选项:
chinese-wordcloud -h
示例
命令行示例:
chinese-wordcloud "你好呀,我是宽宽" -o output.png --font_path "path/to/your_chinese_font.ttf" --width 1920 --height 1080
注意: 在命令行中可以直接使用 -f file file file来添加多个文件或者使用 -d dir ignored1 ignored2
e.g.
chinese-wordcloud -f "path/to/your_files1.txt" "path/to/your_files2.txt" -o output.png --font_path "path/to/your_chinese_font.ttf" --width 1920 --height 1080
此命令会读取path/to/your_files1.txt和path/to/your_files2.txt中的内容并作为词云的输入文本
chinese-wordcloud -d "path/to/your_dir" ".git" -o output.png --font_path "path/to/your_chinese_font.ttf" --width 1920 --height 1080
此命令会读取path/to/your_dir中除去.git以外的所有文件并作为词云的输入文本
Python示例:
import chineseEasyWordcloud
# 加载中文文本
text = "这是一段中文文本"
# 创建词云图像
chineseEasyWordcloud.generate(text, "wordcloud.png",font_path='path/to/your_chinese_font.ttf')
注意: 以下内容适合对词云有相对简单的自定义要求的朋友,小白直接运行generate函数或者chinese-wordcloud命令即可,大佬嘛。。。应该也不用看我这屎山库。
在 chineseEasyWordcloud.cut中提供了一些常用的额外处理函数:
cutChinese用于中文分词removeStopwords用于去除停止词(过于常见但无意义的词,比如“你”,“的”等),默认使用chineseEasyWordcloud.stopwords.getDefault()的内容,也可以自定义removeWhiteSpace用于去除空白内容,比如空字符串,空格等removeNonsenseCharacter用于去除无意义的字符,比如标点符号,换行符等cutWordDefault依次调用上述方法
同时,在 chineseEasyWordcloud.easyWordcloud中提供了一些生成词云的方法,
countWords统计词频generateWc用于生成Wordcloud对象generate(就是chineseEasyWordcloud.generate)用于生成Wordcloud对象并导出为文件
贡献
欢迎贡献!如果你发现任何问题或有改进建议,请在该项目的 GitHub 页面上提出 issue。
许可证
该项目基于 MPL-2.0 协议。
Metadata
Release files for chineseEasyWordcloud 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chineseEasyWordcloud-0.0.1.tar.gz | 16.8 kB | Without provenance | Details for chineseEasyWordcloud-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chineseEasyWordcloud-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for chineseEasyWordcloud-0.0.1-py3-none-any.whl |
Total release size: 46.0 kB
Release files / chineseEasyWordcloud-0.0.1.tar.gz
| Download URL | chineseEasyWordcloud-0.0.1.tar.gz |
|---|---|
| Size | 16.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a253be24c28273540eac629ccf90fabe0b560eac0e1555d57e1285fc0da8c2c0
|
|
BLAKE2b-256 checksum How to use checksums |
39505a0763493d33c3e38bd7d412f72ce7c9901c2e1c20afe4f753df50718254
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.11
|
Release files / chineseEasyWordcloud-0.0.1-py3-none-any.whl
| Download URL | chineseEasyWordcloud-0.0.1-py3-none-any.whl |
|---|---|
| Size | 29.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d8620f8818942ecc6b4d85395e74ec43b488c2f8a0bdebf33f1636f85627f457
|
|
BLAKE2b-256 checksum How to use checksums |
c43f2a8188414a83d41b42ca372e5de1173839f290fd720dd90f9c2a40a042d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.11
|
Security for chineseEasyWordcloud 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.