static L<RuleEngine2_MatchedRule> ai_ruleEngine2_rulesForInput_3(RuleEngine2 engine, S q) { q = unnull(q); new L<RuleEngine2_MatchedRule> l; for (RuleEngine2.Rule rule : engine.rules) { S cond = first(rule.in); S tokenize = or(matchAny_firstGroup("tokenize with *", rule.comments), f javaTokNPunctuationWithBrackets); LS tokI = (LS) callAndMake(tokenize, q); LS tokC = (LS) callAndMake(tokenize, cond); tokI = ai_applyWordSplitPattern1(tokC, tokI); SS map = zipTwoListsToCIMap_strict_withoutEquals(tokC, tokI); if (map == null) continue; //print(map + " | " + cond + " | " + rule.vars); final new RuleEngine2_MatchedRule matched; matched.rule = rule; matched.map = map; matched.matchedLines.add(pair(tokC, tokI)); matched.tokenizationFunction = tokenize; matched.remainingConditions = nullIfEmpty(map(dropFirst(rule.in), func(S s) -> S { matched.applyMappingTo(s) })); Map<PairS, Int> qualities = ai_ruleEngine2_mappingQualities(rule); for (S a, b : map) { mapPut(matched.mappingQuality, a, qualities.get(pair(a, b))); } l.add(matched); } ret l; }
Began life as a copy of #1021403
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1021405 | 
| Snippet name: | ai_ruleEngine2_rulesForInput_3 | 
| Eternal ID of this version: | #1021405/24 | 
| Text MD5: | a51c878f899023a4f4599cdc4f02e077 | 
| Author: | stefan | 
| Category: | javax | 
| Type: | JavaX fragment (include) | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2019-02-13 23:49:55 | 
| Source code size: | 1160 bytes / 26 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 515 / 602 | 
| Version history: | 23 change(s) | 
| Referenced in: | [show references] |