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

19
LINES

< > BotCompany Repo | #1027504 // ai_combinePosAndNegNGramScorersForLanguageDetectionTask

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

Libraryless. Click here for Pure Java version (3809L/24K).

svoid ai_combinePosAndNegNGramScorersForLanguageDetectionTask(LanguageDetectionTask task) {
  LS exprs = pairsA((LPairS) dm_callAndImport(dm_languageDetectionNGramScorersCRUD(), 'expressionsForTask, task.task()));
  LS pos = notStartingWith(exprs, "^");
  LS neg = startingWith(exprs, "^");

  Set<S> seen = ciSet();
  new DynamicTopTen<S> tt;
   
  repeat 1000 {
    S expr = firstNotSeen_nAttempts(1000, seen, () -> 
      ai_combineNGramScorers_noDuplicates(random(pos), random(neg))
    );
    if (expr == null) break with print("Can't find any new expressions");
    tt.add(expr, scoreNGramScorer(expr, task.pos, task.neg));
  }
    
  pnl(tt.withScores());
  dm_saveLanguageDetectionNGramScorers(task, tt);
}

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: #1027504
Snippet name: ai_combinePosAndNegNGramScorersForLanguageDetectionTask
Eternal ID of this version: #1027504/1
Text MD5: a8c41a8adfad35170adc68e962cca879
Transpilation MD5: f7cd2192d16a73883d7d43db4e2662a5
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-03-22 15:57:54
Source code size: 732 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 94 / 148
Referenced in: [show references]