npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

zh-time-nlp

v1.0.2

Published

![npm](https://img.shields.io/npm/v/zh-time-nlp) ![ci](https://github.com/tudou527/zh-time-nlp/actions/workflows/ci.yml/badge.svg) [![codecov](https://codecov.io/gh/tudou527/zh-time-nlp/branch/master/graph/badge.svg)](https://codecov.io/gh/tudou527/zh-tim

Downloads

4

Readme

zh-time-nlp

npm ci codecov

中文自然语言时间识别。在 CaoMeiYouRen/ChiTimeNLP 的基础上参考 zhanzecheng/Time_NLP 的实现修改了 numberTranslator 相关方法来修复某些情况下时间识别的问题,增加了时间区间的识别并补充了单元测试。

安装

npm i -S zh-time-nlp

使用示例

import nlp from 'zh-time-nlp';

[
  '五点一分',
  '十点十分',
  '八点十七分',
  '早上八点五十九分',
  '晚上八点五十九分',
  '九点二十分',
  '十一点五十九分五十九秒',
  '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)));

输出 ||| | ---- | ---- | | 五点一分 | 2023-06-07 17:01:00 | | 十点十分 | 2023-06-07 22:10:00 | | 八点十七分 | 2023-06-07 20:17:00 | | 早上八点五十九分 | 2023-06-07 20:59:00 | | 晚上八点五十九分 | 2023-06-07 20:59:00 | | 九点二十分 | 2023-06-07 21:20:00 | | 十一点五十九分五十九秒 | 2023-06-07 23:59:59 | | 2019-5-3 19:00 | 2019-05-03 19:00:00 | | 2019-05-3 19:00 | 2023-09-05 19:00:00 | | 2019-5-03 19:00 | 2019-05-03 19:00:00 | | 2019-05-03 19:00 | 2023-09-05 19:00:00 | | 没有时间点 | null | | Hi,all。下周一下午三点开会 | 2023-06-12 15:00:00 | | 周一开会 | 2023-06-12 08:00:00 | | 周五开会 | 2023-06-09 08:00:00 | | 下下周一开会 | 2023-06-19 08:00:00 | | 6:30 起床 | 2023-06-07 18:30:00 | | 明天6:30 起床 | 2023-06-08 06:30:00 | | 6-3 春游 | 2023-06-03 08:00:00 | | 6月3日 春游 | 2023-06-03 08:00:00 | | 12-1 春游 | 2023-12-01 08:00:00 | | 明天早上跑步 | 2023-06-08 08:00:00 | | 本周日到下周日出差 | { startTime: '2023-06-11 08:00:00', endTime: '2023-06-18 08:00:00' } | | 周四下午三点到五点开会 | { startTime: '2023-06-08 15:00:00', endTime: '2023-06-08 17:00:00' } | | 昨天上午,第八轮中美战略与经济对话气候变化问题特别联合会议召开 | 2023-06-06 10:00:00 |