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

8
LINES

< > BotCompany Repo | #1027500 // ai_makeNGramScorer

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

Libraryless. Click here for Pure Java version (2299L/14K).

sS ai_makeNGramScorer(Cl<S> pos, Cl<S> neg) {
  Set<S> common = setIntersection(asSet(pos), neg);
  pos = listMinusSet(pos, common);
  neg = listMinusSet(neg, common);
  S s = join("|", pos);
  if (nempty(neg)) s += "^" + join("|", neg);
  ret s;
}

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: #1027500
Snippet name: ai_makeNGramScorer
Eternal ID of this version: #1027500/5
Text MD5: 631fee46d3fab3b60e1895b438bd0592
Transpilation MD5: 3e6858a3b71a7068be50444633276be0
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-03-22 16:23:51
Source code size: 255 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 185 / 269
Version history: 4 change(s)
Referenced in: [show references]