scripy-utils


Namescripy-utils JSON
Version 0.0.3 PyPI version JSON
download
home_pagehttps://gitee.com/SkyOceanchen/scripy_utils.git
SummaryShort description
upload_time2024-06-07 06:16:19
maintainerSkyOceanChen
docs_urlNone
authorSkyOceanChen
requires_python~=3.3
licenseMIT
keywords basic_type python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            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,导入模块

```python
from scripy_utils.word_ans_util import WordCloudUtil
```

2,中文词云

```python
characters = """对素食者和肠胃疾病患者来说,藜麦的发现是一个奇迹。藜麦不含麸质,富含镁和铁,比其他种子含有更多的蛋白质,包括人体无法独自生成的必需的氨基酸。美国宇航局宣布,藜麦是地球上营养最均衡的食物之一,是宇航员的理想之选。产于安第斯山的藜麦有一个令西方消费者神往的传说:印加人非常重视藜麦,认为它是神圣的,并且称之为“万谷之母”。不过,藜麦的爱好者却通过媒体发现了一个令人不安的事实。从2006年到2013年,玻利维亚和秘鲁的藜麦价格上涨了两倍。2011年,《独立报》称,玻利维亚的藜麦消费量“5年间下降了34%,当地家庭已经吃不起这种主食了,它已经变成了奢侈品”。《纽约时报》援引研究报告称,藜麦种植区的儿童营养不良率正在上升。2013年,《卫报》用煽动性标题提升了人们对这个问题的关注度:“素食者的肚子能装下藜麦令人反胃的事实吗?”该报称,贫穷的玻利维亚人和秘鲁人正在食用更加便宜的“进口垃圾食品”。《独立报》2013年一篇报道的标题是“藜麦:对你有利--对玻利维亚人有害”。这些消息传遍了全球,在健康饮食者之中引发了一场良心危机。在社交媒体、素食博客和健康饮食论坛上,人们开始询问食用藜麦是否合适。"""
```

```python
# 找适配中文的字体
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()


```

![](https://mmbiz.qpic.cn/sz_mmbiz_png/BvGyVvvMmy0r3aXPwt6o7xk7VhHYEI4X9UDVrKib74r3ec23Xcra2no08HXJG3vGXX9k58FEHC2jiaDQrhlf7XXw/640?wx_fmt=png)
更多方法请看模块,或者联系作者一起探讨。


            

Raw data

            {
    "_id": null,
    "home_page": "https://gitee.com/SkyOceanchen/scripy_utils.git",
    "name": "scripy-utils",
    "maintainer": "SkyOceanChen",
    "docs_url": null,
    "requires_python": "~=3.3",
    "maintainer_email": "skyoceanchen@foxmail.com",
    "keywords": "basic_type, python",
    "author": "SkyOceanChen",
    "author_email": "skyoceanchen@foxmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c9/28/7ce543087fe6f5e0b57946075c601c380ef0a958da00a7a846be0de7b7b2/scripy_utils-0.0.3.tar.gz",
    "platform": null,
    "description": "MIT License\r\n\r\nCopyright (c) [year] [fullname]\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\r\ndocumentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the\r\nrights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit\r\npersons to whom the Software is furnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the\r\nSoftware.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\r\nWARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\r\nOTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n\r\n# \u6a21\u5757\u4ecb\u7ecd\r\n\r\n## \u5206\u8bcd\u7edf\u8ba1\r\n\r\n1,\u5bfc\u5165\u6a21\u5757\r\n\r\n```python\r\nfrom scripy_utils.word_ans_util import WordCloudUtil\r\n```\r\n\r\n2,\u4e2d\u6587\u8bcd\u4e91\r\n\r\n```python\r\ncharacters = \"\"\"\u5bf9\u7d20\u98df\u8005\u548c\u80a0\u80c3\u75be\u75c5\u60a3\u8005\u6765\u8bf4\uff0c\u85dc\u9ea6\u7684\u53d1\u73b0\u662f\u4e00\u4e2a\u5947\u8ff9\u3002\u85dc\u9ea6\u4e0d\u542b\u9eb8\u8d28\uff0c\u5bcc\u542b\u9541\u548c\u94c1\uff0c\u6bd4\u5176\u4ed6\u79cd\u5b50\u542b\u6709\u66f4\u591a\u7684\u86cb\u767d\u8d28\uff0c\u5305\u62ec\u4eba\u4f53\u65e0\u6cd5\u72ec\u81ea\u751f\u6210\u7684\u5fc5\u9700\u7684\u6c28\u57fa\u9178\u3002\u7f8e\u56fd\u5b87\u822a\u5c40\u5ba3\u5e03\uff0c\u85dc\u9ea6\u662f\u5730\u7403\u4e0a\u8425\u517b\u6700\u5747\u8861\u7684\u98df\u7269\u4e4b\u4e00\uff0c\u662f\u5b87\u822a\u5458\u7684\u7406\u60f3\u4e4b\u9009\u3002\u4ea7\u4e8e\u5b89\u7b2c\u65af\u5c71\u7684\u85dc\u9ea6\u6709\u4e00\u4e2a\u4ee4\u897f\u65b9\u6d88\u8d39\u8005\u795e\u5f80\u7684\u4f20\u8bf4\uff1a\u5370\u52a0\u4eba\u975e\u5e38\u91cd\u89c6\u85dc\u9ea6\uff0c\u8ba4\u4e3a\u5b83\u662f\u795e\u5723\u7684\uff0c\u5e76\u4e14\u79f0\u4e4b\u4e3a\u201c\u4e07\u8c37\u4e4b\u6bcd\u201d\u3002\u4e0d\u8fc7\uff0c\u85dc\u9ea6\u7684\u7231\u597d\u8005\u5374\u901a\u8fc7\u5a92\u4f53\u53d1\u73b0\u4e86\u4e00\u4e2a\u4ee4\u4eba\u4e0d\u5b89\u7684\u4e8b\u5b9e\u3002\u4ece2006\u5e74\u52302013\u5e74\uff0c\u73bb\u5229\u7ef4\u4e9a\u548c\u79d8\u9c81\u7684\u85dc\u9ea6\u4ef7\u683c\u4e0a\u6da8\u4e86\u4e24\u500d\u30022011\u5e74\uff0c\u300a\u72ec\u7acb\u62a5\u300b\u79f0\uff0c\u73bb\u5229\u7ef4\u4e9a\u7684\u85dc\u9ea6\u6d88\u8d39\u91cf\u201c5\u5e74\u95f4\u4e0b\u964d\u4e8634\uff05\uff0c\u5f53\u5730\u5bb6\u5ead\u5df2\u7ecf\u5403\u4e0d\u8d77\u8fd9\u79cd\u4e3b\u98df\u4e86\uff0c\u5b83\u5df2\u7ecf\u53d8\u6210\u4e86\u5962\u4f88\u54c1\u201d\u3002\u300a\u7ebd\u7ea6\u65f6\u62a5\u300b\u63f4\u5f15\u7814\u7a76\u62a5\u544a\u79f0\uff0c\u85dc\u9ea6\u79cd\u690d\u533a\u7684\u513f\u7ae5\u8425\u517b\u4e0d\u826f\u7387\u6b63\u5728\u4e0a\u5347\u30022013\u5e74\uff0c\u300a\u536b\u62a5\u300b\u7528\u717d\u52a8\u6027\u6807\u9898\u63d0\u5347\u4e86\u4eba\u4eec\u5bf9\u8fd9\u4e2a\u95ee\u9898\u7684\u5173\u6ce8\u5ea6\uff1a\u201c\u7d20\u98df\u8005\u7684\u809a\u5b50\u80fd\u88c5\u4e0b\u85dc\u9ea6\u4ee4\u4eba\u53cd\u80c3\u7684\u4e8b\u5b9e\u5417\uff1f\u201d\u8be5\u62a5\u79f0\uff0c\u8d2b\u7a77\u7684\u73bb\u5229\u7ef4\u4e9a\u4eba\u548c\u79d8\u9c81\u4eba\u6b63\u5728\u98df\u7528\u66f4\u52a0\u4fbf\u5b9c\u7684\u201c\u8fdb\u53e3\u5783\u573e\u98df\u54c1\u201d\u3002\u300a\u72ec\u7acb\u62a5\u300b2013\u5e74\u4e00\u7bc7\u62a5\u9053\u7684\u6807\u9898\u662f\u201c\u85dc\u9ea6\uff1a\u5bf9\u4f60\u6709\u5229--\u5bf9\u73bb\u5229\u7ef4\u4e9a\u4eba\u6709\u5bb3\u201d\u3002\u8fd9\u4e9b\u6d88\u606f\u4f20\u904d\u4e86\u5168\u7403\uff0c\u5728\u5065\u5eb7\u996e\u98df\u8005\u4e4b\u4e2d\u5f15\u53d1\u4e86\u4e00\u573a\u826f\u5fc3\u5371\u673a\u3002\u5728\u793e\u4ea4\u5a92\u4f53\u3001\u7d20\u98df\u535a\u5ba2\u548c\u5065\u5eb7\u996e\u98df\u8bba\u575b\u4e0a\uff0c\u4eba\u4eec\u5f00\u59cb\u8be2\u95ee\u98df\u7528\u85dc\u9ea6\u662f\u5426\u5408\u9002\u3002\"\"\"\r\n```\r\n\r\n```python\r\n# \u627e\u9002\u914d\u4e2d\u6587\u7684\u5b57\u4f53\r\nfont_path = fr\"G:\\ContentPro\\PythonPro\\PiPyPro\\static\\ttf\\simhei.ttf\"\r\n# \u8bcd\u4e91\u7684\u80cc\u666f\u56fe\u7247\r\nmask_img_path = fr\"G:\\ContentPro\\PythonPro\\PiPyPro\\\u722c\u866b\u4f7f\u7528\\scripy_utils\\media\\wordcloud_imgs\\2.jpg\"\r\n# \u751f\u6210\u8bcd\u4e91\u7684\u5b58\u50a8\u4f4d\u7f6e\r\ncloud_output_path = \"img.jpg\"\r\nword_cloud = WordCloudUtil(characters, font_path=font_path, cloud_output_path=cloud_output_path,\r\n                           mask_img_path=mask_img_path)\r\nword_cloud.create_wordcloud()\r\n\r\n\r\n```\r\n\r\n![](https://mmbiz.qpic.cn/sz_mmbiz_png/BvGyVvvMmy0r3aXPwt6o7xk7VhHYEI4X9UDVrKib74r3ec23Xcra2no08HXJG3vGXX9k58FEHC2jiaDQrhlf7XXw/640?wx_fmt=png)\r\n\u66f4\u591a\u65b9\u6cd5\u8bf7\u770b\u6a21\u5757\uff0c\u6216\u8005\u8054\u7cfb\u4f5c\u8005\u4e00\u8d77\u63a2\u8ba8\u3002\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Short description",
    "version": "0.0.3",
    "project_urls": {
        "Homepage": "https://gitee.com/SkyOceanchen/scripy_utils.git"
    },
    "split_keywords": [
        "basic_type",
        " python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3142a0c041a23d855c09d059393b009632bf704a49b5e8206b5657f7262b29f6",
                "md5": "ffa1e80a623fed0693c699dc31d87bac",
                "sha256": "c95ac37b28877831f529514630f0d9db2dc98c07144becf3cb1daac70f23f58f"
            },
            "downloads": -1,
            "filename": "scripy_utils-0.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ffa1e80a623fed0693c699dc31d87bac",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.3",
            "size": 1176480,
            "upload_time": "2024-06-07T06:16:09",
            "upload_time_iso_8601": "2024-06-07T06:16:09.771462Z",
            "url": "https://files.pythonhosted.org/packages/31/42/a0c041a23d855c09d059393b009632bf704a49b5e8206b5657f7262b29f6/scripy_utils-0.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c9287ce543087fe6f5e0b57946075c601c380ef0a958da00a7a846be0de7b7b2",
                "md5": "7e7829a743286fd213109caf77b24dea",
                "sha256": "a34fd9a8d68ae7b9d13c62547a0be4fc21cb64d1b4316fff572204a9fef3c4d0"
            },
            "downloads": -1,
            "filename": "scripy_utils-0.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "7e7829a743286fd213109caf77b24dea",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.3",
            "size": 1175057,
            "upload_time": "2024-06-07T06:16:19",
            "upload_time_iso_8601": "2024-06-07T06:16:19.917269Z",
            "url": "https://files.pythonhosted.org/packages/c9/28/7ce543087fe6f5e0b57946075c601c380ef0a958da00a7a846be0de7b7b2/scripy_utils-0.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-07 06:16:19",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "scripy-utils"
}
        
Elapsed time: 0.52276s