1 | static L<RuleEngine2_MatchedRule> ai_ruleEngine2_rulesForInput_3(RuleEngine2 engine, S q) { |
2 | q = unnull(q); |
3 | new L<RuleEngine2_MatchedRule> l; |
4 | for (RuleEngine2.Rule rule : engine.rules) { |
5 | S cond = first(rule.in); |
6 | S tokenize = or(matchAny_firstGroup("tokenize with *", rule.comments), f javaTokNPunctuationWithBrackets); |
7 | LS tokI = (LS) callAndMake(tokenize, q); |
8 | LS tokC = (LS) callAndMake(tokenize, cond); |
9 | tokI = ai_applyWordSplitPattern1(tokC, tokI); |
10 | SS map = zipTwoListsToCIMap_strict_withoutEquals(tokC, tokI); |
11 | if (map == null) continue; |
12 | //print(map + " | " + cond + " | " + rule.vars); |
13 | final new RuleEngine2_MatchedRule matched; |
14 | matched.rule = rule; |
15 | matched.map = map; |
16 | matched.matchedLines.add(pair(tokC, tokI)); |
17 | matched.tokenizationFunction = tokenize; |
18 | matched.remainingConditions = nullIfEmpty(map(dropFirst(rule.in), func(S s) -> S { matched.applyMappingTo(s) })); |
19 | Map<PairS, Int> qualities = ai_ruleEngine2_mappingQualities(rule); |
20 | for (S a, b : map) { |
21 | mapPut(matched.mappingQuality, a, qualities.get(pair(a, b))); |
22 | } |
23 | l.add(matched); |
24 | } |
25 | ret l; |
26 | } |
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: | 306 / 381 |
Version history: | 23 change(s) |
Referenced in: | [show references] |