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

17
LINES

< > BotCompany Repo | #1026734 // ai_misrecognitionCandidates3 (sorted by Levenshtein distance)

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (4340L/28K).

static L<Proposition> ai_misrecognitionCandidates3() {
  S text = lines(ai_misrecognitionCandidates2());
  L<Proposition> l = ai_parseStatementsWithReasoning(text);
  new Matches m;
  new Map<Pair, Int> scored;
  for (Proposition p : l)
    if (match("* is usually a misrecognition of *", p!, m)) {
      S a = $1, b = $2;
      continue if eqic(a, b);
      scored.put(pair(a, b), levenIC(a, b));
    }
  
    ret map(mapSortedByValue(scored), (pair, distance) -> withReasoning(
      format_quoteAll("* is usually a misrecognition of *", pair.a, pair.b),
      "Levenshtein distance is " + distance + " of " + max(l(pair.a), l(pair.b))
    ));
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1026734
Snippet name: ai_misrecognitionCandidates3 (sorted by Levenshtein distance)
Eternal ID of this version: #1026734/2
Text MD5: e8f65ac3ad1216ca9182f3d21cb9aa3c
Transpilation MD5: 796d27ad87f533d38638cf13e735a78a
Author: stefan
Category: javax / ele
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-01-20 00:19:10
Source code size: 663 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 165 / 237
Version history: 1 change(s)
Referenced in: [show references]