Time convert for Chinese text
Project description
Time Convert
Introduction
中文语义时间提取转换
Install
pip install time-convert
Usage
eg1:
from time_convert import TimeNormalizer
tc = TimeNormalizer()
msg =
明天去你家'
res = tc.parse(msg)
print``(res)
{'key': '明天', 'type': 'timestamp', 'date': '2019-09-26 00:00:00'}
eg2:
from time_convert import TimeNormalizer
tc = TimeNormalizer()
msg =
明天去你家'
timeBase=
2013-02-28 16:30:29`
res = tc.parse(msg, timeBase)
print``(res)
{'key': '明天', 'type': 'timestamp', 'date': '2013-03-01 00:00:00'}
返回值类型说明
Time_Convert总的会返回四种类型的情况:
- 1、timespan
- 2、timestamp
- 3、timedelta
- 4、error
Mark
- 1、时间解析的默认basetime时间为请求的当前时间。
- 2、也可以指定basetime,basetime的格式为:YYYY-MM-DD 00:00:00
To do list
- 1、timedelta的拼接
- 2、'一会儿'等口语化表述时间的提取
- 3、过两天,明天吧
- 4、下礼拜
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file time_convert-1.2.5-py3-none-any.whl
.
File metadata
- Download URL: time_convert-1.2.5-py3-none-any.whl
- Upload date:
- Size: 43.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a5e7be2413b4fbce23cbce2fa7fe7869d76bd0b8215c8625844cccbb7419128 |
|
MD5 | ce15553e23e5a397f7b1328cf8c142b6 |
|
BLAKE2b-256 | 420c58cad3be225f286bb910365fed6ab81e50818001acf5395a6c287744de72 |