Libraryless. Click here for Pure Java version (5591L/34K).
1 | svoid test_parseEnglishDateRange() { |
2 | Pair<S, Map<S, PairS>> p = test_parseEnglishDateRange_examples(); |
3 | DateInterpretationConfig config = new(ukTimeZone(), parseYMDHMS(p.a), true); |
4 | testFunctionValues(s -> { |
5 | LongRange range = parseEnglishDateRange((S) s, config); |
6 | ret range == null ? null : pair(formatDateWithSeconds(range.start, config.timeZone), formatDateWithSeconds(range.end, config.timeZone)); |
7 | }, |
8 | mapToParams(p.b)); |
9 | } |
10 | |
11 | // returns (base date, examples) |
12 | static Pair<S, Map<S, PairS>> test_parseEnglishDateRange_examples() { |
13 | ret pair("2020/06/28 13:00:00", litorderedmap_withNulls( |
14 | "", null, |
15 | "anything else", null, |
16 | |
17 | "tuesday between 3 and 4 pm", pair("2020/06/30 15:00:00", "2020/06/30 16:00:00"), |
18 | "2020/6/1 to 2020/6/3", pair("2020/06/01 00:00:00", "2020/06/04 00:00:00"), |
19 | "june", pair("2020/06/01 00:00:00", "2020/07/01 00:00:00"), |
20 | |
21 | // assume Sunday-starting week |
22 | "this week", pair("2020/06/28 00:00:00", "2020/07/05 00:00:00"), |
23 | "next week", pair("2020/07/05 00:00:00", "2020/07/12 00:00:00"), |
24 | )); |
25 | } |
Began life as a copy of #1028543
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1028601 |
Snippet name: | test_parseEnglishDateRange |
Eternal ID of this version: | #1028601/18 |
Text MD5: | 53b2f6400521437c485fbb4e63665384 |
Transpilation MD5: | 7414934f7d4a6227a464b0a8fe732110 |
Author: | stefan |
Category: | javax / english nlp |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-06-29 13:56:48 |
Source code size: | 1091 bytes / 25 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 237 / 415 |
Version history: | 17 change(s) |
Referenced in: | [show references] |