Skip to content

A Python Library That Converts Human Readable Text To Cron Expression

License

Notifications You must be signed in to change notification settings

iguangyu/text2cron

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Python Library that converts human readable text to Cron Expression

可以将人类语言转换为cron表达式的Python库

Installation

pip install t2c

usage

import t2c
# normal
cron_reg_zh = t2c.Text2Cron().cron('今天下午两点钟')
cron_reg_en = t2c.Text2Cron(language='en').cron('two minutes later')
# use openai api key
cron_gpt_zh = t2c.Text2Cron().gpt()
cron_gpt_en = t2c.Text2Cron(usegpt=True, api_key='openai_api_key', language='en').gpt('two minutes later')
# print the cron expressions
# current time: 2023/5/15 00:25
print(cron_reg_zh, cron_reg_en) # output: 0 14 15 5 ? , 27 0 15 5 ?
print(cron_gpt_zh, cron_gpt_en) # output: 0 1 1 */3 * , 0 1 1 */3 * 😭

About

A Python Library That Converts Human Readable Text To Cron Expression

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages