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

static PosNegMatrix<LS> posNegMatrixForNGrams(Cl<S> posNgrams, Cl<S> negNGrams, Cl<S> pos, Cl<S> neg) {
  PosNegMatrix<LS> matrix = posNegMatrixOfLists();
  for (S s : pos) {
    int score = substringsScoreICPosNeg(s, posNgrams, negNGrams);
    bool ok = score > 0;
    (ok ? matrix.pos : matrix.falseNeg).add(s);
  }
  for (S s : neg) {
    int score = substringsScoreICPosNeg(s, posNgrams, negNGrams);
    bool ok = score < 0;
    (ok ? matrix.neg : matrix.falsePos).add(s);
  }
  ret matrix;
}

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: 195 / 278
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)