static int ai_idle_matchPatterns() { S previousMaker = ai_setMaker('ai_idle_matchPatterns); try { int websMade = 0; L 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 tokPat = javaTok(pattern); L tokens = listWithout(codeTokens(tokPat), "*"); print("Processing: " + pattern); for ping (S sKey : allIndexedTerms()) { L l = uniquify(ai_expandShortenedKeys(sKey)); for ping (S sOrig : l) { S s = unquote(sOrig); if (eq(s, pattern)) continue; L 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); } }