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).

1  
svoid ai_combinePosAndNegNGramScorersForLanguageDetectionTask(LanguageDetectionTask task) {
2  
  LS exprs = pairsA((LPairS) dm_callAndImport(dm_languageDetectionNGramScorersCRUD(), 'expressionsForTask, task.task()));
3  
  LS pos = notStartingWith(exprs, "^");
4  
  LS neg = startingWith(exprs, "^");
5  
6  
  Set<S> seen = ciSet();
7  
  new DynamicTopTen<S> tt;
8  
   
9  
  repeat 1000 {
10  
    S expr = firstNotSeen_nAttempts(1000, seen, () -> 
11  
      ai_combineNGramScorers_noDuplicates(random(pos), random(neg))
12  
    );
13  
    if (expr == null) break with print("Can't find any new expressions");
14  
    tt.add(expr, scoreNGramScorer(expr, task.pos, task.neg));
15  
  }
16  
    
17  
  pnl(tt.withScores());
18  
  dm_saveLanguageDetectionNGramScorers(task, tt);
19  
}

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: 164 / 241
Referenced in: [show references]