Saravanan666/pypi-org huggingface dataset:
Package: chin-dict
Project DescriptionPython library for manipulating Wikimedia Commons Character Info and CEDICT.Main featuresDecompose Chinese characters into sub-components with tree-like structureCharacter data such as radical, stroke number and traditional/simplified formWord lookup for meaning and pronunciationInstallationchin-dict is available on PyPI athttps://pypi.org/project/chin-dict/pip install chin-dictCommand line toolsTo make sure chin-dict is working properly, try looking up a word using the command linechindict 漏
---------------------------------------------
Character: 漏
Pinyin: ['lou4']
Meaning: ['to leak', 'to divulge', 'to leave out by mistake', 'waterclock or hourglass (old)']To see the tree structure, use -t flagchindict 漏 -t
-----------------------------
漏
├── 屚 (2)
│   ├── 尸 (3)
│   └── 雨 (4)
└── 氵 (1)To see the meaning of a component, pass its corresponding number to the -tm flagchindict 漏 -tm 4
-----------------------------
雨 meaning(s):
['rain', 'CL:陣|阵[zhen4],場|场[chang2]', 'to rain', '(of rain, snow etc) to fall', 'to precipitate', 'to wet']To lookup as a word instead of a character, use -w flagchindict 钱 -w
-----------------------------
Simplified: 钱
Traditional: 錢
Pinyin: Qian2
Meaning: ['surname Qian']

Simplified: 钱
Traditional: 錢
Pinyin: qian2
Meaning: ['coin', 'money', 'CL:筆|笔[bi3]', 'unit of weight, one tenth of a tael 兩|两[liang3]']To see the character's radical, use -r flagchindict 钱 -r
-----------------------------
金To see the meaning of a character's radical, use -rm flagchindict 钱 -rm
-----------------------------
['money', 'golden', 'highly respected', 'one of the eight categories of ancient musical instruments 八音[ba1 yin1]']To see meanings of character's or characters' components, use -cmchindict 你好 -cm
-----------------------------
你 meaning(s):
['you (informal, as opposed to courteous 您[nin2])']

好 meaning(s):
['good', 'well', 'proper', 'good to', 'easy to', 'very', 'so', '(suffix indicating completion or readiness)', '(of two people) close', 'on intimate terms', '(after a personal pronoun) hello', 'to be fond of', 'to have a tendency to', 'to be prone to']Python demofrom chin_dict.chindict import ChinDict

cd = ChinDict()

char_result = cd.lookup_char("泪")

print()
print("泪 components:")
print()

for component in char_result.components:
	print(component.character + ":", component.meaning)

# 氵: ['"water" radical in Chinese characters (Kangxi radical 85), occurring in 没, 法, 流 etc', 'see also 三點水|三点水[san1 dian3 shui3]']
# 目: ['eye', 'item', 'section', 'list', 'catalogue', 'table of contents', 'order (taxonomy)', 'goal', 'name', 'title']

print()

word_result = cd.lookup_word("发")

print("Translations for 发:")
print()
for word in word_result:
	print(word)

# Simplified: 发
# Traditional: 發
# Pinyin: fa1
# Meaning: ['to send out', "to show (one's feeling)", 'to issue', 'to develop', 'to make a bundle of money', 'classifier for gunshots (rounds)']

# Simplified: 发
# Traditional: 髮
# Pinyin: fa4
# Meaning: ['hair', 'Taiwan pr. [fa3]']
Package: chinesecalendar
中国节假日判断某年某月某一天是不是工作日/节假日。
支持 2004年 至 2024年，包括 2020年 的春节延长。安装pip install chinesecalendar升级pip install -U chinesecalendar由于次年的节假日安排，取决于国务院发布的日程。
所以本项目一般会在国务院更新以后，发布新的版本。
按照以往的经验，一般是每年的 11月 前后发布新版本。样例importdatetime# 判断 2018年4月30号 是不是节假日fromchinese_calendarimportis_holiday,is_workdayapril_last=datetime.date(2018,4,30)assertis_workday(april_last)isFalseassertis_holiday(april_last)isTrue# 或者在判断的同时，获取节日名importchinese_calendarascalendar# 也可以这样 importon_holiday,holiday_name=calendar.get_holiday_detail(april_last)asserton_holidayisTrueassertholiday_name==calendar.Holiday.labour_day.value# 还能判断法定节假日是不是调休importchinese_calendarassertchinese_calendar.is_in_lieu(datetime.date(2006,2,1))isFalseassertchinese_calendar.is_in_lieu(datetime.date(2006,2,2))isTrue其它语言假如你没法使用Python，
你也可以转译现成的常量文件来获取最全的节假日安排表。贡献代码Fork + Clone 项目到本地修改节假日定义执行脚本自动生成常量文件提交PR
Package: chinese-calendar
中国节假日判断某年某月某一天是不是工作日/节假日。
支持 2004年 至 2024年，包括 2020年 的春节延长。安装pip install chinesecalendar升级pip install -U chinesecalendar由于次年的节假日安排，取决于国务院发布的日程。
所以本项目一般会在国务院更新以后，发布新的版本。
按照以往的经验，一般是每年的 11月 前后发布新版本。样例importdatetime# 判断 2018年4月30号 是不是节假日fromchinese_calendarimportis_holiday,is_workdayapril_last=datetime.date(2018,4,30)assertis_workday(april_last)isFalseassertis_holiday(april_last)isTrue# 或者在判断的同时，获取节日名importchinese_calendarascalendar# 也可以这样 importon_holiday,holiday_name=calendar.get_holiday_detail(april_last)asserton_holidayisTrueassertholiday_name==calendar.Holiday.labour_day.value# 还能判断法定节假日是不是调休importchinese_calendarassertchinese_calendar.is_in_lieu(datetime.date(2006,2,1))isFalseassertchinese_calendar.is_in_lieu(datetime.date(2006,2,2))isTrue其它语言假如你没法使用Python，
你也可以转译现成的常量文件来获取最全的节假日安排表。贡献代码Fork + Clone 项目到本地修改节假日定义执行脚本自动生成常量文件提交PR
Package: chinese-characters-words
字字典数据是此库中的data/word.json，成语数据是idiom.json。字形数据来自这里。接口查成语from chinese_characters_words import 词典
词典.查成语('一石二鸟')如果查不到，返回 None；否则信息如下：{
  '词'
  '释义'
  '例句'
  '渊源'
  '拼音'
  '缩写'
}如：{'词': '一石二鸟', '释义': '扔一颗石子打到两只鸟。比喻做一件事情得到两样好处。', '例句': '无', '渊源': '无', '拼音': 'yī shí èr niǎo', '缩写': 'ysen'}找包含某字的成语> print(包含('精神'))

['抖搂精神', '抖擞精神', '精神百倍', '精神抖擞', '精神焕发', '精神恍惚', '精神满腹', '龙马精神', '人逢喜事精神爽', '桃李精神', '颐养精神']查单字from chinese_characters_words import 字典
字典.查单字('好')如果查不到，返回 None；否则信息如下：{
  '字'
  '旧体'
  '笔画数'
  '拼音'
  '部首'
  '释义'
  '其他'
}字的结构描述> print(的结构('花'))

{'字型': '⿱', '部分': ['艹', '化']}找包含某部分的字> print(包含('吴'))

['俣', '娱', '悮', '洖', '祦', '筽', '脵', '茣', '虞', '蜈', '誤', '误', '鋘', '麌']

> print(左边('甘'))

['甛', '邯']

> print(上面('口'))

['兄', '另', '叧', '只', '号', '叾', '吊', '吕', '吴', '呆', '呈', '员', '呙', '咠', '品', '員', '啚', '肙', '虽', '足', '黾']

> print(下面('天'))

['关', '吴', '昊', '癸', '龑']参与开发依赖的第三方 Python 包：rply-ulang
Package: chinese-converter
Chinese ConverterConverts between Traditional and Simplified Chinese. Uses monogram and bigram frequencies to pick optimal
words when a 1-to-1 conversion is not possible.Uses phrases in the dictionary to count monogram and bigram frequencies.Installationpipinstallchinese-converterUsageimportchinese_converterchinese_converter.to_traditional("simplified chinese text...")chinese_converter.to_simplified("traditional chinese text...")Testingpython-munittestLicenseMITResourcesNot necessary for the normal usage of this library.Dictionary Files:https://resources.publicense.moe.edu.tw/dict_reviseddict_download.htmlDictionary licensed underCC BY-ND 3.0 TW.Mirror:https://chinese-converter-data.s3.amazonaws.com/dict_revised_2015_20180409.zip
Package: chineseEasyWordcloud
中文简易词云(chineseEasyWordcloud)中文简易词云是一个Python库，旨在帮助初学者更轻松地制作中文词云。注意：请务必指定字体路径，否则默认字体无法正确显示中文安装你可以使用pip命令来安装该库：pip install chineseEasyWordcloud使用方法安装完成后，你可以在命令行中使用该库。运行以下命令查看可用选项：chinese-wordcloud -h示例命令行示例：chinese-wordcloud"你好呀，我是宽宽"-ooutput.png--font_path"path/to/your_chinese_font.ttf"--width1920--height1080注意：在命令行中可以直接使用-f file file file来添加多个文件或者使用-d dir ignored1 ignored2e.g.chinese-wordcloud-f"path/to/your_files1.txt""path/to/your_files2.txt"-ooutput.png--font_path"path/to/your_chinese_font.ttf"--width1920--height1080此命令会读取path/to/your_files1.txt和path/to/your_files2.txt中的内容并作为词云的输入文本chinese-wordcloud-d"path/to/your_dir"".git"-ooutput.png--font_path"path/to/your_chinese_font.ttf"--width1920--height1080此命令会读取path/to/your_dir中除去.git以外的所有文件并作为词云的输入文本Python示例：importchineseEasyWordcloud# 加载中文文本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 协议。Gitee|Github|PyPI|Docs
Package: chineseencryptordecrypt
📦 setup.py (for humans)This repo exists to providean example setup.pyfile, that can be used
to bootstrap your next Python project. It includes some advanced
patterns and best practices forsetup.py, as well as some
commented–out nice–to–haves.For example, thissetup.pyprovides a$ python setup.py uploadcommand, which creates auniversal wheel(andsdist) and uploads
your package toPyPiusingTwine, without the need for an annoyingsetup.cfgfile. It also creates/uploads a new git tag, automatically.In short,setup.pyfiles can be daunting to approach, when first
starting out — even Guido has been heard saying, "everyone cargo cults
thems". It's true — so, I want this repo to be the best place to
copy–paste from :)Check out the example!Installationcdyour_project# Download the setup.py file:#  download with wgetwgethttps://raw.githubusercontent.com/navdeep-G/setup.py/master/setup.py-Osetup.py#  download with curlcurl-Ohttps://raw.githubusercontent.com/navdeep-G/setup.py/master/setup.pyTo DoTests via$ setup.py test(if it's concise).Pull requests are encouraged!More ResourcesWhat is setup.py?on Stack OverflowOfficial Python Packaging User GuideThe Hitchhiker's Guide to PackagingCookiecutter template for a Python packageLicenseThis is free and unencumbered software released into the public domain.Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any means.
Package: chinese-english-lookup
chinese-english-lookupA simple Python package for Chinese-to-English word definition retrieval. Definitions sourced from Chinese-English dictionaryCC-CEDICT.Also includes utility for HSK3.0 (post-2020) and HSK2.0 (2010-2020).Installationpipinstallchinese-english-lookupUsageRunning CLI demo for DictionaryRun commandchinese-english-lookup:(Please note: scriptchinese-english-lookupcontains hyphens)chinese-english-lookup

LookupaChineseword,type'random',ortype'!'toquit:美好
美好|美好
【mei3hao3】beautiful;fine

LookupaChineseword,type'random',ortype'!'toquit:random
赤贫如洗|赤貧如洗
【chi4pin2ru2xi3】withouttwonickelstorubtogether(idiom);impoverishedUsing Dictionary utility(Please note: package namechinese_english_lookupcontains underscores rather than hyphens)>>>fromchinese_english_lookupimportDictionary>>>d=Dictionary()>>>word_entry=d.lookup('牛油果')>>>print(word_entry)牛油果|牛油果【niu2you2guo3】avocado(Perseaamericana)>>>word_entry.simp'牛油果'>>>word_entry.trad'牛油果'>>>len(word_entry.definition_entries)1>>>word_entry.get_definition_entries_formatted()'【niu2 you2 guo3】 avocado (Persea americana)'>>>word_entry.definition_entries[0].pinyin'niu2 you2 guo3'>>>word_entry.definition_entries[0].definitions['avocado (Persea americana)']Using HSK3 utility>>>fromchinese_english_lookupimportHSK3>>>hsk3=HSK3()>>>intermediate_words=hsk3.get_intermediate()>>>len(intermediate_words)3167>>>forwordinintermediate_words:...print(str(word))# output omitted>>>print(intermediate_words[0])阿姨|阿姨【a1yi2】maternalaunt;step-mother;childcareworker;nursemaid;womanofsimilaragetoone's parents (term of address used by child); CL:個|个[ge4]>>>hsk3.get_category_for_word('醉')'中级 - Intermediate Level'Using HSK2 utility>>>fromchinese_english_lookupimportHSK2>>>hsk2=HSK2()>>>level_4_words=hsk2.get_words_for_level(4)>>>len(level_4_words)598>>>forwordinlevel_4_words:...print(str(word))# output omitted>>>print(level_for_words[0])爱情|愛情【ai4qing2】romance;love(romantic);CL:個|个[ge4],份[fen4]>>>hsk2.get_level_for_word('梦')4LicenseMIT
Package: chinese-gpt
Chinese-GPT 中文GPT预训练模型Chinese Generative Pre-Training(GPT) Language ModelThis project is unidirectional transformer GPT model (117M) trained on a large corpus dataset following the approachOpenAI GPT-2. Due to limited computational resources, we did not train our model from scratch. Instead, we take the advantage ofBERTand use its weights as initialization to train our Chinese GPT. This makes the training possible on 4 x 1080Ti.However, please notice that currently the performance still cannot match the original English GPT-2 model for various reasons. This can be that OpenAI has done better text filtering and has a dataset with better quality. Also, they have trained their model for about 300 GPU days at least. But the model here can be a good starting point if you want to apply it for substream tasks.FeaturesThis repository contains a rewritten cached Transformed based on BERT, which is the same technique used in GPT-2 implementation. It can cache the intermediate results, and therefore save the compuation time and memory during the decoding stage.Also, a CUDA kernel version of GELU activation function is provided. You have to insatllCupyto use it. You can checkcuda_gelufor the implementation. It is 2x faster than the original implementation!InstallationBefore using it, you might want to install the requirements first.pipinstall-rrequirements.txtYou can also install it viapip.pipinstallchinese-gptUsageChecktutorialsfor details.I have also included a colab for demo:https://colab.research.google.com/drive/1cvBSt2uF7hYL1feDGt0dkCxIeaVXQs5xEncoder Weights:https://drive.google.com/open?id=1Mr2-x_qT2hgyo0RalPjc09NmyNi6a_gsDecoder Weights:https://drive.google.com/open?id=1W6n7Kv6kvHthUX18DhdGSzBYkyzDvxYhData PreparationTo train GPT, it requires a dataset from a wide range of sources.We collected data fromNLP Chinese CorpusIn details, we used:社区问答json版(webtext2019zh) ：大规模高质量数据集百科类问答json版(baike2018qa)新闻语料json版(news2016zh)Text FilteringOne thing to take care of is that text filtering. Since Bert Chinese tokenizer doesn't include some punctuations. You might want to use the following code to clean your data first:importregexasredeffilterPunctuation(x):x=re.sub(r'[‘’]',"'",x)x=re.sub(r'[“”]','"',x)x=re.sub(r'[…]','...',x)x=re.sub(r'[—]','-',x)x=re.sub(r"&nbsp","",x)returnxYou may also want to convert traditional Chinese to simplified Chinese and apply some other filtering techniques based on your data.ReferenceOpenAI GPT-2BERTAllenNLPPytorch BERTNLP Chinese Corpus
Package: chinese-id-checker
chinese_id_checker  中国公民身份证校验模块github安装  installation经过测试，支持python3.6+
python 3.6+ is supported$pipinstallchinese_id_checker基础使用使用  basic usagefromchinese_id_checkerimportChineseIdChecker# 实例化身份证校验对象chinses_id_obj=ChinsesIdChecker('110101199511114295')# 判断传入身份证是否正确chinese_id_obj.check()>>>True# 获取传入身份证的生日chinese_id_obj.get_birthday()>>>'1995-11-11'# 获取传入身份证的所属区域，结果:[省],[市],[区]chinese_id_obj.get_location()>>>'北京市,北京市,东城区'# 获取传入身份证所属省份chinese_id_obj.get_location()>>>'北京市'# 获取传入身份证所属城市chinese_id_obj.get_location()>>>'北京市'# 获取传入身份证所属区县chinese_id_obj.get_location()>>>'东城区'# 为已实例化的对象设置新的身份证号chinese_id_obj.id_str='110101199511116098'行政区配置文件说明 district instruction行政区配置文件格式说明
默认目录：data_source
默认文件：location.json
默认备份目录：data_source/bak
默认备份文件：location.json.bak
数据格式{"id_code":["privince","city","district"],"110101":["北京市","北京市","东城区"]}行政区模块使用fromchinese_id_checkerimpoerLocationlocation_obj=Location()# 备份文件location_obj.bak_file()>>>True# 回滚文件location_obj.roll_back()>>>True# 添加新的数据（如果id_code已存在会返回False）location_obj.add_info(id_code='999999',province='xxx',city='xxx',district='xxx')>>>True# 添加或更新新的数据（如果id_code已存在，会覆盖原始数据）location_obj.add_info(id_code='999999',province='xxx',city='xxx',district='xxx',update_id_exist=False)>>>True# 删除已存在的数据（如果id_code不存在，则返回False)location_obj.remove_info('999999')>>>True# 使用csv生成json文件# 输入文件为参数csv_path: data_source/data_source_200327.csv# 输出文件为参数output_path: 如果为None，则放到默认目录下# with_head参数用于判断csv文件是否有标题行# columns参数为数据处理列，接受可迭代对象，长度为4，第一个值为id_code的列，第二个值为省名称，第三个值为市名称，第四个值为区县名称location_obj.output_json_file_from_csv(csv_path='data_source/data_source_200327.csv',output_path=None,with_head=True,columns=(4,1,2,3)维护者 maintainersLin Luo / Bruce Liu
Package: chineseize-matplotlib
chineseize-matplotlib自动设置 matplotlib 中文字体利用方法importmatplotlib.pyplotaspltimportchineseize_matplotlibplt.plot([1,2,3,4])plt.xlabel('简单图表')plt.show()安装# pipenvpipenvinstallchineseize-matplotlib# pippipinstallchineseize-matplotlib##使用字体使用IPA字体的IPAex黑体(Ver.003.01)。利用进程[ipa字体授权v 1.0] (https://github.com/cndeng/chineseize-matplotlib/blob/master/chineseize_matplotlib/fonts/ipa_font_license_agreement_v1.0.txt)请同意。
Package: chinese-keybert
Chinese_keyBERTChinese_keyBERT is a minimal Chinese keywords extraction library that leverage the contextual embeddings generated from BERT models to extract relevant keywords from the given texts.Installationpip install chinese_keybertGet startedfrom chinese_keybert import Chinese_Extractor
kw_extractor = Chinese_Extractor()
text = [
   '''
渾水創始人：七月開始調查貝殼，因為“好得難以置信” 2021年12月16日，做空機構渾水在社交媒體上公開表示，正在做空美股上市公司貝殼...
'''
]
result = kw_extractor.generate_keywords(text,top_k=5,rank_methods="mmr")How it worksThe core idea behind chinese_keyBERT is to utilize a word segmentation models to segments a piece of text into smaller n-grams and filter the n-grams according to the defined part-of-speech (as some pos are not suitable to be used as a keyword). Then, an embedding model (eg. BERT) is used to encode the text and filtered n_grams into embeddings and using some ranking methods (eg. maximun sum/maximun marginal relevance) to compute the cosine distances betweens the text and n-grams embeddings and rank the keywords according to the scores.To-doDocumentationsVectorization operations to speed-up processing of multiple documentsAdd support for other word segmentation, part-of-speech and embeddings modelCreditChinese_keyBERT was largely inspired byKeyBERT, a minimal library for embedding based keywords extractions. Besides, Chinese_keyBERT is also heavily relies on Chinese word segmentation and POS library fromCKIPas well assentence-transformerfor generating quality embeddings.
Package: chineseMarkov
# ChineseMarkovBase on Markov model and [jieba](https://github.com/fxsjy/jieba) chinese text segmentationInspired by [hrs/markov-sentence-generator](https://github.com/hrs/markov-sentence-generator)## Usage```pythonimport chineseMarkovgen = chineseMarkov.MarkovGenerator('data/sample.txt', length=2)gen.get_sentence()```
Package: chinesename
中文取名说明项目包含《百家姓》姓氏504个，常用于名字的汉字2812个
名字汉字中包含大部分《楚辞》、《诗经》词汇pypi地址：https://pypi.python.org/pypi/chinesename安装模块pip install chinesename代码示例：fromchinesenameimportChineseName# 导包cn=ChineseName()# 实例化cn.getName()# 获取一个姓名'广袁'cn.getNames(10)# 获取多个姓名['笪递','慎彭徨','席具','锺谦','任西','公羊狱','华桑','利节','燕角','任彪']cn.getNameGenerator(10)# 获取生成器<generatorobjectChineseName.getNameGeneratorat0x1045cfa40>cn.getLastName()# 获取姓氏'舒'cn.getFirstName()# 获取名字'崔'cn.getName(lastname="彭")# 设置姓氏'彭圭'cn.getName(char_count=2)# 设置名字长度'倪吏渚'cn.getName(sex="boy")# 设置性别 （boy | girl）'骆留'更新记录2018年1月22日 增加姓名生成器函数，getNameGenerator()2018年3月19日 修复导入lastnames 和 firstname 文件失败的问题，将两文件内容直接写到chinesename中，并删除两文件2018年6月20日 修复资源文件导入问题，增加性别参数，区分男孩姓名和女孩姓名
感谢 JoffreyN 提出的建议古语云：男楚辞，女诗经。名可以从诗经、楚辞里面取在原有基础上进行了扩展
遗留问题：取词不准确，需要进一步优化2018年7月23日 修复文件open时引发的编码问题，增加参数：encoding="utf-8"2018年11月23日 修复pyhton2下安装报错'IOError: [Errno 2] No such file or directory: "README.md"'的问题
Package: chinesenumber
ChineseNumberConvert Chinese (or Japanese) numbers (e.g. 二十一) to numeric digits (21).Similar in idea tohttps://github.com/akshaynagpal/w2nThe resulting numbers can be sorted usinghttps://github.com/SethMMorton/natsortUsage>>> from chinesenumber import NumberParser
>>> parser = NumberParser()
>>> parser.numberify('第二十二课')
'第22课'
>>> parser.simple_parse('百六十五')
165Installationpip install chinesenumber
Package: chinese-permanent-calendar
内容列表简介使用说明示例属性说明其他说明简介Chinese permanent calendar这是一个通过python查询中国万年历相关信息的的包，可以根据阳历日期或阴历日期查询，查询范围从1970-01-01到2099-12-31，返回结果包括：公历信息：节日、星座农历信息：宜、忌、冲、煞、神位、胎神、周易、五行、天干地支、彭祖百忌、董公择日法使用说明示例importchinese_permanent_calendarascalendarimportdatetime# 根据阳历日期得到阴历日期的详情date=datetime.date(2020,1,1)luner_date=calendar.get_lunar_by_gregorian(date)print("阳历：",luner_date.name,"阴历：",luner_date['LunarDate'])# 根据阴历得到阳历日期及当天的详情gregorian_date=calendar.get_gregorian_by_lunar(luner_date['LunarDate'])# 得到所有节日包含国庆节的日期date=calendar.get_days_by_festival(['国庆节'])# 得到所有的日期数据all_data=calendar.get_all_data(start=datetime.date(2020,1,1),end=datetime.date(2020,2,1))属性说明属性含义GregorianDateTime阳历日期LunarDateTime阴历日期LJie阴历节日GJie阳历节日Yi宜Ji忌ShenWei神位Taishen胎神Chong冲SuiSha岁煞WuxingJiazi五行甲子年WuxingNaYear五行纳音-年WuxingNaMonth五行纳音--月WuxingNaDay五行纳音-日MoonName月相XingEast东方星座-28星宿XingWest西方星座-12星座PengZu彭祖百忌JianShen十二建星TianGanDiZhiYear天干地支-奶牛TianGanDiZhiMonth天干地支-月TianGanDiZhiDay天干地支-日LMonthName农历-月份别名LYear阴历-年LMonth阴历-月LDay阴历-日SolarTermName节气GYear阳历-年GMonth阳历-月GDay阳历-日is_weekend是否为周末is_weekday是否为工作日其他说明原始数据文件拿去:cp_calendar.csv.gz有任何BUG、改进请提交issue或联系：18813052953@163.com本人学生一枚，闲人一个，希望与更多共同学习、共同进步的小伙伴们多多交流学习。
Package: chinesepostman
# Chinese-Postman SolverI wrote this program to solve the[Chinese Postman problem](http://en.wikipedia.org/wiki/Route_inspection_problem).Described as:> The **Chinese Postman Problem**, or "route inspection problem"> is to find a shortest closed circuit that visits every edge of a> (connected) undirected graph.## InspirationI was inspired to learn about and solve this problem when I thought it wouldbe cool to follow every trail in[Pacific Spirit Park](http://en.wikipedia.org/wiki/Pacific_Spirit_Regional_Park)in one run.Given that the park contains over 73 km of trail, I need to find the optimumEularian Path. Otherwise it's going to be a really, really long run!## The ProcessThe solution is roughly a three-step process:1. Determine if the graph has an[Eularian Path](http://en.wikipedia.org/wiki/Eulerian_path)(Very easy)2. Make the non-Eularian graph Eularian, at the minimum expense(Not so easy)3. Find the fudged Eularian path(Pretty easy)### Solving Minimum ExpenseIn order to convert a non- or semi-Eularian graph to an Eularian one,you must eliminate odd nodes (nodes having an odd number of edges.)To eliminate an odd node, you need to add another edge to it (essentiallyretracing your steps.) However, this comes as a cost! The goal then isto find out which edges to repeat, that eliminate all the odd nodes, withthe minimum cost.1. Find all possible combinations of pairs of odd nodes2. Using Dijkstra's Algorithm, find the cost of the minimum path betweenthose pairs3. Find which set of paths (depending on how many odd nodes you have)that results in the least total cost4. Modify your graph with these new parallel edgesNow you have an Eularian graph with only even nodes, for which an EularianCircuit can be found.### Solving the Eularian CircuitSolving the Eularian Circuit (now that we have one) is relatively easy. Atfirst, I simply walked the edges randomly until I happened to find a routethat either dead-ended, or resulted in a circuit. Then I implemented [Fleury'sAlgorithm](http://en.wikipedia.org/wiki/Eulerian_path#Fleury.27s_algorithm)which says always choose a non-bridge over a bridge (for obviousreasons). Now it takes very few attempts to solve most circuits.Later I will implement an alternative circuit finding method (Hierholzer's?)## To runpython main.pyIf you want to specify which graph to load, simply add the graph name:python main.py northYou can find all the graph names in the `data` folder.This program will run in Python 2.7 and Python 3.4, at least.There are unit tests included, in the `tests` directory. You can run these bytypingpython tests/run_tests.pyfrom the root project folder.