1 | static S guessGermanOrEnglish(S text) { |
2 | Set<S> set1 = mechCISet("English words"); |
3 | Set<S> set2 = mechCISet("Deutsche Wörter"); |
4 | int score = 0; |
5 | for (S word : words(text)) |
6 | score += zeroOne(set1.contains(word))-zeroOne(set2.contains(word)); |
7 | ret score > 0 ? "english" : score < 0 ? "german" : null; |
8 | } |
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: | 430 / 448 |
Referenced in: | [show references] |