Skip to main content

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、下礼拜

Metadata

Release files for time-convert 1.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for time-convert 1.2.5
File Interpreter ABI Platform
time_convert-1.2.5-py3-none-any.whl Python 3 none any Details

Release files / time_convert-1.2.5-py3-none-any.whl

Download URL time_convert-1.2.5-py3-none-any.whl
Size 43.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6a5e7be2413b4fbce23cbce2fa7fe7869d76bd0b8215c8625844cccbb7419128
BLAKE2b-256 checksum
How to use checksums
420c58cad3be225f286bb910365fed6ab81e50818001acf5395a6c287744de72
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for time-convert 1.2.5

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page