1 | static SS singular_specials = litmap( |
2 | "children", "child", "images", "image", "chess", "chess"); |
3 | |
4 | static Set<S> singular_specials2 = litciset("time", "machine", "line", "rule"); |
5 | |
6 | static S singular(S s) { |
7 | if (s == null) null; |
8 | try answer singular_specials.get(s); |
9 | //try answer hippoSingulars().get(lower(s)); |
10 | if (singular_specials2.contains(dropSuffix("s", afterLastSpace(s)))) |
11 | ret dropSuffix("s", s); |
12 | if (s.endsWith("ness")) ret s; |
13 | if (s.endsWith("ges")) ret dropSuffix("s", s); |
14 | if (endsWith(s, "bases")) ret dropLast(s); |
15 | s = dropSuffix("es", s); |
16 | s = dropSuffix("s", s); |
17 | ret s; |
18 | } |
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1004402 |
Snippet name: | singular - try to get singular of a word |
Eternal ID of this version: | #1004402/9 |
Text MD5: | 12aec2e4169d99ad74e6bd56402c8c56 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-02-20 19:06:09 |
Source code size: | 623 bytes / 18 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 765 / 765 |
Version history: | 8 change(s) |
Referenced in: | [show references] |