Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

23
LINES

< > BotCompany Repo | #1028548 // EnglishDateParser, attempt 3 using TransformersOnObjects [dev.]

JavaX fragment (include)

sclass EnglishDateParser > DateStructures {
  new TransformersOnObjects too;
  
  record Unparsed(LS tok) {}
  
  class ParseYear extends VF1<Unparsed> {
    public void get(Unparsed u) {
      for (LS tok2 : tokenPrefixLists(1, u.tok)) {
        ret WithProbability(1.0-0.9*l(tok2), );
    }
  }
  
  SomeDate parse(S s) null {
    LS tok = javaTok(s);
    too.add(Unparsed(tok));
    
    transformers.add(ParseYear);

    // let's try to parse a year just to get started
    
    pm.addState(new ScanFromToken(1));
  }
}

Author comment

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: 183 / 206
Referenced in: