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

14
LINES

< > BotCompany Repo | #1027493 // posNegMatrixForNGrams

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

Libraryless. Click here for Pure Java version (2449L/16K).

1  
static PosNegMatrix<LS> posNegMatrixForNGrams(Cl<S> posNgrams, Cl<S> negNGrams, Cl<S> pos, Cl<S> neg) {
2  
  PosNegMatrix<LS> matrix = posNegMatrixOfLists();
3  
  for (S s : pos) {
4  
    int score = substringsScoreICPosNeg(s, posNgrams, negNGrams);
5  
    bool ok = score > 0;
6  
    (ok ? matrix.pos : matrix.falseNeg).add(s);
7  
  }
8  
  for (S s : neg) {
9  
    int score = substringsScoreICPosNeg(s, posNgrams, negNGrams);
10  
    bool ok = score < 0;
11  
    (ok ? matrix.neg : matrix.falsePos).add(s);
12  
  }
13  
  ret matrix;
14  
}

Author comment

Began life as a copy of #1027472

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: #1027493
Snippet name: posNegMatrixForNGrams
Eternal ID of this version: #1027493/4
Text MD5: 023a169a47d05857e9ba5ffa9c95917a
Transpilation MD5: 7041f666fceee211b7a1344e18f31af5
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-03-22 17:17:38
Source code size: 509 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 196 / 280
Version history: 3 change(s)
Referenced in: [show references]