Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

21
LINES

< > BotCompany Repo | #1021884 // gazelle_saveExampleFromCommentAsAppliedRule

JavaX fragment (include)

svoid gazelle_saveExampleFromCommentAsAppliedRule(S ruleID) {
  for (S example : gazelle_goodExamplesFromComments(ruleID)) {
    PairS xmp = splitAtDoubleArrow_pair(example);
    if (xmp == null) continue;
    GazelleEvalContext ctx = dm_gazelle_stdEvalContext(ll(t3(dm_textForRule(ruleID), dm_commentOfRule(ruleID), ruleID)));
    L<RuleEngine2_MatchedRule> l = ai_ruleEngine2_rulesForInput_5(ctx.engine, litmap(standard := xmp.a));
    print("Matched: " + sfu(l));
    if (empty(l)) continue;
    RuleEngine2_MatchedRule mr = first(l);
    LS tokC = mr.outTokenize(mr.rule.out);
    LS tokI = mr.outTokenize(xmp.b);
    printStruct(tokI);
    SS map = zipTwoListsToCIMap_strict_withoutEquals(tokC, tokI);
    if (!gazelle_addMatch(mr, map, tokC, tokI)) continue;
    print("Got map: " + mr.map);
    dm_gazelle_saveAppliedRule(
      judgement := 'good,
      matchedRuleStruct := struct(mr),
      context := "comment on " + ruleID);
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, whxojlpjdney

No comments. add comment

Snippet ID: #1021884
Snippet name: gazelle_saveExampleFromCommentAsAppliedRule
Eternal ID of this version: #1021884/8
Text MD5: da6364827d486cdd2311b37d683262a4
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-03 00:10:14
Source code size: 962 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 188 / 234
Version history: 7 change(s)
Referenced in: [show references]