Warning: session_start(): open(/var/lib/php/sessions/sess_pgj6d1qpd1oq2qksd0f6c3b0vc, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
// true if successful
// only call if there are more conditions
sbool ai_ruleEngine2_matchStep(final RuleEngine2_MatchedRule matched, SS inputsByType, bool fillRemainingConditions, O... _) {
bool debug = boolPar debug(_);
RuleEngine2.Rule rule = matched.rule;
TextAndType in = rule.insWithType.get(matched.iCond);
S input = inputsByType.get(in.type);
if (input == null) false;
O inputMassager = get(rule.inputMassagers, matched.iCond);
O checkerFunction = get(rule.checkerFunctions, matched.iCond);
LS tokC = null, tokI = null;
SS map;
if (inputMassager != null) {
input = (S) callF(inputMassager, input);
if (debug) print("Massaged input to: " + input);
if (input == null) false;
}
if (checkerFunction != null)
map = (SS) callF(checkerFunction, input);
else {
S cond = in.text;
S tokenize = matched.tokenizationFunction;
tokC = (LS) callAndMake(tokenize, cond);
tokI = (LS) callAndMake(tokenize, input);
if (debug) print("matchStep iCond=" + matched.iCond + ", insWithType: " + rule.insWithType);
if (debug) print("matchStep tokI/tokC: " + codeTokens(tokI) + " / " + codeTokens(tokC));
if (contains(cond, "{}")) tokI = ai_applyWordSplitPattern1(tokC, tokI);
map = zipTwoListsToCIMap_strict_withoutEquals(tokC, tokI);
}
if (debug) print("matchStep for rule " + rule.globalID + " map: " + map);
if (!gazelle_addMatch(matched, map, tokC, tokI, _)) {
if (debug) print("addMatch failed - " + matched);
false;
}
//print(map + " | " + cond + " | " + rule.vars);
matched.matchedLines.add(pair(tokC, tokI));
if (fillRemainingConditions) {
matched.remainingConditions = nullIfEmpty(map(dropFirst(matched.iCond, rule.in), func(S s) -> S { matched.applyMappingTo(s) }));
matched.remainingConditionsWithType = nullIfEmpty(map(dropFirst(matched.iCond, rule.insWithType), func(TextAndType in) -> TextAndType { TextAndType(matched.applyMappingTo(in.text), in.type) }));
}
Map qualities = ai_ruleEngine2_mappingQualities(rule);
for (S a, b : map) {
mapPut(matched.mappingQuality, a, qualities.get(pair(a, b)));
}
matched.iCond++;
true;
}