static S ngramScoreBySet(int n, S text, Set<S> set1, Set<S> set2, S a, S b) { int score = 0; for (S s : ngrams(n, text)) score += zeroOne(set1.contains(s))-zeroOne(set2.contains(s)); ret score > 0 ? a : score < 0 ? b : null; }
Began life as a copy of #1014315
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1014323 |
| Snippet name: | ngramScoreBySet |
| Eternal ID of this version: | #1014323/2 |
| Text MD5: | 924344c68cda5104c949d688b34ea4d4 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-04-20 03:12:04 |
| Source code size: | 241 bytes / 6 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 632 / 648 |
| Version history: | 1 change(s) |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1014330 - upperNgramScoreBySet |