Libraryless. Click here for Pure Java version (8479L/48K).
1 | svoid test_EnglishDateParser() { |
2 | new EnglishDateParser parser; |
3 | parser.assumeFuture = true; // maybe not needed |
4 | testFunctionValues(s -> parser.parse((S) s), mapToParams(test_EnglishDateParser_examples())); |
5 | } |
6 | |
7 | static Map<S, DateStructures.SomeDate> test_EnglishDateParser_examples() { |
8 | delegate Day to DateStructures. |
9 | delegate Month to DateStructures. |
10 | delegate Year to DateStructures. |
11 | delegate CurrentWeekPlus to DateStructures. |
12 | delegate Weekday to DateStructures. |
13 | delegate TodayPlus to DateStructures. |
14 | delegate Hour to DateStructures. |
15 | delegate Minute to DateStructures. |
16 | delegate Second to DateStructures. |
17 | delegate Between to DateStructures. |
18 | |
19 | ret litorderedmap( |
20 | "2020/5/13" := new Day(13, new Month(5, new Year(2020))), |
21 | "tuesday" := new Weekday(3, null), |
22 | "next tuesday" := new Weekday(3, new CurrentWeekPlus(1)), |
23 | "in 5 days" := new TodayPlus(5), |
24 | "10 days from now" := new TodayPlus(10), |
25 | "February" := new Month(2), |
26 | "February 2020" := new Month(2, new Year(2020)), |
27 | "March 4th" := new Day(4, new Month(3)), |
28 | "yesterday" := new TodayPlus(-1), |
29 | "today" := new TodayPlus(0), |
30 | "tomorrow" := new TodayPlus(1), |
31 | |
32 | "15:43" := new Minute(43, new Hour(3, true)), |
33 | "10:41" := new Minute(41, new Hour(10, null)), |
34 | "3 am" := new Hour(3, false), |
35 | "5 pm" := new Hour(5, true), |
36 | "16:41:23" := new Second(23, new Minute(41, new Hour(4, true))), |
37 | |
38 | "between 1 and 2 pm" := new Between(new Hour(1, true), new Hour(2, true)), |
39 | ); |
40 | } |
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, ekrmjmnbrukm, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1028543 |
Snippet name: | test_EnglishDateParser (OK) |
Eternal ID of this version: | #1028543/30 |
Text MD5: | 53519b5bea7034e10bbc60daf1263cdf |
Transpilation MD5: | 9bdbce763d16d814fc79d1b0fb25364c |
Author: | stefan |
Category: | javax / english nlp |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-01-15 00:32:34 |
Source code size: | 1540 bytes / 40 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 281 / 559 |
Version history: | 29 change(s) |
Referenced in: | [show references] |