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.4-py3-none-any.whl
.
File metadata
- Download URL: time_convert-1.2.4-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 | 63b9c460cda25399e15b6e5bef0be3e75543213cb4d0e7162013a0d454bffe6c |
|
MD5 | c16f38f09ec92ec88166b229dae5e975 |
|
BLAKE2b-256 | 996144fc464a0101dcf2cf7b79e0e77264f52c5390d6f8cc9f9c086c60d8f31c |