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

26
LINES

< > BotCompany Repo | #1021452 // ai_gazelle_statementsFromAppliedRule - statements are not uniquified

JavaX fragment (include)

please include function javaTokNPunctuationWithBrackets.
please include function javaTokNoQuotes.
please include function javaTokNoQuotesWithBrackets.

static LS ai_gazelle_statementsFromAppliedRule(RuleEngine2_MatchedRule r, S judgement) {
  if (r == null || r.rule == null) ret new L;
  if (nempty(judgement) && neq(judgement, 'good)) judgement = 'bad; // funny -> bad

  S ruleID = r.rule.globalID;
  S ruleIn = first(r.rule.in);
  if (ruleIn == null) ret new L;
  SS varMap = r.map;
  S tokenize = r.tokenizationFunction;
  LS tok = cast callAndMake(tokenize, ruleIn);
  LS tokC = codeTokens(tok);
  Set<S> possibleVars = asCISet(tokC);
  new LS statements;
  for (S a, b : varMap) {
    statements.add(format("in a * mapping, variable " + quote(a) + " was used", judgement));
    statements.add(format("in a * mapping, variable " + quote(a) + " was mapped to " + quote(b), judgement));
  }
  for (S var : possibleVars)
    statements.add("possible variable " + quote(var));
  statements.add(format("a * mapping is *", judgement, sfu(varMap)));
  ret statements;
}

Author comment

Began life as a copy of #1021432

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: #1021452
Snippet name: ai_gazelle_statementsFromAppliedRule - statements are not uniquified
Eternal ID of this version: #1021452/8
Text MD5: cbfb864f1f50b2fd6de4f36b0494a112
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-04 13:59:38
Source code size: 1093 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 244 / 288
Version history: 7 change(s)
Referenced in: [show references]