tudou527 / zh-time-nlp Goto Github PK
View Code? Open in Web Editor NEW中文自然语言时间识别
中文自然语言时间识别
测试用例
[
'五点一分',
'十点十分',
'八点十七分',
'早上八点五十九分',
'晚上八点五十九分',
'九点二十分',
'两天后洗车',
'十天后洗车',
'十一点五十九分五十九秒',
'十点五十九分五十九秒',
'一点五十九分五十九秒',
'2019-5-3 19:00',
'2019-05-3 19:00',
'2019-5-03 19:00',
'2019-05-03 19:00',
'没有时间点',
'Hi,all。下周一下午三点开会',
'周一开会',
'周五开会',
'下下周一开会',
'6:30 起床',
'明天6:30 起床',
'6-3 春游',
'6月3日 春游',
'12-1 春游',
'明天早上跑步',
'本周日到下周日出差',
'周四下午三点到五点开会',
'昨天上午,第八轮中美战略与经济对话气候变化问题特别联合会议召开',
].forEach(str => console.log('"%s" => %s', str, nlp(str,{baseTime:"2019-10-31 19:00"})));
输出结果
"五点一分" => 2019-10-32 05:01:00
"十点十分" => 2019-10-31 22:10:00
"八点十七分" => 2019-10-31 20:17:00
"早上八点五十九分" => 2019-10-31 20:59:00
"晚上八点五十九分" => 2019-10-31 20:59:00
"九点二十分" => 2019-10-31 21:20:00
"两天后洗车" => 2019-11-02 08:00:00
"十天后洗车" => 2019-11-10 08:00:00
"十一点五十九分五十九秒" => 2019-10-31 23:59:59
"十点五十九分五十九秒" => 2019-10-31 22:59:59
"一点五十九分五十九秒" => 2019-10-32 01:59:59
"2019-5-3 19:00" => 2019-05-03 19:00:00
"2019-05-3 19:00" => 2019-09-05 19:00:00
"2019-5-03 19:00" => 2019-05-03 19:00:00
"2019-05-03 19:00" => 2019-09-05 19:00:00
"没有时间点" => null
"Hi,all。下周一下午三点开会" => 2019-11-04 15:00:00
"周一开会" => 2019-11-04 08:00:00
"周五开会" => 2019-11-01 08:00:00
"下下周一开会" => 2019-11-11 08:00:00
"6:30 起床" => 2019-10-32 06:30:00
"明天6:30 起床" => 2019-11-01 06:30:00
"6-3 春游" => 2019-06-03 08:00:00
"6月3日 春游" => 2019-06-03 08:00:00
"12-1 春游" => 2019-12-01 08:00:00
"明天早上跑步" => 2019-11-01 08:00:00
"本周日到下周日出差" => { startTime: '2019-11-03 08:00:00', endTime: '2019-11-10 08:00:00' }
"周四下午三点到五点开会" => { startTime: '2019-10-31 15:00:00', endTime: '2019-10-31 17:00:00' }
"昨天上午,第八轮中美战略与经济对话气候变化问题特别联合会议召开" => 2019-10-30 10:00:00
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.