Libraryless. Click here for Pure Java version (5591L/34K).
svoid test_parseEnglishDateRange() { Pair<S, Map<S, PairS>> p = test_parseEnglishDateRange_examples(); DateInterpretationConfig config = new(ukTimeZone(), parseYMDHMS(p.a), true); testFunctionValues(s -> { LongRange range = parseEnglishDateRange((S) s, config); ret range == null ? null : pair(formatDateWithSeconds(range.start, config.timeZone), formatDateWithSeconds(range.end, config.timeZone)); }, mapToParams(p.b)); } // returns (base date, examples) static Pair<S, Map<S, PairS>> test_parseEnglishDateRange_examples() { ret pair("2020/06/28 13:00:00", litorderedmap_withNulls( "", null, "anything else", null, "tuesday between 3 and 4 pm", pair("2020/06/30 15:00:00", "2020/06/30 16:00:00"), "2020/6/1 to 2020/6/3", pair("2020/06/01 00:00:00", "2020/06/04 00:00:00"), "june", pair("2020/06/01 00:00:00", "2020/07/01 00:00:00"), // assume Sunday-starting week "this week", pair("2020/06/28 00:00:00", "2020/07/05 00:00:00"), "next week", pair("2020/07/05 00:00:00", "2020/07/12 00:00:00"), )); }
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: | 234 / 409 |
Version history: | 17 change(s) |
Referenced in: | [show references] |