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)

1  
static int ai_idle_matchPatterns() {
2  
  S previousMaker = ai_setMaker('ai_idle_matchPatterns);
3  
  try {
4  
    int websMade = 0;
5  
    L<WebNode> patterns = ai_index_search_dollarX_quoted("$X", "is", "a pattern");
6  
    print("Have " + n_fancy(patterns, "pattern"));
7  
    
8  
    for ping (WebNode nPat : patterns) {
9  
      S pattern = web_unquote(nPat);
10  
      L<S> tokPat = javaTok(pattern);
11  
      L<S> tokens = listWithout(codeTokens(tokPat), "*");
12  
      print("Processing: " + pattern);
13  
      for ping (S sKey : allIndexedTerms()) {
14  
        L<S> l = uniquify(ai_expandShortenedKeys(sKey));
15  
          
16  
        for ping (S sOrig : l) {
17  
          S s = unquote(sOrig);
18  
          if (eq(s, pattern)) continue;
19  
          L<S> tok = javaTok(s);
20  
          if (tok.contains("*")) continue;
21  
          if (containsAll(tok, tokens))
22  
            if (flexMatchIC2(tokPat, tok, null)) {
23  
              //print("match.");
24  
              if (ai_postTriple(web_text(nPat), "matches", sOrig) != null)
25  
                ++websMade;
26  
            }
27  
        }
28  
      }
29  
    }
30  
    ret websMade;
31  
  } finally {
32  
    ai_setMaker(previousMaker);
33  
  }
34  
}

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: 474 / 506
Version history: 19 change(s)
Referenced in: [show references]