package
stringlengths
1
122
pacakge-description
stringlengths
0
1.3M
zhiming
ZhiMing, 之明zhiming, 之明, become enlightened, sensible, judicious and wise.A package for information and data analysis.
zhinst
Zurich Instruments LabOne PackagesThezhinstpackage is purely a metapackage that installs the whole Python API stack for LabOne®, the Zurich Instruments control software.It includes the following packages:zhinst-core(native Python API for LabOne)zhinst-utils(utility functions for zhinst-core)zhinst-toolkit(high-level Python API for LabOne)This package includes everything required to interface with LabOne form within Python. For more information see the dedicated package documentation or theonline documentation.WARNING: Upgrading from version <= 22.02 to 22.08 requires to uninstall this package first and the reinstalling it,--upgradewill corrupt the package.
zhinst-core
Zurich Instruments LabOne APIThezhinst-corepackage allows communication with Zurich Instruments devices from the Python programming language. It's the native Python API of LabOne®, the Zurich Instruments control software.The documentation for thezhinst.corebinary extension can be accessedonlineor via the built-inhelpcommand:importzhinst.corehelp(zhinst.core)More information about programming with Zurich Instruments devices is available in theLabOne Programming Manual.
zhinst-deviceutils
Device Utils for Zurich Instrumentszhinst-deviceutils provides a set of helper functions for the native LabOne Python API calledzhinst.ziPython.It offers higher level functions to ease the communication withZurich Instrumentsdevices. It is not intended to be a separate layer abovezhinst.ziPythonbut rather as an addition.It currently has utility functions for the following devices:SHFQASHFSGSHFQCTo see the device utils in action check out theLabOne API examples.InstallationPython 3.7+ is required.pip install zhinst-deviceutilsUsageimport zhinst.deviceutils.shfqa import zhinst.deviceutils.shfsg import zhinst.deviceutils.shfqc help(zhinst.deviceutils.shfqa) help(zhinst.deviceutils.shfsg) help(zhinst.deviceutils.shfqc)AboutMore information about programming with Zurich Instruments devices is available in thepackage documentationand theLabOne Programming Manual.
zhinst-hdiq
Zurich Instruments HDIQ (zhinst-hdiq)zhinst-hdiqis a package for Python 3.7+ to control aZurich Instruments HDIQ IQ Modulatorvia Ethernet connection. Please note that this package is valid only for instruments with serial numbers14100 and above.StatusThezhinst-hdiqpackage is considered stable for general usage. The interface may be subject to incompatible changes between releases, which we will indicate by a change of the major version. Please check thechangelogif you are upgrading.InstallInstall the package withpip:$pipinstallzhinst-hdiqExampleThe example below shows how to connect an HDIQ instrument to a host computer and control operation modes of the HDIQ channels.importzhinst.hdiq.utilsfromzhinst.hdiqimportHdiqhdiq_devices=zhinst.hdiq.utils.discover_devices()print(f'Found devices:{hdiq_devices}')hdiq_serial,hdiq_ip=hdiq_devices[0]print(f'Connecting to{hdiq_serial}(IP:{hdiq_ip})')hdiq=Hdiq(hdiq_ip)channel=1# HDIQ channel 1; HDIQ has 4 channels: 1, 2, 3, 4hdiq.set_rf_to_calib(channel)# calibration mode in channel 1, set RF to Calib. port# hdiq.set_rf_to_exp(channel) # RF mode in channel 1, set RF to Exp. port# hdiq.set_lo_to_exp(channel) # LO mode in channel 1, set LO to Exp. portstatus=hdiq.get_channel_status(channel)# get status of channel 1print(f'channel{channel}->{status}')ContributingWe welcome contributions by the community, either as bug reports, fixes and new code. Please use the GitHub issue tracker to report bugs or submit patches. Before developing something new, please get in contact with us.LicenseThis software is licensed under the terms of the MIT license. SeeLICENSEfor more detail.
zhinst-labber
Zurich Instruments Labber DriversThe Zurich Instruments Labber Drivers is a python package that is able to automatically generate and update instrument drivers for all Zurich Instruments devices for the scientific measurement softwareLabber.The Labber drivers are based on theZurich Instruments Toolkit(zhinst-toolkit), a high level driver of our Python core API.WARNINGUpgrading from zhinst-labber versions lower than 0.3 needs some special attention since version 0.3 breaks the API in many ways and measurements need to be adapted. If you need more Information on the upgrading process or need assistance feel free to contact the Zurich Instruments support at any time. ([email protected])StatusThe Zurich Instruments Labber Drivers are well tested and considered stable enough for general usage. The interfaces may have some incompatible changes between releases. Please check the changelog if you are upgrading to the latest version.LabOne softwareAs a prerequisite, the LabOne software version 22.02 or later must be installed. It can be downloaded for free athttps://www.zhinst.com/labone. Follow the installation instructions specific to your platform. Verify that you can connect to your instrument(s) using the web interface of LabOne. If you are upgrading from an older version, be sure to update the firmware of all Zurich Instruments devices in use by using the web interface.In principle LabOne can be installed in a remote machine, but we highly recommend to install it on a local machine where you intend to run the experiment.Getting StartedLabber comes with its own Python distribution that is used by default. If not specified otherwise (Preferences -> Advanced -> Python distribution) the following command needs to be executed within this distribution. (C:\Program Files\Labber\python-labber\Scripts\pip.exe or similar).pip install zhinst-labberThe drivers for an device can now be generated using the command line interface.For example the following command generated the driver for the Device DEV1234 inside the Labber driver folder of the ZI user.zhinst-labber setup "C:\Users\ZI\Labber\Drivers" DEV1234 localhostDocumentationFor a full documentation seehere.ContributingWe welcome contributions by the community, either as bug reports, fixes and new code. Please use the GitHub issue tracker to report bugs or submit patches. Before developing something new, please get in contact with us.LicenseThis software is licensed under the terms of the MIT license. SeeLICENSEfor more detail.
zhinst-plotter
Failed to fetch description. HTTP Status Code: 404
zhinst-qcodes
Zurich Instruments Drivers for QCoDeS (zhinst-qcodes)The Zurich Instruments drivers for QCoDeS (zhinst-qcodes) is a package of instrument drivers for devices produced byZurich Instrumentsfor QCoDeS.QCoDeSis a Python-based data acquisition framework developed to serve the needs of nanoelectronic device experiments, but not limited to that. It is intended to be used within QCoDeS and not as standalone package. The QCoDeS instrument drivers are based on theZurich Instruments Toolkit. So if you are looking for a framework independent high level python API, zhinst-toolkit it the right place for you.StatusThe zhinst-qcodes is well tested and considered stable enough for general usage. The interfaces may have some incompatible changes between releases. Please check the changelog when updating.Refactoring with version 0.3Version 0.3 is a more or less complete new driver and breaks the API compared to the previous version in many ways. If you upgrade from an older version take a look at the dedicateddocumentation pagefor more information.InstallInstall the package with pip:pip install zhinst-qcodesDocumentationSee the documentation pagehere. Since zhinst-qcodes is based on zhinst-toolkit and has exactly the same interface and functions, thedocumentationfor zhinst-toolkit can be applied nearly one to one and has much more examples.ContributingWe welcome contributions by the community, either as bug reports, fixes and new code. Please use the GitHub issue tracker to report bugs or submit patches. Before developing something new, please get in contact with us.LicenseThis software is licensed under the terms of the MIT license. SeeLICENSEfor more detail.
zhinst-seqc-compiler
Zurich Instruments SeqC CompilerThezhinst-seqc-compilerpackage contains a standalone compiler for the Zurich InstrumentsLabOne® AWG Sequencer programming language, SeqC. Please see the corresponding sections in the user manuals for more detail, e.g.,SHFQA,SHFQC, orHDAWG.This package exposes a single function,zhinst.seqc_compiler.compile_seqc, which takes SeqC source code and returns the compiled program and waveforms as an ELF file, which can be uploaded through theLabOne API.The same function is available in thezhinst-corepackage.zhinst.core.compile_seqcwill forward the call tozhinst.seqc_compiler.compile_seqcif a compatible version of this package is installed. A version is compatible if major and minor package versions match, and the revision of ´zhinst-seqc-compiler´ is greater or equal to the revision ofzhinst-core. A warning will be issued if the versions do not match.This package has the main purposes to enable faster deployment of bug fixes independently fromzhinst-coreand the LabOne release cycle.
zhinst-timing-models
Feedback Latency Model ParametersFeedback Data Latency model for PQSC, SHF- and HDAWG systems.Table of ContentsInstallationUsageLicenseInstallationpip install zhinst-timing-modelsUsagefromzhinst.timing_modelsimport(PQSCMode,QAType,QCCSFeedbackModel,SGType,get_feedback_system_description,)model=QCCSFeedbackModel(description=get_feedback_system_description(generator_type=SGType.HDAWG,analyzer_type=QAType.SHFQA,pqsc_mode=PQSCMode.DECODER,))awg_clock_cycles=model.get_latency(...)Licensezhinst-timing-modelsis distributed under the terms of theMITlicense.
zhinst-toolkit
Zurich Instruments Toolkit (zhinst-toolkit)The Zurich Instruments Toolkit (zhinst-toolkit) is a high level driver package that allows communication with Zurich Instruments devices from the Python programming language. It is based on top of the nativePython API(zhinst.core) of LabOne®, the Zurich Instruments control software. It comes in the form of a package compatible with Python 3.7+.The central goal of zhinst-toolkit is to provide a pythonic approach to interact with any Zurich Instruments device and is intended as a full replacement for the low levelzhinst.corepackage.StatusThe zhinst-toolkit is well tested and considered stable enough for general usage. The interfaces may have some incompatible changes between releases. Please check the changelog if you are upgrading.LabOne softwareAs prerequisite, the LabOne software version 22.02 or later must be installed. It can be downloaded for free athttps://www.zhinst.com/labone. Follow the installation instructions specific to your platform. Verify that you can connect to your instrument(s) using the web interface of LabOne. If you are upgrading from an older version, be sure to update the firmware of al your devices using the web interface before continuing.In principle LabOne can be installed in a remote machine, but we highly recommend to install on the local machine where you intend to run the experiment.InstallInstall the package with pip:pip install zhinst-toolkitDocumentationFor a full documentation seehere.ContributingWe welcome contributions by the community, either as bug reports, fixes and new code. Please use the GitHub issue tracker to report bugs or submit patches. Before developing something new, please get in contact with us.Please seeContributing sectionLicenseThis software is licensed under the terms of the MIT license. SeeLICENSEfor more detail.
zhinst-utils
Utils for Zurich Instruments LabOne APIzhinst-utils provides a set of helper functions for the native LabOne Python API calledzhinst.core.It offers higher level functions to ease the communication withZurich Instrumentsdevices. It is not intended to be a separate layer abovezhinst.corebut rather as an addition.Apart for a set of not device specific functions the utility also provide specific functionality for some devices. Currently including:SHFQASHFSGSHFQCTo see the device utils in action check out theLabOne API examples.InstallationPython 3.7+ is required.pip install zhinst-utilsUsageimport zhinst.utils.shfqa import zhinst.utils.shfsg import zhinst.utils.shfqc help(zhinst.utils.shfqa) help(zhinst.utils.shfsg) help(zhinst.utils.shfqc)AboutMore information about programming with Zurich Instruments devices is available in thepackage documentationand theLabOne Programming Manual.
zhipu
No description available on PyPI.
zhipuai
智谱大模型开放接口SDK智谱开放平台大模型接口 Python SDK(Big Model API SDK in Python),让开发者更便捷的调用智谱开放API简介对所有接口进行了类型封装。初始化client并调用成员函数,无需关注http调用过程的各种细节,所见即所得。默认缓存token。安装运行环境:Python>=3.7使用 pip 安装zhipuai软件包及其依赖pipinstallzhipuai使用调用流程:使用 APISecretKey 创建 Client调用 Client 对应的成员方法开放平台接口文档以及使用指南中有更多的 demo 示例,请在 demo 中使用自己的 ApiKey 进行测试。创建ClientfromzhipuaiimportZhipuAIclient=ZhipuAI(api_key="",# 填写您的 APIKey)同步调用fromzhipuaiimportZhipuAIclient=ZhipuAI(api_key="")# 填写您自己的APIKeyresponse=client.chat.completions.create(model="",# 填写需要调用的模型名称messages=[{"role":"user","content":"你好"},{"role":"assistant","content":"我是人工智能助手"},{"role":"user","content":"你叫什么名字"},{"role":"assistant","content":"我叫chatGLM"},{"role":"user","content":"你都可以做些什么事"}],)print(response.choices[0].message)SSE 调用fromzhipuaiimportZhipuAIclient=ZhipuAI(api_key="")# 请填写您自己的APIKeyresponse=client.chat.completions.create(model="",# 填写需要调用的模型名称messages=[{"role":"system","content":"你是一个人工智能助手,你叫叫chatGLM"},{"role":"user","content":"你好!你叫什么名字"},],stream=True,)forchunkinresponse:print(chunk.choices[0].delta)
zhipuai-api
Zhipu AI APIPython SDK for the Zhipu AI APIInstallationpipinstallzhipuai-apiQuickstartimportzhipuaiLicenseZhipu AI API has a BSD-3-Clause license, as found in theLICENSEfile.ContributingChangelog
zhipuai-langchain
No description available on PyPI.
zhiqiang
ZhiQiang, 之强zhiqiang, 之强, become strong. And similar to ziqiang, 自强, Self-strengthening.A platform for reinforcement learning. The framework does not depend on any specific deep learning platform. But the implemented concrete agents are written with PyTorch.ExamplesLearning curriculum of different agents for the environment GridWorld:A replay of a trained EntropyACV agent for GridWorld:DescriptionAbstract classes that form the framework:from zhiqiang.agents import AbstractPQNet from zhiqiang.agents import AbstractAgent from zhiqiang.envs import AbstractEnv from zhiqiang.replay_buffers import AbstractBuffer from zhiqiang.trainers import AbstractTrainerPlease run commands such asAbstractPQNet.print_info() AbstractAgent.print_info()to see necessary functions for implementing concrete classes.Implemented Trainers and Buffers:from zhiqiang.trainers.simple_trainer import SimpleTrainer as Trainer from zhiqiang.trainers.paral_trainer import ParalTrainer as Trainer from zhiqiang.replay_buffers.simple_buffer import SimpleBuffer as Buffer from zhiqiang.replay_buffers.priority_buffer import PriorityBuffer as BufferSome of the implemented agents:from zhiqiang.agents.dqn_vanila import VanilaDQN as Agent from zhiqiang.agents.dqn_double import DoubleDQN as Agent from zhiqiang.agents.dqn_mstep import MStepDQN as Agent from zhiqiang.agents.dqn_priority import PriorityDQN as AgentMore:. ├── __init__.py ├── agents │ ├── __init__.py │ ├── acq_entropy.py │ ├── acv_entropy.py │ ├── dqn_double.py │ ├── dqn_mstep.py │ ├── dqn_priority.py │ ├── dqn_vanila.py │ └── policy_mstep.py ├── envs │ └── __init__.py ├── replay_buffers │ ├── __init__.py │ ├── priority_buffer.py │ └── simple_buffer.py ├── trainers │ ├── __init__.py │ ├── paral_trainer.py │ └── simple_trainer.py └── utils ├── __init__.py ├── basic_settings.py ├── data_parallelism.py ├── log_parser.py ├── torch_utils.py └── uct_simple.pyQuick TrialFor a quick trial, please try codes in the file examples/GridWorld/script_train_simple.py:# define an env from grid_world import GridWorld as Env # define a qnet, in PyTorch from gridworld_qnet import GridWorldQNet as QNet # pick an agent from zhiqiang.agents.dqn_vanila import VanilaDQN as Agent # from zhiqiang.agents.dqn_double import DoubleDQN as Agent # from zhiqiang.agents.dqn_mstep import MStepDQN as Agent # from zhiqiang.agents.dqn_priority import PriorityDQN as Agent # pick a buffer from zhiqiang.replay_buffers.simple_buffer import SimpleBuffer as Buffer # from zhiqiang.replay_buffers.priority_buffer import PriorityBuffer as Buffer # pick a trainer from zhiqiang.trainers.simple_trainer import SimpleTrainer as Trainer # from zhiqiang.trainers.paral_trainer import ParalTrainer as Trainer # settings file, make sure the path is right settings_filepath = "./data_root/settings/settings_gridworld.json" agent_name = "agentname" env_name = "GridWorld" ## # from zhiqiang.utils.basic_settings import BasicSettings # settings = BasicSettings(settings_filepath) settings.env = env_name settings.agent = agent_name settings.check_settings() settings.display() # # device import torch settings.device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') \ if settings.device_type is None else torch.device(settings.device_type) # print("device: {}".format(settings.device)) # # trainer trainer = Trainer(settings, Agent, {"qnet": QNet}, Env, Buffer) # # train list_aver_rewards = trainer.do_train() # # draw import matplotlib.pyplot as plt fig = plt.figure(figsize=(8, 5)) # eval_period = settings.trainer_settings["eval_period"] list_x = [idx * eval_period for idx in range(len(list_aver_rewards))] # print(list_x) print(list_aver_rewards) # plt.plot(list_x, list_aver_rewards, label="Averaged Rewards", color="r", linewidth=2) plt.xlabel("Number Boost") plt.ylabel("Averaged Rewards") # plt.title("Boost Curriculum") # plt.xticks(list_x) # plt.legend() plt.grid() plt.show()For utilization of more agents, please see codes in the file examples/GridWorld/script_train_all.py.PhilosophyThis package does not aim to encompass all kinds of reinforcement learning algorithms, but just to provide a framework for RL solutions of tasks.An RL solution always involves an environment, an agent (agents) and some neural networks (as agent modules). For training the agent (agents), a trainer and a replay buffer are further required. If interface functions among these parts are well defined, then the different parts can be easy to change as plug-and-play. This is what this package aims to do.In this package, a set of inferface functions is defined, and some simple implementations of the different parts are conducted. We hope these will pave way for users to make their own customized definitions and implementations.InstallationFrom PyPI distribution system:pip install zhiqiangThis package is tested with PyTorch 1.4.0.UsageFor usage examples of this package, please see:1, examples/GridWorld2, examples/AtariCitationIf you find ZhiQiang helpful, please cite it in your publications.@software{zhiqiang, author = {Ming-Fan Li}, title = {ZhiQiang, a platform for reinforcement learning}, year = {2020}, url = {https://github.com/Li-Ming-Fan/zhiqiang} }
zhiqing
zhiqingZhiqing's personal module.
zhishuyun-scaffold
ZhiShuYun ScaffoldInstall:pip install zhishuyun-scaffoldSample:fromzhishuyun_scaffoldimportBaseControllerasControllerfromzhishuyun_scaffoldimportBaseHandlerimportjsonclassHandler(BaseHandler):asyncdefget(self,id=None):result={'value':id}self.write(json.dumps(result))controller=Controller()controller.add_handler(r'/test/(.*)',Handler)controller.start()
zh-ito-yolov5
No description available on PyPI.
zhiva
No description available on PyPI.
zhiweimorgenexamplehahaha
Example PackageThis is a simple example package. You can useGithub-flavored Markdownto write your content.
zhixuewang
No description available on PyPI.
zhizhen
zhizhenOs software development library
zhjnester
No description available on PyPI.
zhj-top
No description available on PyPI.
zhk
UNKNOWN
zhkeybert
ZhKeyBERT中文文档Based onKeyBERT, enhance the keyword extraction model for Chinese.Corresponding medium post can be foundhere.Table of ContentsAbout the ProjectGetting Started2.1.Installation2.2.Basic Usage2.3.Maximal Marginal Relevance2.4.Embedding Models1. About the ProjectBack to ToCAlthough there are already many methods available for keyword generation (e.g.,Rake,YAKE!, TF-IDF, etc.) I wanted to create a very basic, but powerful method for extracting keywords and keyphrases. This is whereKeyBERTcomes in! Which uses BERT-embeddings and simple cosine similarity to find the sub-phrases in a document that are the most similar to the document itself.First, document embeddings are extracted with BERT to get a document-level representation. Then, word embeddings are extracted for N-gram words/phrases. Finally, we use cosine similarity to find the words/phrases that are the most similar to the document. The most similar words could then be identified as the words that best describe the entire document.KeyBERT is by no means unique and is created as a quick and easy method for creating keywords and keyphrases. Although there are many great papers and solutions out there that use BERT-embeddings (e.g.,1,2,3, ), I could not find a BERT-based solution that did not have to be trained from scratch and could be used for beginners (correct me if I'm wrong!). Thus, the goal was apip install keybertand at most 3 lines of code in usage.2. Getting StartedBack to ToC2.1. Installationgit clone https://github.com/deepdialog/ZhKeyBERT cd ZhKeyBERT python setup.py install --user2.2. UsageThe most minimal example can be seen below for the extraction of keywords:fromzhkeybertimportKeyBERT,extract_kws_zhdocs="""时值10月25日抗美援朝纪念日,《长津湖》片方发布了“纪念中国人民志愿军抗美援朝出国作战71周年特别短片”,再次向伟大的志愿军致敬!电影《长津湖》全情全景地还原了71年前抗美援朝战场上那场史诗战役,志愿军奋不顾身的英勇精神令观众感叹:“岁月峥嵘英雄不灭,丹心铁骨军魂永存!”影片上映以来票房屡创新高,目前突破53亿元,暂列中国影史票房总榜第三名。值得一提的是,这部影片的很多主创或有军人的血脉,或有当兵的经历,或者家人是军人。提起这些他们也充满自豪,影片总监制黄建新称:“当兵以后会有一种特别能坚持的劲儿。”饰演雷公的胡军透露:“我父亲曾经参加过抗美援朝,还得了一个三等功。”影片历史顾问王树增表示:“我当了五十多年的兵,我的老部队就是上甘岭上下来的,那些老兵都是我的偶像。”“身先士卒卫华夏家国,血战无畏护山河无恙。”片中饰演七连连长伍千里的吴京感叹:“要永远记住这些先烈们,他们给我们带来今天的和平。感谢他们的付出,才让我们有今天的幸福生活。”饰演新兵伍万里的易烊千玺表示:“战争的残酷、碾压式的伤害,其实我们现在的年轻人几乎很难能体会到,希望大家看完电影后能明白,是那些先辈们的牺牲奉献,换来了我们的现在。”影片对战争群像的恢弘呈现,对个体命运的深切关怀,令许多观众无法控制自己的眼泪,观众称:“当看到影片中的惊险战斗场面,看到英雄们壮怀激烈的拼杀,为国捐躯的英勇无畏和无悔付出,我明白了为什么说今天的幸福生活来之不易。”(记者 王金跃)"""kw_model=KeyBERT(model='paraphrase-multilingual-MiniLM-L12-v2')extract_kws_zh(docs,kw_model)Comparison>>>extract_kws_zh(docs,kw_model)[('纪念中国人民志愿军抗美援朝',0.7034),('电影长津湖',0.6285),('周年特别短片',0.5668),('纪念中国人民志愿军',0.6894),('作战71周年',0.5637)]>>>importjieba;kw_model.extract_keywords(' '.join(jieba.cut(docs)),keyphrase_ngram_range=(1,3),use_mmr=True,diversity=0.25)[('抗美援朝 纪念日 长津湖',0.796),('纪念 中国人民志愿军 抗美援朝',0.7577),('作战 71 周年',0.6126),('25 抗美援朝 纪念日',0.635),('致敬 电影 长津湖',0.6514)]You can setngram_range, whose default value is(1, 3), to set the length of the resulting keywords/keyphrases:>>>extract_kws_zh(docs,kw_model,ngram_range=(1,1))[('中国人民志愿军',0.6094),('长津湖',0.505),('周年',0.4504),('影片',0.447),('英雄',0.4297)]>>>extract_kws_zh(docs,kw_model,ngram_range=(1,2))[('纪念中国人民志愿军',0.6894),('电影长津湖',0.6285),('年前抗美援朝',0.476),('中国人民志愿军抗美援朝',0.6349),('中国影史',0.5534)]NOTE: For a full overview of all possible transformer models seesentence-transformer. I would advise"paraphrase-multilingual-MiniLM-L12-v2"Chinese documents for efficiency and acceptable accuracy.2.3. Maximal Marginal RelevanceIt's recommended to use Maximal Margin Relevance (MMR) for diversity by setting the optional parameteruse_mmr, which isTruein default.To diversify the results, we can use MMR to create keywords / keyphrases which is also based on cosine similarity. The results withhigh diversity:>>>extract_kws_zh(docs,kw_model,use_mmr=True,diversity=0.7)[('纪念中国人民志愿军抗美援朝',0.7034),('观众无法控制自己',0.1212),('山河无恙',0.2233),('影片上映以来',0.5427),('53亿元',0.3287)]The results withlow diversity:>>>extract_kws_zh(docs,kw_model,use_mmr=True,diversity=0.2)[('纪念中国人民志愿军抗美援朝',0.7034),('电影长津湖',0.6285),('纪念中国人民志愿军',0.6894),('周年特别短片',0.5668),('作战71周年',0.5637)]And the default and recommendeddiversityis0.25.2.4. Embedding ModelsKeyBERT supports many embedding models that can be used to embed the documents and words:Sentence-TransformersFlairSpacyGensimUSEClickherefor a full overview of all supported embedding models.Sentence-TransformersYou can select any model fromsentence-transformershereand pass it through KeyBERT withmodel:fromzhkeybertimportKeyBERTkw_model=KeyBERT(model='all-MiniLM-L6-v2')Or select a SentenceTransformer model with your own parameters:fromzhkeybertimportKeyBERTfromsentence_transformersimportSentenceTransformersentence_model=SentenceTransformer("all-MiniLM-L6-v2")kw_model=KeyBERT(model=sentence_model)For Chinese keywords extraction, you should choose multilingual models likeparaphrase-multilingual-mpnet-base-v2andparaphrase-multilingual-MiniLM-L12-v2.MUSEMultilingual Universal Sentence Encoder(MUSE)fromzhkeybertimportKeyBERTimporttensorflow_hubimporthubmodule_url='https://hub.tensorflow.google.cn/google/universal-sentence-encoder-multilingual-large/3'model=hub.load(module_url)kw_model=KeyBERT(model=model)## slow but acceptable performanceCitationTo cite KeyBERT in your work, please use the following bibtex reference:@misc{grootendorst2020keybert,author={Maarten Grootendorst},title={KeyBERT: Minimal keyword extraction with BERT.},year=2020,publisher={Zenodo},version={v0.3.0},doi={10.5281/zenodo.4461265},url={https://doi.org/10.5281/zenodo.4461265}}ReferencesBelow, you can find several resources that were used for the creation of KeyBERT but most importantly, these are amazing resources for creating impressive keyword extraction models:Papers:Sharma, P., & Li, Y. (2019).Self-Supervised Contextual Keyword and Keyphrase Retrieval with Self-Labelling.Github Repos:https://github.com/thunlp/BERT-KPEhttps://github.com/ibatra/BERT-Keyword-Extractorhttps://github.com/pranav-ust/BERT-keyphrase-extractionhttps://github.com/swisscom/ai-research-keyphrase-extractionMMR:The selection of keywords/keyphrases was modeled after:https://github.com/swisscom/ai-research-keyphrase-extractionNOTE: If you find a paper or github repo that has an easy-to-use implementation of BERT-embeddings for keyword/keyphrase extraction, let me know! I'll make sure to add a reference to this repo.
zh-langchain
No description available on PyPI.
zhlib
No description available on PyPI.
zhlib-snapshot
No description available on PyPI.
zhlint
# zhlintNote: This project is highly related to Chinese, so the document is writtern in Chinese.## 简介一个处理文档风格的工具:* 支持文档风格的检查(使用 `check` 命令)。* 支持文档风格的自动修复(使用 `fix` 命令)。注意:* 目前仅支持 Markdown 格式文档的检测与修复。## 安装与使用### 使用 pip 安装```pip install zhlint```安装成功后,可执行 `zhlint` 命令行程序处理文档。### 检查文档风格`zhlint check SRC` 命令会检查输入 `SRC`,并将检测到的文档风格错误输出到 stdout。参数 `SRC` 可为:* 文件路径。* `-`,表示 stdin。示例如下:```shell$ ccat doc.md只有中文或中英文混排中,一律使用中文全角标点. 英文 **english**与非标点的中文之间需要有一个空格。支持简单的错误名词检测,如 APP、ios 这类的。$ zhlint check doc.md==========================================E101: 英文与非标点的中文之间需要有一个空格==========================================LINE: 1角标点. 英文 english与非标点的中文之间需--........................................==================================================E201: 只有中文或中英文混排中,一律使用中文全角标点==================================================LINE: 1中文或中英文混排中,一律使用中文全角标-.....................................LINE: 1律使用中文全角标点.-...................==================E301: 常用名词错误==================LINE: 3的错误名词检测,如 APP、ios 这类的。---....................................LINE: 3名词检测,如 APP、ios 这类的。---..............................```### 修复文档风格`zhlint fix SRC [DST]` 命令会尝试修复 `SRC` 中出现的风格错误,参数 `SRC` 可以为文件路径或者 `-`:* 如果省略 `DST`,修复后的文本将打印到标准输出。* 如果传入 `DST`,修复后的文本将写入到 `DST`。示例如下:```shell$ zhlint fix doc.md只有中文或中英文混排中,一律使用中文全角标点。 英文 **english** 与非标点的中文之间需要有一个空格。支持简单的错误名词检测,如 App、iOS 这类的。$ zhlint fix doc.md fixed-doc.md$ colordiff doc.md fixed-doc.md1c1< 只有中文或中英文混排中,一律使用中文全角标点. 英文 **english**与非标点的中文之间需要有一个空格。---> 只有中文或中英文混排中,一律使用中文全角标点。 英文 **english** 与非标点的中文之间需要有一个空格。3c3< 支持简单的错误名词检测,如 APP、ios 这类的。---> 支持简单的错误名词检测,如 App、iOS 这类的。```## 支持的检查项目| 错误码 | 检查范围 | 描述 || ------ | -------- | ------------------------------------------------------------------------------ || E101 | 段落 | 英文与非标点的中文之间需要有一个空格 || E102 | 段落 | 数字与非标点的中文之间需要有一个空格 || E103 | 段落 | 除了`%`、`℃`、以及倍数单位(如 `2x`、`3n`)之外,其余数字与单位之间需要加空格 || E104 | 段落 | 书写时括号中全为数字,则括号用半角括号且首括号前要空一格 || E201 | 句子 | 只有中文或中英文混排中,一律使用中文全角标点 || E202 | 句子 | 如果出现整句英文,则在这句英文中使用英文、半角标点 || E203 | 段落 | 中文标点与其他字符间一律不加空格 || E204 | 句子 | 中文文案中使用中文引号`「」`和`『』`,其中`「」`为外层引号 || E205 | 段落 | 省略号请使用`……`标准用法 || E206 | 段落 | 感叹号请使用`!`标准用法 || E207 | 段落 | 请勿在文章内使用`~` || E301 | 段落 | 常用名词错误 |详情见 [写作规范和格式规范,DaoCloud 文档](http://docs-static.daocloud.io/write-docs/format)。以下是各项错误的简单示例。其中,*触发样例* 是违反规则的实例,*非触发样例* 是符合文档风格的实例。### E101描述:英文与非标点的中文之间需要有一个空格。触发样例:```中文english中文 english中文\tenglish```非触发样例:```中文 english```### E102描述:数字与非标点的中文之间需要有一个空格。触发样例:```中文42中文 42```非触发样例:```中文 42```### E103描述:除了`%`、`℃`、以及倍数单位(如 `2x`、`3n`)之外,其余数字与单位之间需要加空格。触发样例:```42μ42 μ```非触发样例:```42 μ42x42n42%42%42℃Q3136-4321-1234word2vec```### E104描述:书写时括号中全为数字,则括号用半角括号且首括号前要空一格。触发样例:```中文(42)中文(42)中文(42)中文(42)中文 (42)(42)```非触发样例:```中文 (42)(42)```### E201描述:只有中文或中英文混排中,一律使用中文全角标点。触发样例:```有中文, 错误.中文'测试'中文"测试"LaTeX 公式 $$.LaTeX 公式,$$LaTeX 公式 \(\).LaTeX 公式,\(\)```非触发样例:```有中文,正确。有中文,正确......P.S. 这是一行中文。LaTeX 公式 $$LaTeX 公式 \(\)邮箱:[email protected]有中文,1.0有中文,www.google.com链接地址 http://google.com```### E202描述:如果出现整句英文,则在这句英文中使用英文、半角标点。触发样例:```pure english,nothing wrong。```非触发样例:```pure english, nothing wrong.```### E203描述:中文标点与其他字符间一律不加空格。触发样例:```中文, 测试中文 。测试「 中文」```非触发样例:```中文,测试中文;测试「中文」```### E204描述:中文文案中使用中文引号`「」`和`『』`,其中`「」`为外层引号。触发样例:```中文‘测试’中文“测试”```非触发样例:```中文「测试」```### E205描述:省略号请使用`……`标准用法。触发样例:```中文...中文.......中文。。。```非触发样例:```中文......```### E206描述:感叹号请使用`!`标准用法。触发样例:```中文!!中文!!中文!!中文??中文??中文??```非触发样例:```中文!中文!中文?中文?```### E207描述:请勿在文章内使用`~`。触发样例:```中文~```非触发样例:```中文```### E301描述:常用名词错误。触发样例:```APPappandroidiosIOSIPHONEiphoneAppStoreapp storewifiWifiWi-fiE-mailEmailPSpsPs.```非触发样例:```AppAndroid```
zhlite
zhlite说明zhlite 是一个知乎的 Python 轻量客户端,全部功能全部采用知乎官方非公布 api 实现。因为很多接口需要登陆才能访问,所以zhlite需要登录才可以稳定使用。目前对于所有zhlite获取的信息,均只可以查看不可以修改。功能用户登录登陆用户的基本信息登陆用户的关注和被关注信息登陆用户的提问登陆用户的回答登陆用户的文章以登陆用户的身份访问问题以登录用户的身份访问回答批量下载回答中的图片批量下载回答中的视频获取回答的评论增加代理支持安装pip3 install zhlite使用zhlite有几个关键核心类:Auth (用户认证模块)User (用户模块)Question (问题模块)Answer (回答模块)Article (文章模块)模块说明Auth属性类型描述login()method用户登陆isloginbool是否登陆状态profileUser Object登陆用户platformstr当前运行的系统类型User属性类型描述idstr用户自定义IDuidstr用户IDnamestr显示名字genderstr性别 0:女 1:男 -1:未知urlstr用户url连接employmentsdict职业信息educationsdict教育信息locationslist地区信息avatarstr用户头像headlinestr个人简介is_vipbool盐选会员is_orgbool机构号follower_countint关注者数量followersgenerator关注者following_countint关注的人数量followingsgenerator关注的人answer_countint回答数量answersgenerator回答question_countint提问数量questionsgenerator提问article_countint文章数量articlesgenerator文章voteup_countint获得赞同数量visit_countint来访者数量Question属性类型描述idint问题IDtitlestr问题标题detailstr问题描述topicslist问题标签typestr问题状态createddatetime提问时间updateddatetime最后一次修改时间authorUser Object提问人answersgenerator回答Answer属性类型描述idint回答IDtypestr回答状态authorUser Object回答者excerptstr摘要contentstr回答(包含HTML信息)textstr回答(不包含HTML信息)comment_countint评论数voteup_countint赞同数createddatetime回答时间updateddatetime最后一次修改时间questionQuestion Object对应的问题imagesgenerator该回答的图片videosgenerator该回答的视频Article属性类型描述idint文章IDtitlestr文章标题authorUser Object发布者topicslist话题excerptstr摘要contentstr回答(包含HTML信息)textstr回答(不包含HTML信息)comment_countint评论数voteup_countint赞同数createddatetime发布时间updateddatetime最后一次修改时间简要使用使用代理(proxy)>>>importzhlite>>>proxies={>>>"http":"http://ip:port",>>>"https":"https://ip:port">>>}>>>zhlite.set_proxy(proxies)用户认证(Auth)第一次实例化Auth对象时需要通过手机号和密码登陆,之后会生成一个cookies.txt文件保存登录信息,以后无需再次重复登陆。如需重新登陆,可以通过.login(relogin=True)强制重新登陆,并刷新cookies.txt文件注意:短时间内多次通过密码登陆会导致账户异常,账户异常会强制要求用户更改密码并短时间内锁定ip>>>fromzhliteimportAuth>>>auth=Auth()>>>auth.login(relogin=True)登陆用户用户登陆之后可通过.profile获得一个登录用户的User对象>>>fromzhliteimportAuth>>>auth=Auth()>>>auth.profile<zhlite.zhlite.Userobjectat0x0000024C6C989630>登录成功之后会在当前路径下保存一个cookies.txt作为下次登陆免输入的cookies文件,如果需要强制重新登陆或者更换登录用户,可以通过.islogin(relogin=True)(relogin指定True即为强制登陆)用户(User)>>>fromzhliteimportAuth,User,Question,Answer>>>auth=Auth()>>>user=User('zhihuadmin')# 知乎小管家>>>user<zhlite.zhlite.Userobjectat0x00000293F66A81D0>>>>user.id'zhihuadmin'>>>user.name'知乎小管家'>>>user.questions<generatorobjectUser.questionsat0x00000293F67620C0>>>>list(user.questions)# 谨慎用 list() 如果用户的提问数量很多会导致性能问题[<zhlite.zhlite.Questionobjectat0x00000293F77164E0>,<zhlite.zhlite.Questionobjectat0x00000293F77FD1D0>,<zhlite.zhlite.Questionobjectat0x00000293F76AB048>,<zhlite.zhlite.Questionobjectat0x00000293F6691C18>,<zhlite.zhlite.Questionobjectat0x00000293F7582E80>,<zhlite.zhlite.Questionobjectat0x00000293F66A80B8>,<zhlite.zhlite.Questionobjectat0x00000293F758E390>,<zhlite.zhlite.Questionobjectat0x00000293F7716400>,<zhlite.zhlite.Questionobjectat0x00000293F6691BE0>,<zhlite.zhlite.Questionobjectat0x00000293F76ECA90>]问题(Question)>>>fromzhliteimportAuth>>>auth=Auth()>>>question=Question('19550225')>>>question<zhlite.zhlite.Questionobjectat0x00000293F76ECF28>>>>question.title'如何使用知乎?'>>>question.author<zhlite.zhlite.Userobjectat0x00000293F76EC8D0>>>>question.created'2010-12-20 03:27:20'>>>question.answers<generatorobjectQuestion.answersat0x00000293F67622A0>回答(Answer)>>>answer=Answer('95070154')>>>answer<zhlite.zhlite.Answerobjectat0x00000293F77FD1D0>>>>answer.excerpt'本问题隶属于「知乎官方指南」:属于「知乎官方指南」的问答有哪些? -- 在知乎上回答问题有一个基本原则:尽可能提供详细的解 释和说明。 不要灌水——不要把「评论」当作「答案」来发布。 如果你对问题本身或别人的答案有自己的看法,你可以通过「评论」来进行,不要把评论当作答案来发布。那样的话,该回答会被其他用户点击「没有帮助」而折叠起来,反而起不到实际效果,也无助于提供高质量的答案。 --------关于回答--------- …'>>>answer.comment_count11>>>answer.created'2016-04-13 13:48:52'>>>answer.question<zhlite.zhlite.Questionobjectat0x00000293F76AB048>
zh-lunar-date
ZhDate 中国农历日期处理对象不用网络接口直接本地计算中国农历,支持农历阳历互转感谢EillesWan更新修正农历初一前一天错误修正 f 字符串输出方式安装方法通过 pip 直接安装pipinstallzh-lunar-date或从 git 拉取gitclonehttps://github.com/chen-kay/zhdate.gitcdzhdate pythonsetup.pyinstall更新pipinstallzh-lunar-date--upgrade使用方法见如下代码案例:fromzhdateimportZhDatedate1=ZhDate(2010,1,1)# 新建农历 2010年正月初一 的日期对象print(date1)# 直接返回农历日期字符串dt_date1=date1.to_datetime()# 农历转换成阳历日期 datetime 类型dt_date2=datetime(2010,2,6)date2=ZhDate.from_datetime(dt_date2)# 从阳历日期转换成农历日期对象date3=ZhDate(2020,4,30,leap_month=True)# 新建农历 2020年闰4月30日print(date3.to_datetime())# 支持比较ifZhDate(2019,1,1)==ZhDate.from_datetime(datetime(2019,2,5)):pass# 减法支持new_zhdate=ZhDate(2019,1,1)-30#减整数,得到差额天数的新农历对象new_zhdate2=ZhDate(2019,1,1)-ZhDate(2018,1,1)#两个zhdate对象相减得到两个农历日期的差额new_zhdate3=ZhDate(2019,1,1)-datetime(2019,1,1)# 减去阳历日期,得到农历日期和阳历日期之间的天数差额# 加法支持new_zhdate4=ZhDate(2019,1,1)+30# 加整数返回相隔天数以后的新农历对象# 中文输出new_zhdate5=ZhDate(2019,1,1)print(new_zhdate5.chinese())# 当天的农历日期ZhDate.today()
zhmc-ansible-modules
zhmc-ansible-modules - Ansible modules for the IBM Z HMC Web Services APIMoving to Ansible GalaxyStarting with version 0.9.0, the zhmc Ansible modules are no longer distributed as thezhmc-ansible-modules package on Pypi, but as theibm.ibm_zhmc collection on Galaxy.OverviewThe zhmc-ansible-modules Python package containsAnsiblemodules that can manage platform resources onIBM ZandLinuxONEmachines that are in the Dynamic Partition Manager (DPM) operational mode.The goal of this package is to be able to utilize the power and ease of use of Ansible for the management of IBM Z platform resources.The IBM Z resources that can be managed include Partitions, HBAs, NICs, and Virtual Functions.The Ansible modules in the zhmc-ansible-modules package are fullyidempotent, following an important principle for Ansible modules.The idempotency of a module allows Ansible playbooks to specify the desired end state for a resource, regardless of what the current state is. For example, a IBM Z partition can be specified to havestate=activewhich means that it must exist and be in the active operational status. Depending on the current state of the partition, actions will be taken by the module to reach this desired end state: If the partition does not exist, it will be created and started. If it exists but is not active, it will be started. If it is already active, nothing will be done. Other initial states including transitional states such as starting or stopping also will be taken care of.The idempotency of modules makes Ansible playbooks restartable: If an error happens and some things have been changed already, the playbook can simply be re-run and will automatically do the right thing, because the initial state does not matter for reaching the desired end state.The Ansible modules in the zhmc-ansible-modules package are written in Python and interact with the Web Services API of the Hardware Management Console (HMC) of the machines to be managed, by using the API of thezhmcclientPython package.DocumentationThis version of the project has its documentation on RTD:http://zhmc-ansible-modules.readthedocs.io/en/stable/Starting with version 0.9.0, the documentation is available on GitHub Pages:https://zhmcclient.github.io/zhmc-ansible-modules/Playbook examplesHere are some examples for using the Ansible modules in this project:Create a stopped partitionThis task ensures that a partition with this name exists, is in the stopped status and has certain property values.----hosts:localhosttasks:-name:Ensure a partition exists and is stoppedzhmc_partition:hmc_host:"10.11.12.13"hmc_auth:"{{hmc_auth}}"cpc_name:P000S67Bname:"mypartition1"state:stoppedproperties:description:"zhmcAnsiblemodules:partition1"ifl_processors:2initial_memory:1024maximum_memory:1024minimum_ifl_processing_weight:50maximum_ifl_processing_weight:800initial_ifl_processing_weight:200...# all partition properties are supportedStart a partitionIf this task is run after the previous one shown above, no properties need to be specified. If it is possible that the partition first needs to be created, then properties would be specified, as above.----hosts:localhosttasks:-name:Ensure a partition exists and is activezhmc_partition:hmc_host:"10.11.12.13"hmc_auth:"{{hmc_auth}}"cpc_name:P000S67Bname:"mypartition1"state:activeproperties:...# see aboveDelete a partitionThis task ensures that a partition with this name does not exist. If it currently exists, it is stopped (if needed) and deleted.----hosts:localhosttasks:-name:Ensure a partition does not existzhmc_partition:hmc_host:"10.11.12.13"hmc_auth:"{{hmc_auth}}"cpc_name:P000S67Bname:"mypartition1"state:absentCreate an HBA in a partition----hosts:localhosttasks:-name:Ensure HBA exists in the partitionzhmc_hba:hmc_host:"10.11.12.13"hmc_auth:"{{hmc_auth}}"cpc_name:P000S67Bpartition_name:"mypartition1"name:"hba1"state:presentproperties:adapter_name:"fcp1"adapter_port:0description:The HBA to our storagedevice_number:"023F"...# all HBA properties are supportedCreate a NIC in a partition----hosts:localhosttasks:-name:Ensure NIC exists in the partitionzhmc_nic:hmc_host:"10.11.12.13"hmc_auth:"{{hmc_auth}}"cpc_name:P000S67Bpartition_name:"mypartition1"name:"nic1"state:presentproperties:adapter_name:"osa1"adapter_port:1description:The NIC to our data networkdevice_number:"013F"...# all NIC properties are supportedCreate a Virtual Function in a partition----hosts:localhosttasks:-name:Ensure virtual function for zEDC adapter exists in the partitionzhmc_virtual_function:hmc_host:"10.11.12.13"hmc_auth:"{{hmc_auth}}"cpc_name:P000S67Bpartition_name:"mypartition1"name:"vf1"state:presentproperties:adapter_name:"zedc1"description:The virtual function for our accelerator adapterdevice_number:"043F"...# all VF properties are supportedConfigure partition for booting from FCP LUN----hosts:localhosttasks:-name:Configure partition for booting via HBAzhmc_partition:hmc_host:"10.11.12.13"hmc_auth:"{{hmc_auth}}"cpc_name:P000S67Bname:"mypartition1"state:stoppedproperties:boot_device:storage-adapterboot_storage_hba_name:"hba1"boot_logical_unit_number:"0001"boot_world_wide_port_name:"00cdef01abcdef01"Configure crypto config of a partition----hosts:localhosttasks:-name:Ensure crypto config for partitionzhmc_partition:hmc_host:"10.11.12.13"hmc_auth:"{{hmc_auth}}"cpc_name:P000S67Bname:"mypartition1"state:stoppedproperties:crypto_configuration:crypto_adapter_names:-"crypto1"crypto_domain_configurations:-domain_index:17access_mode:"control-usage"-domain_index:19access_mode:"control"QuickstartFor installation instructions, seeInstallation of zhmc-ansible-modules package.After having installed the zhmc-ansible-modules package, you can download and run the example playbooks infolder ‘playbooks’ of the Git repository:create_partition.ymlcreates a partition with a NIC, HBA and virtual function to an accelerator adapter.delete_partition.ymldeletes a partition.vars_example.ymlis an example variable file defining variables such as CPC name, partition name, etc.vault_example.ymlis an example password vault file defining variables for authenticating with the HMC.Before you run a playbook, copyvars_example.ymltovars.ymlandvault_example.ymltovault.ymland change the variables in those files as needed.Then, run the example playbooks:$ ansible-playbook create_partition.yml PLAY [localhost] ********************************************************** TASK [Gathering Facts] **************************************************** ok: [127.0.0.1] TASK [Ensure partition exists and is stopped] ***************************** changed: [127.0.0.1] TASK [Ensure HBA exists in the partition] ********************************* changed: [127.0.0.1] TASK [Ensure NIC exists in the partition] ********************************* changed: [127.0.0.1] TASK [Ensure virtual function exists in the partition] ******************** changed: [127.0.0.1] TASK [Configure partition for booting via HBA] **************************** changed: [127.0.0.1] PLAY RECAP **************************************************************** 127.0.0.1 : ok=6 changed=5 unreachable=0 failed=0 $ ansible-playbook delete_partition.yml PLAY [localhost] ********************************************************** TASK [Gathering Facts] **************************************************** ok: [127.0.0.1] TASK [Ensure partition does not exist] ************************************ changed: [127.0.0.1] PLAY RECAP **************************************************************** 127.0.0.1 : ok=2 changed=1 unreachable=0 failed=0
zhmccli
zhmccli - A CLI for the IBM Z HMC, written in pure PythonOverviewThe zhmccli package is a CLI written in pure Python that interacts with the Hardware Management Console (HMC) ofIBM ZorLinuxONEmachines. The goal of this package is to provide an easy-to-use command line interface for operators.The zhmccli package uses the API provided by the zhmcclient package, which interacts with the Web Services API of the HMC. It supports management of the lifecycle and configuration of various platform resources, such as partitions, CPU, memory, virtual switches, I/O adapters, and more.InstallationThe quick way:$pipinstallzhmccliFor more details, see theInstallation sectionin the documentation.QuickstartThe following example lists the names of the machines (CPCs) managed by an HMC:$hmc_host="<IP address or hostname of the HMC>"$hmc_userid="<userid on that HMC>"$zhmc-h$hmc_host-u$hmc_useridcpclist--names-onlyEnterpassword(foruser...atHMC...):.......+----------+|name||----------+|P000S67B|+----------+DocumentationDocumentationChange logContributingFor information on how to contribute to this project, see theDevelopment sectionin the documentation.LicenseThe zhmccli package is licensed under theApache 2.0 License.
zhmcclient
zhmcclient - A pure Python client library for the IBM Z HMC Web Services APIOverviewThe zhmcclient package is a client library written in pure Python that interacts with the Web Services API of the Hardware Management Console (HMC) ofIBM ZorLinuxONEmachines. The goal of this package is to make the HMC Web Services API easily consumable for Python programmers.The HMC Web Services API is the access point for any external tools to manage the IBM Z or LinuxONE platform. It supports management of the lifecycle and configuration of various platform resources, such as partitions, CPU, memory, virtual switches, I/O adapters, and more.The zhmcclient package encapsulates both protocols supported by the HMC Web Services API:REST over HTTPS for request/response-style operations driven by the client. Most of these operations complete synchronously, but some long-running tasks complete asynchronously.JMS (Java Messaging Services) for notifications from the HMC to the client. This can be used to be notified about changes in the system, or about completion of asynchronous tasks started using REST.InstallationThe quick way:$pipinstallzhmcclientFor more details, see theInstallation sectionin the documentation.QuickstartThe following example code lists the partitions on CPCs in DPM mode that are accessible for the user:#!/usr/bin/env pythonimportzhmcclientimportrequests.packages.urllib3requests.packages.urllib3.disable_warnings()# Set these variables for your environment:host="<IP address or hostname of the HMC>"userid="<userid on that HMC>"password="<password of that HMC userid>"verify_cert=Falsesession=zhmcclient.Session(host,userid,password,verify_cert=verify_cert)client=zhmcclient.Client(session)console=client.consoles.consolepartitions=console.list_permitted_partitions()forpartinpartitions:cpc=part.manager.parentprint("{}{}".format(cpc.name,part.name))Possible output when running the script:P000S67B PART1 P000S67B PART2 P0000M96 PART1Documentation and Change LogFor the latest released version on PyPI:DocumentationChange logzhmc CLIBefore version 0.18.0 of the zhmcclient package, it contained the zhmc CLI. Starting with zhmcclient version 0.18.0, the zhmc CLI has been moved from this project into the newzhmccli project.If your project uses the zhmc CLI, and you are upgrading the zhmcclient package from before 0.18.0 to 0.18.0 or later, your project will need to add thezhmccli packageto its dependencies.ContributingFor information on how to contribute to this project, see theDevelopment sectionin the documentation.LicenseThe zhmcclient package is licensed under theApache 2.0 License.
zhmc-os-forwarder
TheIBM Z HMC OS Message Forwarderconnects to the console of operating systems running in LPARs on Z systems and forwards the messages written by the operating systems in the LPARs to remote syslog servers.The Z systems can be in classic or DPM operational mode.The forwarder attempts to stay up as much as possible, for example it performs automatic session renewals with the HMC if the logon session expires, and it survives HMC reboots and automatically resumes forwarding again once the HMC come back up, without loosing or duplicating any messages.DocumentationDocumentationChange logSupported environmentsOperating systems: Linux, macOS, WindowsPython versions: 3.5 and higherHMC versions: 2.11.1 and higherQuickstartInstall the forwarder and all of its Python dependencies as follows:$pipinstallzhmc-os-forwarderProvide aconfig filefor use by the forwarder.The config file tells the forwarder which HMC to use, and for which CPCs and LPARs it should forward to which syslog servers.Download theExample forwarder config fileand edit that copy according to your needs.For details, seeForwarder config file.Run the forwarder as follows:$zhmc_os_forwarder-cconfig.yamlzhmc_os_forwarderversion:0.2.0zhmcclientversion:1.10.0Verbositylevel:0OpeningsessionwithHMC10.11.12.13(user:[email protected],certificatevalidation:False)Forwarderisupandrunning(PressCtrl-Ctoshutdown)LimitationsAt this point, the forwarder has several limitations. All of them are intended to be resolved in future releases.The forwarder does not recover from HMC restart or connection lossRestarting the forwarder will send again all OS messages the HMC has bufferedNew and deleted LPARs in DPM mode are not automatically detected.Reporting issuesIf you encounter a problem, please report it as anissue on GitHub.LicenseThis package is licensed under theApache 2.0 License.
zhmc-prometheus-exporter
TheIBM Z HMC Prometheus Exporteris aPrometheus exporterwritten in Python that retrieves metrics from theIBM ZHardware Management Console (HMC) and exports them to thePrometheusmonitoring system.The exporter attempts to stay up as much as possible, for example it performs automatic session renewals with the HMC if the logon session expires, and it survives HMC reboots and automatically picks up metrics collection again once the HMC come back up.DocumentationDocumentationChange logQuickstartInstall the exporter and all of its Python dependencies as follows:$pipinstallzhmc-prometheus-exporterProvide anHMC credentials filefor use by the exporter.The HMC credentials file tells the exporter which HMC to talk to for obtaining metrics, and which userid and password to use for logging on to the HMC.It also defines whether HTTP or HTTPS is used for Prometheus, and HTTPS related certificates and keys.Download thesample HMC credentials fileashmccreds.yamland edit that copy accordingly.For details, seeHMC credentials file.Provide ametric definition filefor use by the exporter.The metric definition file maps the metrics returned by the HMC to metrics exported to Prometheus.Furthermore, the metric definition file allows optimizing the access time to the HMC by disabling the fetching of metrics that are not needed.Download thesample metric definition fileasmetrics.yaml. It can be used as it is and will have all metrics enabled and mapped properly. You only need to edit the file if you want to adjust the metric names, labels, or metric descriptions, or if you want to optimize access time by disabling metrics not needed.For details, seeMetric definition file.Run the exporter as follows:$zhmc_prometheus_exporter-chmccreds.yaml-mmetrics.yamlExporterisupandrunningonport9291Depending on the number of CPCs managed by your HMC, and dependent on how many metrics are enabled, it will take some time until the exporter reports to be up and running. You can see what it does in the mean time by using the-voption. Subsequent requests to the exporter will be sub-second.Direct your web browser athttp://localhost:9291(orhttps://localhost:9291when using HTTPS) to see the exported Prometheus metrics. Refreshing the browser will update the metrics.Reporting issuesIf you encounter a problem, please report it as anissue on GitHub.LicenseThis package is licensed under theApache 2.0 License.
zhmiscellany
zhmiscellany,a collection of miscellany functions/classes/modules made by me (zh).IntroductionUsage examplesDocumentationIntroductionCan be installed withpip install zhmiscellanyThe git repository for this package can be foundhere. The docs also look nicer on github.If you want to reach out, you may add my on discord at @z_h_ or joinmy server.Some small issues to take note of:I made a small mistake, please ignore that the repo claims to have far fewer commits than the version number of the package would imply, sort of my fault but also the way git caches changes locally is silly.Usage examplesA script that caches and prints out the user IDs of all the members in a server.importzhmiscellanymembers=zhmiscellany.discord.scrape_guild(user_token=zhmiscellany.discord.get_local_discord_user()[0],guild_id='1162030646424768562',channel_id='1162031219471556629')formember_idinmembers:print(member_id)A script that downloads all messages from a server and caches them (aka stores data in json files), Then downloads all the found media files, with print-outs of ETA, % complete, etc.importzhmiscellany,time,os,reguild_channels=zhmiscellany.discord.get_guild_channels(zhmiscellany.discord.get_local_discord_user()[0],'1001978777892552884')channels_message_data=[]forchannelinguild_channels:channels_message_data.append(zhmiscellany.discord.get_channel_messages(zhmiscellany.discord.get_local_discord_user()[0],channel['id']))media_dir=r'/scraped_media'urls=[]count=0formessagesinchannels_message_data:formessageinmessages:forattachmentinmessage['attachments']:ifany(cinattachment['url'].lower()forcin['.mp4','.jpg','.png','.webp','.mp3']):count+=1url=attachment['url'].split('?')[0]urls.append(url)total=counteta_count=counttimestamps=[]count=0forurlinurls:count+=1print(url)print(f'{count},{zhmiscellany.math.smart_percentage(count,total)}%, ETA{zhmiscellany.math.calculate_eta(timestamps,eta_count)}')downloaded=(zhmiscellany.netio.download_file(url,f'{media_dir}\\{zhmiscellany.fileio.convert_name_to_filename(url)}',os.path.splitext(url)[1].lower()))ifdownloaded:timestamps.append(time.time())else:eta_count-=1A script that reposts messages you've sent in one channel to many other channels.importzhmiscellany,timefrom_channel='1122614930617683975'post_channels=['880703742096326677','1141178363885670505']amount_of_messages=3messages=zhmiscellany.discord.get_channel_messages(user_token=zhmiscellany.discord.get_local_discord_user()[0],channel_id=from_channel,limit=amount_of_messages,use_cache=False)messages.reverse()forchannelinpost_channels:formessageinmessages:ifmessage['author']['id']==zhmiscellany.discord.get_local_discord_user()[2]:content=message['content']attachments=[]foriinmessage['attachments']:attachments.append(i['url'])iflen(attachments)>0:iflen(content)>0:content=f'{content}{" ".join(attachments)}'else:content=" ".join(attachments)zhmiscellany.discord.send_message(zhmiscellany.discord.get_local_discord_user()[0],content,channel)print(content)time.sleep(1)A script that reacts to a bunch of messages in multiple channels, with print-outs of ETA, % complete, etc.importzhmiscellany,timechannel_ids=['926310071435145256','880703742096326677']channels_message_data=[]amount_of_messages=100emojis=['🇦🇺']forideinchannel_ids:channels_message_data.append(zhmiscellany.discord.get_channel_messages(user_token=zhmiscellany.discord.get_local_discord_user()[0],channel_id=ide,limit=amount_of_messages,use_cache=False))ids=[]count=0formessagesinchannels_message_data:formessageinmessages:count+=1ide=[message['id'],message['channel_id']]ids.append(ide)total=counteta_count=counttimestamps=[]count=0forideinids:count+=1print(f'{count},{zhmiscellany.math.smart_percentage(count,eta_count)}%, ETA{zhmiscellany.math.calculate_eta(timestamps,eta_count)}')zhmiscellany.discord.add_reactions_to_message(zhmiscellany.discord.get_local_discord_user()[0],emojis,ide[1],ide[0])timestamps.append(time.time())A script that prints out the URLs to all the attachments on a message.importzhmiscellanymessage_url='https://discord.com/channels/1001978777892552884/1064070189324435466/1162434625092718623'message=zhmiscellany.discord.get_message(zhmiscellany.discord.get_local_discord_user()[0],zhmiscellany.discord.message_url_to_ids(message_url)[1],zhmiscellany.discord.message_url_to_ids(message_url)[2])forattachmentinmessage['attachments']:url=attachment['url']print(url)Documentation:zhmiscellany.discordFunctions for interacting with discord in various ways.zhmiscellany.fileioFunctions for interacting with local files, such as json and other file related functions I find useful.zhmiscellany.stringFunctions for interacting with/generating strings that I find useful.zhmiscellany.mathFunctions for making some calculations easier.zhmiscellany.netioInternet related functions that didn't make sense in any other module.zhmiscellany.imageFunctions for quantifying and manipulating images.zhmiscellany.listFunctions for manipulating lists.zhmiscellany.dictFunctions for working with dicts.zhmiscellany.processingFunctions for processing data in threads in a more straight forward way.zhmiscellany.miscMisc functions that didn't fit anywhere else.zhmiscellany.discord:zhmiscellany.discord.add_reactions_to_message()zhmiscellany.discord.add_reactions_to_message(user_token, message_url, emojis)Reacts to a message with the given emoji(s).example:importzhmiscellanyzhmiscellany.discord.add_reactions_to_message(user_token=zhmiscellany.discord.get_local_discord_user()[0],emojis=['🦛','🇦🇺'],channel_id='263894734190280704',message_id='263894769158062082')zhmiscellany.discord.get_channel_messages()get_channel_messages(user_token, channel_id, limit = 0, use_cache = True)Gets any amount of messages from a channel.Can also cache the data locally, so that it won't have to re download them when ran for a second time.example:importzhmiscellanylast_1000_messages=zhmiscellany.discord.get_channel_messages(user_token=zhmiscellany.discord.get_local_discord_user()[0],channel_id='263894734190280704',limit=1000,use_cache=False)zhmiscellany.discord.get_local_discord_user()zhmiscellany.discord.get_local_discord_user()Gets info about the local user, allows code to be run without needing to find your damn user token every time.So if the user is logged into discord on the app or in the browser (on windows) this function can return the data, which can really streamline things.example:importzhmiscellanyuser_data=zhmiscellany.discord.get_local_discord_user()user_token=user_data[0]zhmiscellany.discord.get_guild_channels()zhmiscellany.discord.get_guild_channels(user_token, guild_id, use_cache=True)Gets a dict of all the channels in a server. This one can also cache the data locally, so that it runs instantly the second time around.example:importzhmiscellanyguild_channels=zhmiscellany.discord.get_guild_channels(user_token=zhmiscellany.discord.get_local_discord_user()[0],guild_id='880697939016695850',use_cache=True)channel_ids=[channel['id']forchannelinguild_channels]zhmiscellany.discord.send_message()zhmiscellany.discord.send_message(user_token, text, channel_id)Sends a message in a channel.example:importzhmiscellanyzhmiscellany.discord.send_message(user_token=zhmiscellany.discord.get_local_discord_user()[0],text='Hello, every nyan!',channel_id='263894734190280704')zhmiscellany.discord.get_message()zhmiscellany.discord.get_message(user_token, channel_id, message_id)Gets a message from a channel.example:importzhmiscellanymessage=zhmiscellany.discord.get_message(user_token=zhmiscellany.discord.get_local_discord_user()[0],channel_id='263894734190280704',message_id='263894769158062082')content=message['content']zhmiscellany.discord.ids_to_message_url()zhmiscellany.discord.ids_to_message_url(channel_id, message_id, guild_id = None)Turns ids into a message url. Direct messages don't have a guild id, so the guild_id argument is optional depending on if the message is in a guild channel or a DM channel.example:importzhmiscellanymessagw_url=zhmiscellany.discord.ids_to_message_url(guild_id='880697939016695850',channel_id='880703742096326677',message_id='880726566118768640')zhmiscellany.discord.message_url_to_ids()zhmiscellany.discord.message_url_to_ids(message_url)Turns a message URL into its respective IDs.example:importzhmiscellanymessage_ids=zhmiscellany.discord.message_url_to_ids('https://discord.com/channels/880697939016695850/880703742096326677/880726566118768640')guild_id=message_ids[0]channel_id=message_ids[1]message_id=message_ids[2]zhmiscellany.discord.scrape_guild()scrape_guild(guild_id, channel_id, user_token, use_cache=True, console=False)Turns a message URL into its respective IDs.example:importzhmiscellanymembers=zhmiscellany.discord.scrape_guild(user_token=zhmiscellany.discord.get_local_discord_user()[0],guild_id='1162030646424768562',channel_id='1162031219471556629')formember_idinmembers:print(member_id)zhmiscellany.dictzhmiscellany.dict.print_dict()zhmiscellany.dict.print_dict(ldict)Prints out a dict in a readable way.zhmiscellany.fileiozhmiscellany.fileio.read_json_file()zhmiscellany.fileio.read_json_file(file_path)Reads json data from a json file and returns it as a dict.zhmiscellany.fileio.write_json_file()zhmiscellany.fileio.write_json_file(file_path, data)Writes a dict to a json file.zhmiscellany.fileio.create_folder()zhmiscellany.fileio.create_folder(folder_name)Creates a folder.zhmiscellany.fileio.remove_folder()zhmiscellany.fileio.remove_folder(folder_name)Removes a folder and all contents.zhmiscellany.fileio.base_name_no_ext()zhmiscellany.fileio.base_name_no_ext(file_path)Get the name of a file without the ext.zhmiscellany.fileio.convert_name_to_filename()zhmiscellany.fileio.convert_name_to_filename(name)Convert a URL like name to a file system like name.zhmiscellany.fileio.convert_filename_to_name()zhmiscellany.fileio.convert_filename_to_name(filename)Convert a file system like name back to a URL like name.zhmiscellany.fileio.recursive_copy_files()zhmiscellany.fileio.recursive_copy_files(source_dir, destination_dir, prints=False)Copy all the files from a source directory and into a destination directory.zhmiscellany.fileio.empty_directory()zhmiscellany.fileio.empty_directory(directory_path)Delete all the files in a directory but not the directory itself.zhmiscellany.fileio.abs_listdir()zhmiscellany.fileio.abs_listdir(path)List the files in a directory, returns absolute paths.zhmiscellany.fileio.delete_ends_with()zhmiscellany.fileio.delete_ends_with(directory, string_endswith, avoid=[])Delete all the files in a directory that end with a string, optional list of what files to avoid.zhmiscellany.fileio.read_bytes_section()zhmiscellany.fileio.read_bytes_section(file_path, section_start, section_end)Read a section of a file without reading the whole thing.zhmiscellany.imagezhmiscellany.image.image_diff()zhmiscellany.image.image_diff(img1, img2)Quantify the difference between 2 images, returns a float, lower means less difference.zhmiscellany.listzhmiscellany.list.subtract_lists()zhmiscellany.list.subtract_lists(main_list, *other_lists)Subtract some lists from a main list.zhmiscellany.list.remove_duplicates_by_element()zhmiscellany.list.remove_duplicates_by_element(tuple_list, element)Removes duplicates from a 2d list, takes an element for what to judge a duplicate by in the sub lists.zhmiscellany.mathzhmiscellany.math.calculate_eta()zhmiscellany.math.calculate_eta(timestamps, total_timestamps)Calculates the ETA of an event by a list of timestamps and an expected total amount of timestamps.zhmiscellany.math.smart_percentage()zhmiscellany.math.smart_percentage(things, total_things)Returns a percentage that is automatically rounded to an appropriate amount of decimal points.zhmiscellany.math.calculate_evenly_spaced_points()zhmiscellany.math.calculate_evenly_spaced_points(duration, segments)Calculates some evenly spaced numbers out of a larger number, for instance (5, 3) would be [0, 2.5, 5].zhmiscellany.math.clamp()zhmiscellany.math.clamp(value, minimum, maximum)Clamps a value between 2 other values, (5, 2, 4) would return 4.zhmiscellany.misczhmiscellany.misc.die()zhmiscellany.misc.die()Kills the entire program, even if ran in a thread. Often useful.zhmiscellany.misc.set_activity_timeout()zhmiscellany.misc.set_activity_timeout(timeout)Sets the timeout for how long the program should wait without an activity before closing.zhmiscellany.misc.activity()zhmiscellany.misc.activity()Signifies an activity to the timeout.zhmiscellany.netiozhmiscellany.netio.download_file()zhmiscellany.netio.download_file(url, file_path, ext)Downloads a file from a url to a file path, with an ext.zhmiscellany.processingzhmiscellany.processing.batch_threading()zhmiscellany.processing.batch_threading(targets, threads)Takes a list of functions and arguments, for instance [(print_numbers_up_to, 8), (print_numbers_up_to, 11)]zhmiscellany.stringzhmiscellany.string.convert_to_base62()zhmiscellany.string.convert_to_base62(number)Converts an integer to a base 62 number, this means all lower and upper letters, and numbers are used.zhmiscellany.string.get_universally_unique_string()zhmiscellany.string.get_universally_unique_string()Returns a universally unique string.zhmiscellany.string.multi_replace()zhmiscellany.string.multi_replace(string, replaces)Takes a string and a list of tuples, like (string, [(string1, string2)]) and in this instance replaces string1 in string with string2.zhmiscellany.string.timestamp_to_time()zhmiscellany.string.timestamp_to_time(unix_timestamp)Takes a unix timestamp and returns the actual time as a string.zhmiscellany.string.truncate_string()zhmiscellany.string.truncate_string(input_string, max_length)Truncates a string to a certain length.zhmiscellany.string.concatenate_strings_to_length()zhmiscellany.string.concatenate_strings_to_length(strings, limit)Takes a list of strings and adds them together until adding any more would exceed the limit, then returns the resulting string.zhmiscellany.string.smart_round()zhmiscellany.string.smart_round(number, decimals=0)Same as builtin "round" but removes any hanging .0 if it occurs.zhmiscellany.string.convert_bytes()zhmiscellany.string.convert_bytes(size)Converts an int of bytes to a string like '8.3MB'.zhmiscellany.string.decide()zhmiscellany.string.decide(options, text)Takes a list of options and a description text and makes the user decide between the options.
zhmiscellanyocr
zhmiscellanyocr,A collection of OCR (image text recognition) functions made by me (zh).IntroductionUsage examplesDocumentationIntroductionCan be installed withpip install zhmiscellanyocrThe git repository for this package can be foundhere. The docs also look nicer on github.If you want to reach out, you may add my on discord at @z_h_ or joinmy server.Usage examplesComing soonDocumentation:zhmiscellanyocr.ocr()zhmiscellanyocr.ocr(image)Takes an image path or a PIL image object and runs local image text recognition and returns the text in the image. Does not use the internet to function.zhmiscellanyocr.batch_ocr()zhmiscellanyocr.batch_ocr(images, threads=10, prints=False)Takes a list of image paths or PIL image objects and concurrently runs local image text recognition and returns the text in the image. Does not use the internet to function.
zh-mistake-text-aug
中文錯誤類型文字增量安裝pipinstallzh-mistake-text-aug使用 (Pipeline)fromzh_mistake_text_augimportPipelineimportrandomrandom.seed(7)pipeline=Pipeline()augs=pipeline("中文語料生成")forauginaugs:print(aug)type='MissingWordMaker' correct='中文語料生成' incorrect='中文料生成' incorrect_start_at=2 incorrect_end_at=2 span='語' type='MissingVocabMaker' correct='中文語料生成' incorrect='語料生成' incorrect_start_at=0 incorrect_end_at=2 span='中文' type='PronounceSimilarWordMaker' correct='中文語料生成' incorrect='中文語尥生成' incorrect_start_at=3 incorrect_end_at=3 span='尥' type='PronounceSameWordMaker' correct='中文語料生成' incorrect='諥文語料生成' incorrect_start_at=0 incorrect_end_at=0 span='諥' type='PronounceSimilarVocabMaker' correct='中文語料生成' incorrect='鍾文語料生成' incorrect_start_at=0 incorrect_end_at=2 span='鍾文' type='PronounceSameVocabMaker' correct='中文語料生成' incorrect='中文预料生成' incorrect_start_at=2 incorrect_end_at=4 span='预料' type='RedundantWordMaker' correct='中文語料生成' incorrect='成中文語料生成' incorrect_start_at=0 incorrect_end_at=0 span='成' type='MistakWordMaker' correct='中文語料生成' incorrect='谁文語料生成' incorrect_start_at=0 incorrect_end_at=0 span='谁'可用方法fromzh_mistake_text_aug.data_makerimport...Data MakerDescriptionMissingWordMaker隨機缺字MissingVocabMaker隨機缺詞PronounceSimilarWordMaker隨機相似字替換PronounceSimilarWordPlusMaker編輯距離找發音相似並且用高頻字替換PronounceSimilarVocabMaker發音相似詞替換PronounceSameWordMaker發音相同字替換PronounceSameVocabMaker發音相同詞替換RedundantWordMaker隨機複製旁邊一個字作為沆於字MistakWordMaker隨機替換字MistakeWordHighFreqMaker隨機替換高頻字MissingWordHighFreqMaker隨機刪除高頻字
zh-mistake-text-gen
錯誤類型中文語料生成安裝pipinstallzh-mistake-text-gen使用 (Pipeline)fromzh_mistake_text_genimportPipelinepipeline=Pipeline()incorrect_sent=pipeline("中文語料生成")print(incorrect_sent)# type='PronounceSimilarVocabMaker' correct='中文語料生成' incorrect='鍾文語料生成' incorrect_start_at=0 incorrect_end_at=2 span='鍾文'文檔Pipeline__init__makers= None : maker實例,可選maker_weight= None : maker被抽中的機率,可選__call__x: 輸入句(str),必需error_per_sent: 每句要多少錯誤。預設:1no_change_on_gen_fail: 生成方法失敗的時候允許不變動。啟用時不拋出錯誤,反之。預設:Falseverbose=True : debug 訊息,可選可用方法fromzh_mistake_text_gen.data_makerimport*Data MakerDescriptionNoChangeMaker沒有任何變換MissingWordMaker隨機缺字MissingVocabMaker隨機缺詞PronounceSimilarWordMaker隨機相似字替換PronounceSimilarWordPlusMaker編輯距離找發音相似並且用高頻字替換PronounceSimilarVocabMaker發音相似詞替換PronounceSimilarVocabPlusMaker編輯距離找發音相似發音相似詞替換PronounceSameWordMaker發音相同字替換PronounceSameVocabMaker發音相同詞替換RedundantWordMaker隨機複製旁邊一個字作為沆於字RandomInsertVacabMaker隨機插入詞彙MistakWordMaker隨機替換字MistakeWordHighFreqMaker隨機替換高頻字MissingWordHighFreqMaker隨機刪除高頻字
zh_nester
UNKNOWN
zhn-nester
No description available on PyPI.
zh-normalization
zh-normalizationChinese sentence NSW(Non-Standard-Word) NormalizationSupported NSW (Non-Standard-Word) NormalizationNSW typerawnormalizedserial number电影中梁朝伟扮演的陈永仁的编号27149电影中梁朝伟扮演的陈永仁的编号二七一四九cardinal这块黄金重达324.75克我们班的最高总分为583分这块黄金重达三百二十四点七五克我们班的最高总分为五百八十三分numeric range12~23-1.5~2十二到二十三负一点五到二date她出生于86年8月18日,她弟弟出生于1995年3月1日她出生于八六年八月十八日, 她弟弟出生于一九九五年三月一日time等会请在12:05请通知我等会请在十二点零五分请通知我temperature今天的最低气温达到-10°C今天的最低气温达到零下十度fraction现场有7/12的观众投出了赞成票现场有十二分之七的观众投出了赞成票percentage明天有62%的概率降雨明天有百分之六十二的概率降雨money随便来几个价格12块5,34.5元,20.1万随便来几个价格十二块五,三十四点五元,二十点一万telephone这是固话0421-33441122这是手机+86 18544139121这是固话零四二一三三四四一一二二这是手机八六一八五四四一三九一二一Usagepipinstallzh-normalizationRun the following code to normalize the Chinese sentence:fromzh_normalizationimportTextNormalizerm=TextNormalizer()text="电影中梁朝伟扮演的陈永仁的编号27149!"sents=m.normalize(text)new_text=''.join(sents)print(new_text)Output:电影中梁朝伟扮演的陈永仁的编号二七幺四九!ReferencesPull requests #658 of DeepSpeech
zh-num2int
No description available on PyPI.
zhon
Zhon is a Python library that provides constants commonly used in Chinese text processing.Documentation:https://tsroten.github.io/zhon/GitHub:https://github.com/tsroten/zhonSupport:https://github.com/tsroten/zhon/issuesFree software:MIT licenseAboutZhon’s constants can be used in Chinese text processing, for example:Find CJK characters in a string:>>>re.findall('[{}]'.format(zhon.hanzi.characters),'I broke a plate: 我打破了一个盘子.')['我','打','破','了','一','个','盘','子']Validate Pinyin syllables, words, or sentences:>>>re.findall(zhon.pinyin.syllable,'Yuànzi lǐ tíngzhe yí liàng chē.',re.I)['Yuàn','zi','lǐ','tíng','zhe','yí','liàng','chē']>>>re.findall(zhon.pinyin.word,'Yuànzi lǐ tíngzhe yí liàng chē.',re.I)['Yuànzi','lǐ','tíngzhe','yí','liàng','chē']>>>re.findall(zhon.pinyin.sentence,'Yuànzi lǐ tíngzhe yí liàng chē.',re.I)['Yuànzi lǐ tíngzhe yí liàng chē.']FeaturesZhon includes the following commonly-used constants:CJK characters and radicalsChinese punctuation marksChinese sentence regular expression patternPinyin vowels, consonants, lowercase, uppercase, and punctuationPinyin syllable, word, and sentence regular expression patternsZhuyin characters and marksZhuyin syllable regular expression patternCC-CEDICT charactersGetting StartedInstall ZhonLearn how to use ZhonContributedocumentation, code, or feedback
zhonghong-climate
Python library for interfacing with ZhongHong HVAC controller
zhong-hong-hvac
ZhongHongHVACPython driver for ZhongHong HVAC Controller
zhongkui-core
zhongkui-corezhongkui core analysis packageInstallationinstall exiftool#!/bin/sh # only test on ubuntu18.04 export EXIFTOOL=12.01 echo "Installing exiftool..." curl -Ls https://exiftool.org/Image-ExifTool-$EXIFTOOL.tar.gz > /tmp/exiftool.tar.gz cd /tmp tar xzf exiftool.tar.gz cd Image-ExifTool-$EXIFTOOL perl Makefile.PL make test make installinstall zhongkui-core$ git clone [email protected]:zhongkui/zhongkui-core.git $ cd zhongkui-core $ pip install -e .Getting Started>>>fromzhongkui.coreimportFile >>>sample=File("tests/sample/pe_upx")>>>print(sample.basicInfo())>>>{"name":"pe","md5":"ff2a00e3d07afcf32a7459040bc9cc41","sha1":"61e810f352866cc5f3184489c796fba4c21b99ec","sha256":"fb12aec2553bd2567a82f18ca2e0710e8d72b22b1d2bdcf3a296e987ad3c398a","fileType":"win32exe","fileSize":3901952,"isProbablyPacked":true}Running the tests$cdzhongkui-core $pytest-sChangelogrelease ChangelogAuthorskongkong Jiang-Initial work-jykerLicenseThis project is licensed under the MIT License - see theLICENSEfile for details
zhongtukexin-test
No description available on PyPI.
zhongwen
給懂中文的程式設計師中文數字模組運用中文文字處理程式庫的程式設計師自然懂中文, 所以本程式庫設計哲學就是函數以中文命名且能簡明表達功能, 另以簡體名稱表示處理簡體中文情形,繁體名稱表示處理繁體中文情形, 如以中文數字處理功能為例:from zhongwen.number import 中文數字, 中文数字, 大寫中文數字 中文數字(10600) >>> '一萬零六百' 中文数字(10600) >>> '一万零六百' 大寫中文數字(23232.00518) >>> '貳萬參仟貳佰參拾貳點零零伍壹捌'民國日期處理民國日期係目前仍在臺灣地區使用之日期格式, 本模組之【取日期】函數可將民國日期字串轉成日期時間(datetime)類型, 而【民國日期】可將日期時間依指定格式轉成字串,示例如次:from zhongwen.date import 取日期 取日期('111.9.23') >>> datetime(2022,9,23,0,0) 取日期('110/12/27') >>> datetime(2021,12,27,0,0) from zhongwen.date import 民國日期 民國日期(datetime(2021,12,27,0,0), '%Y年%M月%d日') >>> '110年12月27日'中文字元判斷中文字元判斷功能示例如次:是否為中文字元('繁') >>> True 是否為中文字元('简') >>> True 是否為中文字元('a') >>> False
zhora
No description available on PyPI.
zhot
ZhotI had some fun teaching myself Perl with my Rock-Paper-Scissors script over athttps://bitbucket.org/AmyDeeDempster/rock-paper-scissorsThis is a more extensible version in Python, done in a more mathematical and object-oriented manner.Usage### Establishing game rulesSupply a Comma-Separated Values file as a command-line argument for this script. For example:zhotmoves/moves-5.csvIf not supplied, a default set of three-move rules will be used.### Gameplay and user inputIn the game, type the name of the move you wish to play. This can be abbreviated.Other commands available include:rulesorhelpscoreroundsdiagramexitorquitYou can also just hit Return to quit the game.### Rule diagramThediagramcommand generates, from the rules of the current game a vector diagram illustrating those rules.Dependencies### Built-incsvrandomsysremath### Third-party (pyPI)numpysvgwritescourInterpreterPython > 3.6(Tested on macOS and Korora Linux installations of CPython 3.6.5 and 3.7.0b4)LicenceCreative CommonsSee text in LICENCE.htmlFurther information athttps://creativecommons.org/licences/by-sa/3.0/au/
zho-tts
zho-ttsCommand-line interface and Python library for synthesizing Chinese texts into speech.Installationpipinstallzho-tts--userExample synthesiszho-ttssynthesize"长江 航务 管理局 和 长江 轮船 总公司 最近 决定 安排 一百三十三 艘 客轮 迎接 长江 干线 春运。"The output can be listenedhere.# Same example using IPA inputzho-ttssynthesize-ipa"ʈʂː|a˧˩˧˘|ŋ|tɕ˘|j|a˥˘|ŋ˘|SIL0|x|a˧˥˘|ŋ|u˥˩|SIL0|k|w|a˧˩˧|n|l˘|i˧˩˧|tɕː|y˧˥ˑ|SIL0|x|ɤ˧˥|SIL0|ʈʂː|a˧˩˧˘|ŋ|tɕ˘|j|a˥˘|ŋ|SIL0|l|w|ə˧˥|n|ʈʂʰ˘|w|a˧˥|n|SIL0|ts˘|ʊ˧˩˧|ŋ˘|kː|ʊ˥|ŋ|s|ɹ̩˥ˑ|SIL0|ts|w˘|ei̯˥˩|tɕ|i˥˩˘|n|SIL0|tɕ|ɥ|e˧˥|t|i˥˩|ŋ|SIL3|a˥|n|pʰ|ai̯˧˥|SIL0|i˥ˑ|p|ai̯˧˩˧|s|a˥˘|n|ʂ˘|ɻ̩˧˥|s|a˥|n|SIL0|s˘|ou̯˥|SIL0|kʰˑ|ɤ˥˩|lː|wˑ|ə˧˥ˑ|n|SIL0|i˧˥ː|ŋ|tɕ˘|j˘|e˥|SIL0|ʈʂː|a˧˩˧|ŋ|tɕ˘|j|a˥˘|ŋ|SIL0|k˘|a˥˩|n|ɕ|j˘|ɛ˥˩|n˘|SIL0|ʈʂʰˑ|w˘|ə˥˘|nː|y˥˩ˑ|nː|。"The output can be listenedhere.Usage as libraryfrompathlibimportPathfromtempfileimportgettempdirfromzho_ttsimportSynthesizer,Transcriber,normalize_audio,save_audiotext="长江 航务 管理局 和 长江 轮船 总公司 最近 决定 安排 一百三十三 艘 客轮 迎接 长江 干线 春运。"transcriber=Transcriber()synthesizer=Synthesizer()text_ipa=transcriber.transcribe_to_ipa(text)audio=synthesizer.synthesize(text_ipa)tmp_dir=Path(gettempdir())save_audio(audio,tmp_dir/"output.wav")# Optional: normalize outputnormalize_audio(tmp_dir/"output.wav",tmp_dir/"output_norm.wav")Model infoThe used TTS model is publishedhere.Phoneme setVowels: a ɛ e ə ɚ ɤ i o u ʊ yDiphthongs: ai̯ au̯ ei̯ ou̯Consonants: f j k kʰ l m n p pʰ ɹ̩¹ ɻ¹ ɻ̩¹ s t ts tsʰ tɕ tɕʰ tʰ w x ŋ ɕ ɥ ʂ ʈʂ ʈʂʰBreaks:SIL0 (no break)SIL1 (short break)SIL2 (break)SIL3 (long break)special characters: 。 ?Vowels and diphthongs contain one of these tones:˥ (first tone)˧˥ (second tone)˧˩˧ (third tone)˥˩ (fourth tone)(none)¹ These consonants contain also tones.Vowels, diphthongs and consonants contain one of these duration markers:˘ -> very short, e.g., ou̯˘nothing -> normal, e.g., ou̯ˑ -> half long, e.g., ou̯ˑː -> long, e.g., ou̯ːTones and duration markers can be combined, e.g., ə˧˥ːSpeakersCitationIf you want to cite this repo, you can use the BibTeX-entry generated by GitHub (seeAbout => Cite this repository).Taubert, S. (2024). zho-tts (Version 0.0.1) [Computer software]. https://doi.org/10.5281/zenodo.10512789AcknowledgmentsFunded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) – Project-ID 416228727 – CRC 1410The authors gratefully acknowledge the GWK support for funding this project by providing computing time through the Center for Information Services and HPC (ZIH) at TU Dresden.The authors are grateful to the Center for Information Services and High Performance Computing [Zentrum fur Informationsdienste und Hochleistungsrechnen (ZIH)] at TU Dresden for providing its facilities for high throughput calculations.
zhou
No description available on PyPI.
zhouch22
No description available on PyPI.
zhouguochang
周国昌学习第一次打包上传
zhoumingSuperMath
No description available on PyPI.
zhou_nester
UNKNOWN
zhousf-lib
ZhousfLibpython常用工具库:coco数据集、labelme数据集、segmentation数据集、classification数据集制作和转换脚本;文件操作、表格操作、数据结构、web服务封装等工具集数据集制作datasets/classification:数据集制作datasets/coco:数据集制作、格式转换、可视化、统计、数据更新/合并/提取datasets/labelme:数据集制作、格式转换、可视化、统计、数据更新/合并/提取datasets/segmentation:数据集制作ANN转换ann/onnx/onnx_to_trt:onnx转tensorRTann/torch/torch_to_onnx:torch转onnx/加载onnxann/torch/torch_to_script:torch转script/加载scriptann/transformers:加载tokenizerann/tensorrt/tensorrt_infer:tensorRT推理MLml/feature_vector:特征向量表示器ml/model_cluster:kmeans聚类ml/model_lr:线性回归ml/model_gbdt:GBDT模型推理框架infer_framework/fast_infer/fast_infer:快速推理器infer_framework/triton/client_http:triton数据库db/lmdb:内存映射数据库装饰器decorator:异常捕获,AOP文件操作download:文件批量异步下载delete_file:文件删除字体font:宋体、特殊符号字体并发压测工具locust:demo表格文件工具pandas:excel/csv操作、大文件读取pdf文件工具pdf:pdf导出图片、pdf文本和表格提取so加密工具so:python工程加密成so,防逆向web相关web:flask日志工具、响应体、配置通用工具包util[util/cv_util]:opencv读写中文路径图片,图像相关处理[util/char_util]:字符相关处理,全角、半角[util/encrypt_util]:AES加密[util/iou_util]:IoU计算[util/json_util]:json读写[util/poly_util]:按照宽高对图片进行网格划分/切图[util/re_util]:re提取数字、字母、中文[util/singleton]:单例[util/string_util]:非空、包含、补齐[util/time_util]:日期、毫秒级时间戳、微秒级时间戳、日期比较
zhou-stattool
zhou_stattoolzhou_stattool is a tool for zhouzhou to do hospital statistics
zhou-talk
Failed to fetch description. HTTP Status Code: 404
zhouyao
No description available on PyPI.
zhouyuanzhen
# py-zhouyuanzhen[<img src=”https://avatars2.githubusercontent.com/u/54104471” align=”right” width=”200”>](https://github.com/zhouyuanzhen)PyPI for zhouyuanzhen## QuickStart### Install Packagepip install zhouyuanzhen### Play with itimport zyzzyz.sayhi()Enjoy it!
zhouyuqin
No description available on PyPI.
zhouyuqin-python-sdk-core
No description available on PyPI.
zhouyuqin-python-sdk-demo
No description available on PyPI.
zhouzhiqiang-guestbook
UNKNOWN
zhouzhiyong-test
No description available on PyPI.
zhpr
中文標點符號標注訓練資料集:p208p2002/ZH-Wiki-Punctuation-Restore-Dataset共計支援6種標點符號: , 、 。 ? ! ;安裝# pip install torch pytorch-lightningpipinstallzhpr使用fromzhpr.predictimportDocumentDataset,merge_stride,decode_predfromtransformersimportAutoModelForTokenClassification,AutoTokenizerfromtorch.utils.dataimportDataLoaderdefpredict_step(batch,model,tokenizer):batch_out=[]batch_input_ids=batchencodings={'input_ids':batch_input_ids}output=model(**encodings)predicted_token_class_id_batch=output['logits'].argmax(-1)forpredicted_token_class_ids,input_idsinzip(predicted_token_class_id_batch,batch_input_ids):out=[]tokens=tokenizer.convert_ids_to_tokens(input_ids)# compute the pad start in input_ids# and also truncate the predict# print(tokenizer.decode(batch_input_ids))input_ids=input_ids.tolist()try:input_id_pad_start=input_ids.index(tokenizer.pad_token_id)except:input_id_pad_start=len(input_ids)input_ids=input_ids[:input_id_pad_start]tokens=tokens[:input_id_pad_start]# predicted_token_class_idspredicted_tokens_classes=[model.config.id2label[t.item()]fortinpredicted_token_class_ids]predicted_tokens_classes=predicted_tokens_classes[:input_id_pad_start]fortoken,nerinzip(tokens,predicted_tokens_classes):out.append((token,ner))batch_out.append(out)returnbatch_outif__name__=="__main__":window_size=256step=200text="維基百科是維基媒體基金會運營的一個多語言的百科全書目前是全球網路上最大且最受大眾歡迎的參考工具書名列全球二十大最受歡迎的網站特點是自由內容自由編輯與自由著作權"dataset=DocumentDataset(text,window_size=window_size,step=step)dataloader=DataLoader(dataset=dataset,shuffle=False,batch_size=5)model_name='p208p2002/zh-wiki-punctuation-restore'model=AutoModelForTokenClassification.from_pretrained(model_name)tokenizer=AutoTokenizer.from_pretrained(model_name)model_pred_out=[]forbatchindataloader:batch_out=predict_step(batch,model,tokenizer)foroutinbatch_out:model_pred_out.append(out)merge_pred_result=merge_stride(model_pred_out,step)merge_pred_result_deocde=decode_pred(merge_pred_result)merge_pred_result_deocde=''.join(merge_pred_result_deocde)print(merge_pred_result_deocde)維基百科是維基媒體基金會運營的一個多語言的百科全書,目前是全球網路上最大且最受大眾歡迎的參考工具書,名列全球二十大最受歡迎的網站,特點是自由內容、自由編輯與自由著作權。
zhpy
ContentsIntroductionPlay locallyInstallUsageProgramming GuideWhat is ZhpyChange LogIntroduction“If it walks like a duck and quacks like a duck, I would call it a duck.”Zhpy on python is good for Taiwan and China beginners to learn python in our native language (Currently it support Traditional and Simplified chinese).Zhpy acts like python and play like python, you (chinese users) could use it as python to educate yourself the program skills plus with your native language.Check examples here.https://github.com/gasolin/zhpy/tree/master/zhpy2/examples(Please install python 2.x to use this project)Play locallyTo play zhpy locally, you even don’t need to install it.All you need to do is follow the 3 steps guide:Download the source pack (the zip file)Extract the pack with zip tool. Enter the folderRun:$ python interpreter.pyThen you got the usable zhpy interpreter!InstallIf you’d like to play zhpy with full features, you should install zhpy.You could use easy_install command to install or upgrade zhpy:$ easy_install -U zhpyor check instructions for detail.https://github.com/gasolin/zhpy/blob/wiki/DownloadInstall.mdUsageYou could use zhpy interpreter to test zhpy:$ zhpy zhpy [version] in [platform] on top of Python [py_version] >>> print 'hello in chinese' hello in chineseBrowse project homepage to get examples in chinese.https://github.com/gasolin/zhpycheck the BasicUsage for detail.https://github.com/gasolin/zhpy/blob/wiki/BasicUsage.mdProgramming GuideYou could freely view the C.C. licensed book “A Byte of python (Zhpy)” on zhpy website, which contained zhpy example codes as well.https://github.com/gasolin/zhpy/blob/wiki/ByteOfZhpy.mdThere’s the API document available in zhpy download list, too.http://code.google.com/p/zhpy/downloads/listPS: The book is based on “A Byte of Python”.http://swaroopch.info/text/Byte_of_Python:Main_PageWhat is ZhpyZhpy is the full feature python language with fully tested chinese keywords, variables, and parameters support. Zhpy is INDEPENDENT on python version(2.4, 2.5….), bundle with command line tool, interpreter, bi-directional zhpy <-> python code translation, chinese shell script capability, in-place ini reference feature for keyword reuse, and great document (the book Byte of Python with chinese examples).The core of zhpy is a lightweight python module and a chinese source convertor based on python, which provides interpreter and command line tool to translate zhpy code to python.Seehttp://www.flickr.com/photos/gasolin/2064120327You could invoke interpreter with ‘zhpy’ command instead of “python” in command line to execute source code wrote in either Chinese or English. The zhpy interpreter also support autocomplete function to save your typing.Zhpy provide a method ‘zh_exec’ that allow you to embed chinese script in python; Zhpy could be used as the chinese shell script as well.The zhpy code written in traditional and simplified chinese could be translated and converted to natual python code. Thus it could be execute as nature python code and be used in normal python programs.Bidirectional python-zhpy translation is possible. Normal python programs could be translated to traditional(.twpy) or simplified(.cnpy) chinese zhpy source via ‘zhpy’ command line tool.The framework is not hard to extend to another languages such as japenese or korean.Change LogYou could view the ChangeLog to see what’s new in these version.https://github.com/gasolin/zhpy/blob/master/CHANGELOG.txt
zhpy3
ContentsIntroductionInstallWhat is Zhpy3Change LogIntroduction“If it walks like a duck and quacks like a duck, I would call it a duck.”Zhpy3 on python 3 is good for non-native-english beginners to learn python 3 in our native language (Currently support Traditional and Simplified chinese).Zhpy3 acts like python 3 and play like python 3, user could use it as python 3 to educate yourself the program skills plus with your native language.Check examples here.http://code.google.com/p/zhpy/source/browse/#hg%2Fzhpy3%2FexamplesInstallIf you’d like to play zhpy3 with full features, you should install zhpy3.You could use easy_install command to install or upgrade zhpy3:$ easy_install -U zhpy3to use easy_install command, you should install distribute module for python 3 first:http://pypi.python.org/pypi/distribute/And check your system path params if it contains python3.x/bin path.ex: edit .bashrc to include “/Library/Frameworks/Python.framework/Versions/3.x/bin” in your PATH parameter.What is Zhpy3Zhpy3 is the successor of zhpy, to provide the python 3 language translator with fully tested chinese keywords, variables, and parameters support. Zhpy is INDEPENDENT on python 3 versions(3.x….).The core of zhpy3 is a lightweight python module and a language source convertor based on python3, which provides command line tool to translate zhpy3 code to python 3.Seehttp://www.flickr.com/photos/gasolin/2064120327You could invoke interpreter with ‘twpy’, ‘cnpy’ command instead of “python3” in command line to execute source code wrote in either Traditional/Simplified Chinese or English.The framework is not hard to extend to another languages such as japenese or korean.Change LogYou could view the ChangeLog to see what’s new in these version.http://code.google.com/p/zhpy/source/browse/CHANGELOG.txt
zhr7.6
READMEthis is the test of pypi
zh-rasa
Chinese NLP tool for RASA
zh_recover
A sample project that exists as an aid to thePython Packaging User Guide’sTutorial on Packaging and Distributing Projects.This projects does not aim to cover best practices for Python project development as a whole. For example, it does not provide guidance or tool recommendations for version control, documentation, or testing.This is the README file for the project.The file should use UTF-8 encoding and be written using ReStructured Text. It will be used to generate the project webpage on PyPI and will be displayed as the project homepage on common code-hosting services, and should be written for that purpose.Typical contents for this file would include an overview of the project, basic usage examples, etc. Generally, including the project changelog in here is not a good idea, although a simple “What’s New” section for the most recent version may be appropriate.
zhruby
Zaonhe Ruby (zhruby) 上海話吳語協會式注音Zaonhegho Wunyu–Yahwe-Seh TsyinConverts Traditional Chinese passage to TeX-flavoured ruby and outputs PDF. Requiresxelatexandctex.輸入中文文本文檔,輸出上海話注音的 LaTeX 文檔及 PDF。需要xelatex和ctex。Installationpython3-mpipinstallzhruby==2.0.3Usagepython3-mzhruby[listoftextfiles]Append-sto output simplified documents.
zhr-zzj
No description available on PyPI.
zh_segment
zh_segmentis an Apache2 licensed module for English word segmentation, written in pure-Python, and based on a trillion-word corpus.Based on code from the chapter “Natural Language Corpus Data” by Peter Norvig from the book “Beautiful Data” (Segaran and Hammerbacher, 2009).Data files are derived from theGoogle Web Trillion Word Corpus, as described by Thorsten Brants and Alex Franz, anddistributedby the Linguistic Data Consortium. This module contains only a subset of that data. The unigram data includes only the most common 333,000 words. Similarly, bigram data includes only the most common 250,000 phrases. Every word and phrase is lowercased with punctuation removed.FeaturesPure-PythonFully documented100% Test CoverageIncludes unigram and bigram dataCommand line interface for batch processingEasy to hack (e.g. different scoring, new data, different language)Developed on Python 2.7Tested on CPython 2.6, 2.7, 3.2, 3.3, 3.4 and PyPy 2.5+, PyPy3 2.4+QuickstartInstalling zh_segment is simple withpip:$ pip install zh_segmentYou can access documentation in the interpreter with Python’s built-in help function:>>> import zh_segment >>> help(zh_segment)TutorialIn your own Python programs, you’ll mostly want to usesegmentto divide a phrase into a list of its parts:>>> from zh_segment import segment >>> segment('1077501; 1296599; 5000; 5000; 4975; 36 months; 10.64%; 162.87; B; B2;;10+ years;RENT') ['1077501', '1296599', '5000', '5000', '4975', '36', 'months', '10.64%', '162.87', 'B', 'B', '2', '10+', 'years', 'RENT']zh_segment also provides a command-line interface for batch processing. This interface accepts two arguments: in-file and out-file. Lines from in-file are iteratively segmented, joined by a space, and written to out-file. Input and output default to stdin and stdout respectively.$ echo thisisatest | python -m zh_segment this is a testThe maximum segmented word length is 24 characters. Neither the unigram nor bigram data contain words exceeding that length. The corpus also excludes punctuation and all letters have been lowercased. Before segmenting text,cleanis called to transform the input to a canonical form:>>> from zh_segment import clean >>> clean('She said, "Python rocks!"') 'shesaidpythonrocks' >>> segment('She said, "Python rocks!"') ['she', 'said', 'python', 'rocks']Sometimes its interesting to explore the unigram and bigram counts themselves. These are stored in Python dictionaries mapping word to count.>>> import zh_segment as ws >>> ws.load() >>> ws.UNIGRAMS['the'] 23135851162.0 >>> ws.UNIGRAMS['gray'] 21424658.0 >>> ws.UNIGRAMS['grey'] 18276942.0Above we see that the spellinggrayis more common than the spellinggrey.Bigrams are joined by a space:>>> import heapq >>> from pprint import pprint >>> from operator import itemgetter >>> pprint(heapq.nlargest(10, ws.BIGRAMS.items(), itemgetter(1))) [('of the', 2766332391.0), ('in the', 1628795324.0), ('to the', 1139248999.0), ('on the', 800328815.0), ('for the', 692874802.0), ('and the', 629726893.0), ('to be', 505148997.0), ('is a', 476718990.0), ('with the', 461331348.0), ('from the', 428303219.0)]Some bigrams begin with<s>. This is to indicate the start of a bigram:>>> ws.BIGRAMS['<s> where'] 15419048.0 >>> ws.BIGRAMS['<s> what'] 11779290.0The unigrams and bigrams data is stored in thezh_segment_datadirectory in theunigrams.txtandbigrams.txtfiles respectively.Reference and Indiceszh_segment Documentationzh_segment at PyPIzh_segment at Githubzh_segment Issue Trackerzh_segment LicenseCopyright 2017 Z&HLicensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
zh-sentence
A light-weight sentence tokenizer for Chinese languages.Sample Code:from zh_sentence.tokenizer import tokenizeparagraph_str = "你好吗?你快乐吗?"sentence_list = tokenize(paragraph_str)for sentence in sentence_list: print(sentence)
zhsq_toolbox
# Toolbox (backend project)def and class for multiply projects
zhtelecode
zhtelecodezhtelecodeis a Python package that converts betweenChinese Telegraph Codesand Unicode Chinese characters (both simplified and traditional).UsageConvert from Unicode to telegraph codes:>>>zhtelecode.to_telecode("中文信息")['0022','2429','0207','1873']>>>zhtelecode.to_telecode("萧爱国")['5618','1947','0948']>>>zhtelecode.to_telecode("蕭愛國")['5618','1947','0948']Convert from telegraph codes back to Unicode:>>>telecode=["0022","2429","0207","1873"]>>>zhtelecode.to_unicode(telecode)'中文信息'>>>telecode=["5618","1947","0948"]>>>zhtelecode.to_unicode(telecode,encoding="mainland")'萧爱国'>>>zhtelecode.to_unicode(telecode,encoding="taiwan")'蕭愛國'DataThe codebooks are derived from the Unicode consortium'sUnihan database(last updated 2022-08-03 17:20).LicenseMIT License.Also seeUnicode terms of use.
zhtest
zhtest is a tools for get the url’s host or subdomian.1.0e.g. zhong wen ce shi.
zhtml
ZHTML (LGPLv3)Because the world needs another HTML framework.ZHTML is short for ZacHTML, which is short for Zach HTML.ZHTML is intended for the server-side rendering of static web pages.Installpython-mpipinstallzhtmlTutorialCreate a blank HTML page to begin.<!DOCTYPE html><htmllang="en-US"><head><metacharset="utf-8"><title>zhtml Example</title><!-- Water.css, to spruce things up --><linkrel="stylesheet"href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css"></head><body></body></html>ZHTML is intended for server-side rendering, so page elements are generated dynamically. As such, instead of putting our HTML directly into our file, we will instead insert a comment as a placeholder. This instructs the ZHTML engine where to insert the desired page elements.</head><body><!-- APP --></body></html>Next, let's begin our script.# example.pyimportzhtmlashtmlif__name__=='__main__':withopen('examples/example.html','r')asexample_file:example=html.Page(example_file.read(),'index')html.Pageallows us to load our template file as an object.Before going any further, we need to bind ourAPPplaceholder, using thehtml.Placeholderclass.# example.pyimportzhtmlashtmlif__name__=='__main__':binding=html.Placeholder('APP')withopen('examples/example.html','r')asexample_file:example=html.Page(example_file.read(),'index')By passing'APP'to ourPlaceholderobject, we are telling it to look for the<!-- APP -->placeholder in our HTML file. The resulting object is anre.Pattern.Next, let's create some HTML to inject into ourexample.htmlpage.ZHTML uses string functions to assemble HTML snippets. To start, let's create a heading and a paragraph.# example.pyimportzhtmlashtmlif__name__=='__main__':binding=html.Placeholder.create('APP')withopen('examples/example.html','r')asexample_file:example=html.Page(example_file.read(),'index')heading=html.heading('Hello, World!')paragraph=html.paragraph('This is a body of text.')Once created, lets wrap our new elements in amaintag. This will be the root of our application. Because ZHTML assembles elements as strings, unioning our heading and paragraph is as easy as concatenating two strings.# example.pyimportzhtmlashtmlif__name__=='__main__':binding=html.Placeholder.create('APP')withopen('examples/example.html','r')asexample_file:example=html.Page(example_file.read(),'index')heading=html.heading('Hello, World!')paragraph=html.paragraph('This is a body of text.')main=html.main(heading+paragraph)Finally, we can inject our application using theinject_textmethod on ourPageobject. Be sure to provide thePlaceholderthat we created earlier. To output the results, use thewritemethod.# example.pyimportzhtmlashtmlif__name__=='__main__':binding=html.Placeholder.create('APP')withopen('examples/example.html','r')asexample_file:example=html.Page(example_file.read(),'index')heading=html.heading('Hello, World!')paragraph=html.paragraph('This is a body of text.')main=html.main(heading+paragraph)example=example.inject_text(main,binding)example.write('output')You should now have a file namedindex.htmlin theoutputfolder of your project.<!DOCTYPE html><htmllang="en-US"><head><metacharset="utf-8"><title>zhtml Example</title><!-- Water.css, to spruce things up --><linkrel="stylesheet"href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css"></head><body><main><h1>Hello, World!</h1><p>This is a body of text.</p></main></body></html>ContributingZHTML is a young project, with a lot of work to do. If you want to helpcontact z3c0, or fork the project and submit your change as a merge request.
zhtools
ZhtoolsSome simple tool methods like cache, timetools and so on.Modulescache: A simple cache decorator.data_structs: Some data structs implements and tools.security: some simple security methods.api_service: Simple way to define an api client.async_tools: about python async/await.calculation: Math calculation methods.cli: Command-line tools.concurrents: Some tools for concurrent base on multi process/thread/coroutine.config: Global config by this tool.context_manager: Common context manager.decorators: Common decorators.exceptions: Common exceptions by this tool.random: Random methods.signals: simple signal dispatcher.timetools: Some date/time/timezone tools.typing: Common type hints.Update logs1.0.02023-06-17:Refactored code to used more type hint. Now only support python 3.11+.Because of the ChatGPT, remove thecode_generatormodule.Removedata_structs.lazymodule, recommend to uselazy-object-proxyinstead.Removeexportersmodule.Removeio_toolsmodule.Removeredis_helpermodule.Removelogmodule.Moveenumtodata_structs.enum.Movethird_parties.pydantictodata_structs.pydantic.Movetype_hinttotyping.Changerequestsandaiohttprequirement tohttpx.0.3.02022-07-21:Refactored cache.Add signal dispatcher.0.2.32022-04-08:Fix & add cli command.Add log module.0.2.22022-01-08:Add AES encrypt/decrypt method.0.2.12021-12-30:Moveconvertorstodata_structs.convertorsadd some data_structs and methods.0.1.12021-12-8:Optimize timetools. Now can set global timezone.0.0.112021-10-21:Add js-likePromise.0.0.102021-06-25:Add go-like defer.0.0.92021-06-04:Fix setup bug.0.0.82021-06-04:Add concurrents tools.Add orm code generators command-line client.0.0.72021-05-21:Add singleton decorator.Add orm code generators.0.0.62021-04-25:Add enum module.0.0.52021-04-19:Added api service.Optimized the performance of XlsxReader.Added progress bar to XlsxExporter (supported bytqdm).
zhttp
No description available on PyPI.
zhtts
ZhTTS中文A demo of zh/Chinese Text to Speech system run on CPU in real time. (fastspeech2 + mbmelgan)RTF(real time factor): 0.2 with cpu: Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz 24khz audio use fastspeech2, RTF1.6 for tacotron2This repo ismainly based onTensorFlowTTSwith little improvement.tflite model come fromcolab, thx to@azraelkuanadd pause at punctuationadd TN (Text Normalization) fromchinese_text_normalizationdemo wavtext = "2020年,这是一个开源的端到端中文语音合成系统"fastspeech2 - demo.wavfastspeech2 - newstacotron2 - newsInstallpip install zhttsor clone this repo, thenpip install .Usageimportzhttstext="2020年,这是一个开源的端到端中文语音合成系统"tts=zhtts.TTS()# use fastspeech2 by defaulttts.text2wav(text,"demo.wav")>>>Savewavtodemo.wavtts.frontend(text)>>>('二零二零年,这是一个开源的端到端中文语音合成系统','sil ^ er4 #0 l ing2 #0 ^ er4 #0 l ing2 #0 n ian2 #0 #3 zh e4 #0 sh iii4 #0 ^ i2 #0 g e4 #0 k ai1 #0 ^ van2 #0 d e5 #0 d uan1 #0 d ao4 #0 d uan1 #0 zh ong1 #0 ^ uen2 #0 ^ v3 #0 ^ in1 #0 h e2 #0 ch eng2 #0 x i4 #0 t ong3 sil')tts.synthesis(text)>>>array([0.,0.,0.,...,0.,0.,0.],dtype=float32)web api democlone this repo,pip install flaskfirst, thenpython app.pyvisithttp://localhost:5000for tts interactiondo HTTP GET athttp://localhost:5000/api/tts?text=your%20sentenceto get WAV audio back:$curl-o"helloworld.wav""http://localhost:5000/api/tts?text=%E4%BD%A0%E5%A5%BD%E4%B8%96%E7%95%8C"%E4%BD%A0%E5%A5%BD%E4%B8%96%E7%95%8Cis url code of"你好,世界!"Use tacotron2 instead of fastspeech2wav generate from tacotron model is better than fast speech, however tacotron is much slower , to use Tacotron, change codeimportzhttstts=zhtts.TTS(text2mel_name="TACOTRON")# tts = zhtts.TTS(text2mel_name="FASTSPEECH2")
zhTW2Num
zhTW2NumSummaryThis tool is for converting the number texts of Traditional Chinese into floatFloat value is supportedHow to use ittext = '金額總共兩千零二十元' res = zhTW2Num(text) print(res) # 2020.0 text = '長度二點零五公分 res = zhTW2Num(text) print(res) # 2.05
zhtw_print
UNKNOWN
zhu
No description available on PyPI.
zhu2018
zhu2018main:prod:Data and formalisms from Zhu 2018Historycreation (2021-09-28)First release on PyPI.
zhu2020
zhu2020main:prod:Data and formalisms from Zhu 2020Historycreation (2022-09-26)First release on PyPI.
zhu-3w
No description available on PyPI.
zhuan
READMEWhats up
zhuchen-1
** 制作第一个Python包** – 这是我的第一个python包 – 实现自动生成用例 – 实现笛卡尔算法
zhudb
No description available on PyPI.
zhue
This library eases the interaction with Philips Hue devicesfrom zhue import Bridge # upnp/nupnp discovery b = Bridge.discover() # register a new user on the Hue bridge b.create_user() # or use a predefined username b.username = 'MY_USERNAME' # query lights b.lights # turn light on and off b.light('outdoor').on() b.light('outdoor').off() # query groups b.groups # turn all lights belonging to a group on b.group('living').on() # query sensors b.sensors # get temperature readings [x.temperature for x in b.temperature_sensors] # get light level readings [x.light_level for x in b.light_level_sensors] # get battery levels [x.config.battery for x in b.sensors if hasattr(x.config, 'battery')]
zhufo_tools
No description available on PyPI.
zhuge
No description available on PyPI.