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

34
LINES

< > BotCompany Repo | #1011545 // ai_idle_matchPatterns

JavaX fragment (include)

static int ai_idle_matchPatterns() {
  S previousMaker = ai_setMaker('ai_idle_matchPatterns);
  try {
    int websMade = 0;
    L<WebNode> patterns = ai_index_search_dollarX_quoted("$X", "is", "a pattern");
    print("Have " + n_fancy(patterns, "pattern"));
    
    for ping (WebNode nPat : patterns) {
      S pattern = web_unquote(nPat);
      L<S> tokPat = javaTok(pattern);
      L<S> tokens = listWithout(codeTokens(tokPat), "*");
      print("Processing: " + pattern);
      for ping (S sKey : allIndexedTerms()) {
        L<S> l = uniquify(ai_expandShortenedKeys(sKey));
          
        for ping (S sOrig : l) {
          S s = unquote(sOrig);
          if (eq(s, pattern)) continue;
          L<S> tok = javaTok(s);
          if (tok.contains("*")) continue;
          if (containsAll(tok, tokens))
            if (flexMatchIC2(tokPat, tok, null)) {
              //print("match.");
              if (ai_postTriple(web_text(nPat), "matches", sOrig) != null)
                ++websMade;
            }
        }
      }
    }
    ret websMade;
  } finally {
    ai_setMaker(previousMaker);
  }
}

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: #1011545
Snippet name: ai_idle_matchPatterns
Eternal ID of this version: #1011545/20
Text MD5: 0e4469e5fddf331f16224af06c62a4be
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-31 18:31:37
Source code size: 1138 bytes / 34 lines
Pitched / IR pitched: No / No
Views / Downloads: 475 / 506
Version history: 19 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)