static S guessGermanOrEnglish(S text) { Set<S> set1 = mechCISet("English words"); Set<S> set2 = mechCISet("Deutsche Wörter"); int score = 0; for (S word : words(text)) score += zeroOne(set1.contains(word))-zeroOne(set2.contains(word)); ret score > 0 ? "english" : score < 0 ? "german" : null; }
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: | #1014231 |
Snippet name: | guessGermanOrEnglish - returns "german", "english" or null |
Eternal ID of this version: | #1014231/1 |
Text MD5: | d1c46ececcc1fbecb4ba30c895902df1 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-04-17 01:48:18 |
Source code size: | 316 bytes / 8 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 428 / 445 |
Referenced in: | [show references] |