Skip to main content

They're really some great tools!

Project description

Chaostools

They're really some great tools!

超棒的一些工具!

In chaos, order and hope will also be revealed.

混沌中,也会透露出有序与希望。

If you want to add your tools, please contact the author of this library! (E-mail: admin@wcfstudio.cn)

如果你想添加你的工具,请联系这个库的作者!(电子邮箱:admin@wcfstudio.cn)

Simple Tutorial

  1. meanAgree(text,lang='zh-cn')

    • Example 例子
    import chaostools
    
    # Chinese
    print(chaostools.meanAgree("是的"))
    # True
    print(chaostools.meanAgree("你好"))
    # False
    print(chaostools.meanAgree("123"))
    # False
    print(chaostools.meanAgree("Yes"))
    # False
    
    # English
    print(chaostools.meanAgree("Yes"))
    # True
    print(chaostools.meanAgree("Hello"))
    # False
    print(chaostools.meanAgree("456"))
    # False
    print(chaostools.meanAgree("是的"))
    # False
    
    • Explanation 解释

      This is a function that can determine whether it represents agreement, approval, and permission, supporting both Chinese and English.

      这是一个可以判断是否表示同意、认可、允许的函数,支持中英双语。

      Note: The first letter of English should be capitalized. Sentence ending punctuation (such as . ... ! ?) is not allowed in both Chinese and English.

      注意:英文的首字母要大写。中英文均不得出现句末标点(如。 …… ! ?)。

  2. bdbk(word, id=None, mu_first=False)

    • Example 例子
    import chaostools
    
    # Basic
    print(chaostools.bdbk("昔阳县"))
    # {'status': 'OK', 'id': '5631351', 'description': '昔阳县,隶属于山西省晋中市,位于晋中市东部、太行山西麓,东与河北省赞皇县、内丘县、井陉县、邢台市接壤,西与寿阳县为邻,南与和顺县毗连,北与平定县相衔。总面积1954平方千米。截至2022年末,昔阳县常住人口186614人。商朝时期,属微。东汉建安末年(219年)为乐平郡,隋大业初年改为乐平县。民国元年(1912年),恢复乐平县,归中路道。1968年,晋中专区改设晋中地区,昔阳县仍属之。截至2021年10月,昔阳县下辖5个镇、5个乡和1个管委会。县政府驻乐平镇育新巷10号。昔阳县地方特产有昔阳小米、杏鲍菇。有大寨、龙岩大峡谷等风景名胜。2023年,昔阳县地区生产总值163.0亿元,比2022年增长5.1%。', 'contents': ['昔阳县', '昔阳县历史沿革', '昔阳县行政区划', '昔阳县地理环境', '昔阳县自然资源', '昔阳县人口', '昔阳县政治', '昔阳县经济', '昔阳县交通运输', '昔阳县社会事业', '昔阳县风景名胜', '昔阳县地方特产', '昔阳县著名人物', '昔阳县荣誉称号', '昔阳县现任领导'], 'contents_len': 15}
    print(chaostools.bdbk("昔阳县")["status"])
    # OK
    print(chaostools.bdbk("昔阳县")["id"])
    # 5631351
    print(chaostools.bdbk("昔阳县")["description"])
    # 昔阳县,隶属于山西省晋中市,位于晋中市东部、太行山西麓,东与河北省赞皇县、内丘县、井陉县、邢台市接壤,西与寿阳县为邻,南与和顺县毗连,北与平定县相衔。总面积1954平方千米。截至2022年末,昔阳县常住人口186614人。商朝时期,属微。东汉建安末年(219年)为乐平郡,隋大业初年改为乐平县。民国元年(1912年),恢复乐平县,归中路道。1968年,晋中专区改设晋中地区,昔阳县仍属之。截至2021年10月,昔阳县下辖5个镇、5个乡和1个管委会。县政府驻乐平镇育新巷10号。昔阳县地方特产有昔阳小米、杏鲍菇。有大寨、龙岩大峡谷等风景名胜。2023年,昔阳县地区生产总值163.0亿元,比2022年增长5.1%。
    
    # Others
    print(chaostools.bdbk("1450"))
    # {'status': 'MU', 'bdbk_multimeanings': [{'meaning': '中国台湾人对民进党网军的戏称', 'id': '56654602'}, {'meaning': '在爱情里表示“你是我的”', 'id': '63224232'}]}
    print(chaostools.bdbk("1450", id=chaostools.bdbk("1450")["bdbk_multimeanings"][1]["id"]))
    # {'status': 'OK', 'id': '63224232', 'description': '1450,在爱情里表示“你是我的”。', 'contents': ['1450'], 'contents_len': 1}
    print(chaostools.bdbk("1450", mu_first=True))
    # {'status': 'OK', 'id': '56654602', 'description': '1450,网络流行语,中国台湾人对民进党网军的戏称。', 'contents': ['1450', '1450引申含义', '1450社会评价'], 'contents_len': 3}
    
    • Explanation 解释

      This is a function used to crawl information from Baidu Baike.

      这是一个用来爬取百度百科信息的函数。

      Parameter 参数

      • word

        Keyword. 关键词。

      • id=None

        The unique ID of the specified entry. 指定的词条唯一ID。

      • mu_first=False

        When the keyword is a polysemous word, does it default to obtaining the content of the first semantic item. 当关键词是一个多义词时,是否默认获取第一个义项的内容。

      Return 返回

      • status

        Status value: OK represents successful acquisition, ML represents polysemous words (and there is no ID or default setting for the first item).

        状态值:OK代表获取成功,ML表示多义词(且没有ID和默认第一项的设置)。

      • The rest have literal meanings and do not need to be repeated. 其余的就是字面意思,无需赘述。

      Note: The description is only a brief and overview section.

      注意:description只是简述、概述部分。

  3. hitokoto(c="", t=False, i=False, min_length=0, max_length=30)

    No nonsense, direct official link.

    不废话,官方链接直达

    Note: The parameter t is whether to return plain text results (if t=False or the default value, a Python dictionary object after parsing the request results is returned), and the parameter i is whether to use overseas lines with higher QPS values. yiyan() is equivalent to this function.

    注意:参数 t 是是否返回纯文字结果(如果 t=False 即默认值,则返回一个请求结果解析后的 Python 字典对象),参数 i 是是否使用 QPS 值更高的海外线路。yiyan() 等同于此函数。

    • Example 例子
    import chaostools
    
    print(chaostools.hitokoto())
    # {'id': 6054, 'uuid': '36d1f4a5-2a34-4489-b776-f2857c8baf47', 'hitokoto': '想一个人有多想念,那又是文字失效瞬间。', 'type': 'j', 'from': '仓颉', 'from_who': '五月天', 'creator': '小杨', 'creator_uid': 5943, 'reviewer': 1044, 'commit_from': 'web', 'created_at': '1587639189', 'length': 19}
    print(chaostools.hitokoto(t=True))
    # 世界上是没有会消失的无影无踪的事物的,亲人也是,梦想也是。
    print(chaostools.hitokoto(max_length=3))
    # {'id': 5031, 'uuid': 'b10c93c2-281d-4000-919d-fd344c355691', 'hitokoto': '加油', 'type': 'a', 'from': '自编', 'from_who': None, 'creator': 'chibin', 'creator_uid': 4532, 'reviewer': 4756, 'commit_from': 'web', 'created_at': '1577117480', 'length': 2}{'id': 5031, 'uuid': 'b10c93c2-281d-4000-919d-fd344c355691', 'hitokoto': '加油', 'type': 'a', 'from': '自编', 'from_who': None, 'creator': 'chibin', 'creator_uid': 4532, 'reviewer': 4756, 'commit_from': 'web', 'created_at': '1577117480', 'length': 2}
    print(chaostools.yiyan())
    # {'id': 9122, 'uuid': '51d2a015-6df3-4507-8d75-a5e48863d1a5', 'hitokoto': '神即道,道即法,道法自然,如来。', 'type': 'l', 'from': '遥远的救世主', 'from_who': '豆豆', 'creator': 'erfie', 'creator_uid': 13776, 'reviewer': 1044, 'commit_from': 'web', 'created_at': '1671076363', 'length': 16}
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chaostools-0.0.5.tar.gz (7.2 kB view hashes)

Uploaded Source

Built Distribution

chaostools-0.0.5-py3-none-any.whl (7.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page