1 | sclass EnglishDateParser > DateStructures { |
2 | new TransformersOnObjects too; |
3 | |
4 | record Unparsed(LS tok) {} |
5 | |
6 | class ParseYear extends VF1<Unparsed> { |
7 | public void get(Unparsed u) { |
8 | for (LS tok2 : tokenPrefixLists(1, u.tok)) { |
9 | ret WithProbability(1.0-0.9*l(tok2), ); |
10 | } |
11 | } |
12 | |
13 | SomeDate parse(S s) null { |
14 | LS tok = javaTok(s); |
15 | too.add(Unparsed(tok)); |
16 | |
17 | transformers.add(ParseYear); |
18 | |
19 | // let's try to parse a year just to get started |
20 | |
21 | pm.addState(new ScanFromToken(1)); |
22 | } |
23 | } |
Began life as a copy of #1028547
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: | #1028548 |
Snippet name: | EnglishDateParser, attempt 3 using TransformersOnObjects [dev.] |
Eternal ID of this version: | #1028548/1 |
Text MD5: | df9d4208e921a9efec1e96d731bb54e0 |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-06-26 17:47:34 |
Source code size: | 547 bytes / 23 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 184 / 207 |
Referenced in: | [show references] |