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

32
LINES

< > BotCompany Repo | #1011734 // ai_spec_moveToMiddle

JavaX fragment (include)

static void ai_spec_moveToMiddle(S term) {
  L<WebRelation> mtmRels = ai_spec_moveToMiddle_mtmRels();
  for ping (Web web : indexedWebs(term))
    ai_spec_moveToMiddle(web, mtmRels);
}

static void ai_spec_moveToMiddle(Web web) {
  ai_spec_moveToMiddle(web, ai_spec_moveToMiddle_mtmRels());
}

static void ai_spec_moveToMiddle(Web web, L<WebRelation> mtmRels) {
  for (WebRelation r : web_relationObjects(web)) {
    S rel = web_text(r), b = web_text(r.b);
    for (WebRelation mtm : mtmRels) {
      L<S> l = splitAtSlash_keepAll(web_text(mtm.a));
      L<S> lReplacement = splitAtSlash_keepAll(web_text(mtm.b));
      //print("Trying " + sfu(l) + " -> " + sfu(lReplacement) + " on " + rel + " / " + b);
      continue unless l(l) == 2 && l(lReplacement) == 2;
      new Matches m;
      S prefix = second(l) + " ";
      continue unless eqic(first(l), rel) && swic(b, prefix, m);
      //print("Match.");
      
      ai_postTriple(web_text(r.a), first(lReplacement),
        second(lReplacement) + " " + m.rest());
    }
  }
}

static L<WebRelation> ai_spec_moveToMiddle_mtmRels() {
  ret indexedRelations_verified("move to middle");
}

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: #1011734
Snippet name: ai_spec_moveToMiddle
Eternal ID of this version: #1011734/13
Text MD5: 8d88320da7f5b476fd06cec902104f2c
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-01-07 17:04:27
Source code size: 1169 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 544 / 559
Version history: 12 change(s)
Referenced in: [show references]