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

35
LINES

< > BotCompany Repo | #1012219 // ai_tripelize_howLongEtc

JavaX fragment (include)

1  
static T3<S> ai_tripelize_howLongEtc(S s) {
2  
  ret ai_tripelize_howLongEtc(s, ai_tripelize_prepare(s));
3  
}
4  
5  
static T3<S> ai_tripelize_howLongEtc(S s, L<S> tok) {
6  
  //printStruct(tok);
7  
  if (eqicGetOneOf(tok, 1, "how", "what")) {
8  
    // e.g. how long is the string "bla"?
9  
    int verb = indexOfFirstVerb(tok);
10  
    S v = get(tok, verb);
11  
    
12  
    if (eqicOneOf(v, "does", "do", "have")) {
13  
      // e.g. How many characters does the string "abcd" contain?
14  
      int verb2 = indexOfFirstVerbOrPastParticiple(tok, verb+2);
15  
      if (verb2 >= 0) {
16  
        S a = v; // helper verb
17  
        v = get(tok, verb2);
18  
        print("verb: " + v);
19  
        S middle = trimJoinSubList(tok, verb+2, verb2);
20  
        S rest = trimJoinSubList(tok, verb2+1);
21  
        v = ai_tripelize_helperVerb(a, v);
22  
        ret t3(
23  
          middle,
24  
          dropSuffix("?", v),
25  
          trim(trimJoinSubList(tok, 0, verb) + " " + rest) + "?");
26  
      }
27  
    }
28  
    
29  
    ret t3(
30  
      trimJoinSubList(tok, verb+1),
31  
      v,
32  
      trimJoinSubList(tok, 0, verb) + "?");
33  
  }
34  
  null;
35  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1012219
Snippet name: ai_tripelize_howLongEtc
Eternal ID of this version: #1012219/15
Text MD5: a0ebb6503534d6d3e0c4a9827c141892
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-30 18:36:35
Source code size: 1074 bytes / 35 lines
Pitched / IR pitched: No / No
Views / Downloads: 485 / 517
Version history: 14 change(s)
Referenced in: [show references]