(word: string)
| 145 | * that used to mint "class" → clas. |
| 146 | */ |
| 147 | export function segmentLookupVariants(word: string): string[] { |
| 148 | const variants = [word]; |
| 149 | const canStrip2 = word.length >= MIN_PROSE_CHARS + 2; |
| 150 | const canStrip1 = word.length >= MIN_PROSE_CHARS + 1; |
| 151 | if (/(?:x|sh|ss|zz)es$/.test(word)) { |
| 152 | if (canStrip2) variants.push(word.slice(0, -2)); |
| 153 | } else if (/(?:ch|s|z|o)es$/.test(word)) { |
| 154 | if (canStrip2) variants.push(word.slice(0, -2)); |
| 155 | if (canStrip1) variants.push(word.slice(0, -1)); |
| 156 | } else if (word.endsWith('s') && !word.endsWith('ss')) { |
| 157 | if (canStrip1) variants.push(word.slice(0, -1)); |
| 158 | } |
| 159 | return variants; |
| 160 | } |
no outgoing calls
no test coverage detected