#time #nlp #parse

bin+lib two_timer

parser for English time expressions

23 stable releases

2.2.4 Jan 29, 2023
2.2.3 Aug 15, 2021
2.2.2 Jul 3, 2021
2.2.1 Mar 28, 2021
0.1.0 Dec 29, 2018

#58 in Date and time

Download history 28/week @ 2022-11-27 37/week @ 2022-12-04 54/week @ 2022-12-11 91/week @ 2022-12-18 48/week @ 2022-12-25 73/week @ 2023-01-01 64/week @ 2023-01-08 42/week @ 2023-01-15 83/week @ 2023-01-22 108/week @ 2023-01-29 79/week @ 2023-02-05 59/week @ 2023-02-12 131/week @ 2023-02-19 57/week @ 2023-02-26 96/week @ 2023-03-05 46/week @ 2023-03-12

332 downloads per month
Used in 5 crates

MIT license

80KB
2K SLoC

Rust 1.5K SLoC // 0.1% comments Ruby 224 SLoC // 0.0% comments

two-timer

Rust library for parsing English time expressions into start and end timestamps

This takes English expressions and returns a time range which ideally matches the expression. You might use this for registering the temporal extent of an event, say, or finding lines in a log file.

Some expressions it can handle:

  • from now to eternity
  • today
  • tomorrow
  • last month
  • this year
  • 5/6/69
  • June 6, 2010
  • forever
  • 3:00 AM
  • 3AM
  • June '05
  • Monday through next Thursday
  • from mon at 15:00:05 to now
  • 1960-05-06
  • 5000BCE
  • next weekend
  • 2000
  • the nineteenth of March 1810
  • the 5th of November
  • the ides of March
  • the first
  • two seconds before 12:00 PM
  • 1 week after May first
  • 15 minutes around 12:13:43 PM
  • noon on May 6, 1969
  • midnight on May 6, 1969
  • Friday the 13th
  • 2 weeks ago
  • ten seconds from now
  • 5 minutes before and after midnight
  • 1969-05-06 12:03:05
  • since the start of the year
  • since yesterday

The complete API is available at https://docs.rs/two_timer/.

Dependencies

~3–4.5MB
~101K SLoC