Usage
pip3 install chinatime
or
pip3 install chinatime -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
功能说明
用于句子中时间词的抽取和转换
详情请见test.py
res = tn.parse(target=u'过十分钟') # target为待分析语句,timeBase为基准时间默认是当前时间
print(res)
res = tn.parse(target=u'2013年二月二十八日下午四点三十分二十九秒', timeBase='2013-02-28 16:30:29') # target为待分析语句,timeBase为基准时间默认是当前时间
print(res)
res = tn.parse(target=u'我需要大概33天2分钟四秒', timeBase='2013-02-28 16:30:29') # target为待分析语句,timeBase为基准时间默认是当前时间
print(res)
res = tn.parse(target=u'今年儿童节晚上九点一刻') # target为待分析语句,timeBase为基准时间默认是当前时间
print(res)
res = tn.parse(target=u'2个小时以前') # target为待分析语句,timeBase为基准时间默认是当前时间
print(res)
res = tn.parse(target=u'晚上8点到上午10点之间') # target为待分析语句,timeBase为基准时间默认是当前时间
print(res)
返回结果:
{"timedelta": "0 days, 0:10:00", "type": "timedelta"}
{"timestamp": "2013-02-28 16:30:29", "type": "timestamp"}
{"type": "timedelta", "timedelta": {"year": 0, "month": 1, "day": 3, "hour": 0, "minute": 2, "second": 4}}
{"timestamp": "2018-06-01 21:15:00", "type": "timestamp"}
{"error": "no time pattern could be extracted."}
{"type": "timespan", "timespan": ["2018-03-16 20:00:00", "2018-03-16 10:00:00"]}
Metadata
Release files for chinatime 1.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chinatime-1.0.7.tar.gz | 16.6 kB | Without provenance | Details for chinatime-1.0.7.tar.gz |
Release files / chinatime-1.0.7.tar.gz
| Download URL | chinatime-1.0.7.tar.gz |
|---|---|
| Size | 16.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7bfd99b5b1434c98149f922506d1b5ac65150c83e0fa5d683ab2fd1c806421bb
|
|
BLAKE2b-256 checksum How to use checksums |
e1c5d437b5f7d6c908d70c3e11662a2fb0ee3c32475284df8ed8f909ddab0086
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/41.6.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.5
|
Security for chinatime 1.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.