Skip to main content

No project description provided

Project description

Yiwise时间信息抽取模块(对话场景):Yiwise Time Extractor for Dialogue

本模块基于cocoNLPtime_nlp模块进行开发。

目前release的版本适用于对话场景下的时间挖掘;在该场景下,优先返回未来的时间

Update Info

2019/07/24, ver:1.0.1: 修复了“五分钟前/一天前”等在识别上时间自动增加一天的bug;更改了倾向于返回未来的时间的策略,现在,仅有“XXX天后”、“XXX天前”会返回正确的时间;

Todo:

Bad Case: 27天这种混淆的问法无法返回正确的时间,只能返回当前时间的下一天。

Installation

pip install yiwise-time-dialogue

Quack Start

注:以下demo的测试时间为2019-07-22 16:40:00

>>> from yiwise_time_dialogue import TimeExtractor

>>> te = TimeExtractor()

TimeDelta类型

支持如:半年后、一周前、三天半后、十分钟后等表述

>>> te.parse('半小时后联系我')

'{"type": "timestamp", "timestamp": "2019-07-22 17:10:00", "timetoken": "半小时后"}'

TimeStamp类型

支持如:明天七点、下下下周三早上十点一刻、大大大后天这时候、现在等表述

>>> te.parse('大大大后天这时候')

'{"type": "timestamp", "timestamp": "2019-07-27 16:40:00", "timetoken": "大大大后天这时候"}'

TimeSpan类型

支持如:明天八点到十点、十点到四点等表述

>>> te.parse('十点到四点')

'{"type": "timespan", "timespan": ["2019-07-22 22:00:00", "2019-07-23 04:00:00"], "timetoken": ["10点", "4点"]}'

注:由于此版本为对话场景,所以优先返回未来的时间。 由于当前时刻已经为下午四点,默认返回今天晚上十点到明天早上四点。

Project details


Release history Release notifications

This version

1.0.2

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for yiwise-time-dialogue, version 1.0.2
Filename, size & hash File type Python version Upload date
yiwise_time_dialogue-1.0.2-py3-none-any.whl (93.9 kB) View hashes Wheel py3
yiwise_time_dialogue-1.0.2.tar.gz (119.1 kB) View hashes Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page