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

23
LINES

< > BotCompany Repo | #1012032 // ai_spec_moveToMiddle_triple

JavaX fragment (include)

1  
static void ai_spec_moveToMiddle_triple(S term) {
2  
  T3<S> t = ai_parseTriple(term);
3  
  if (t != null)
4  
    ai_spec_moveToMiddle_triple(term, t, ai_spec_moveToMiddle_mtmRels());
5  
}
6  
7  
static void ai_spec_moveToMiddle_triple(S term, T3<S> t, L<WebRelation> mtmRels) {
8  
  if (t == null) ret;
9  
  S rel = t.b, b = t.c;
10  
  for (WebRelation mtm : mtmRels) {
11  
    L<S> l = splitAtSlash_keepAll(web_text(mtm.a));
12  
    L<S> lReplacement = splitAtSlash_keepAll(web_text(mtm.b));
13  
    //print("Trying " + sfu(l) + " -> " + sfu(lReplacement) + " on " + rel + " / " + b);
14  
    continue unless l(l) == 2 && l(lReplacement) == 2;
15  
    new Matches m;
16  
    S prefix = second(l) + " ";
17  
    continue unless eqic(first(l), rel) && swic(b, prefix, m);
18  
    //print("Match.");
19  
    
20  
    ai_postTriple(term, "is identical to",
21  
      ai_renderTriple(t.a, first(lReplacement), second(lReplacement) + " " + m.rest()));
22  
  }
23  
}

Author comment

Began life as a copy of #1011734

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1012032
Snippet name: ai_spec_moveToMiddle_triple
Eternal ID of this version: #1012032/7
Text MD5: 317ce07a93b135751592e101e0120099
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-16 06:38:52
Source code size: 903 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 384 / 427
Version history: 6 change(s)
Referenced in: [show references]