Skip to content

fix: singularize 'analyses' to 'analysis' instead of 'analyasis'#125

Merged
p-kuen merged 1 commit into
dreamerslab:masterfrom
greymoth-jp:fix-singularize-analyses
Jun 29, 2026
Merged

fix: singularize 'analyses' to 'analysis' instead of 'analyasis'#125
p-kuen merged 1 commit into
dreamerslab:masterfrom
greymoth-jp:fix-singularize-analyses

Conversation

@greymoth-jp

Copy link
Copy Markdown
Contributor

singularize('analyses') returns analyasis, which isn't a word. It should return analysis.

pluralize('analysis') already gives analyses, so singularize is just failing to invert it.

The cause is the replacement string on the -ses -> -sis rule:

[regex.plural.analyses, '$1$2sis'],

The regex is ((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$. $1 is the full stem (analy, ba, diagno, ...), and the inner letter groups are $2 for (a), $3 for (b), $4 for (d), and so on. The template uses $2, but $2 is only ever set on the (a)naly branch, so it re-appends a stray a: analy + a + sis = analyasis. For every other word $2 is empty, which is why bases, diagnoses, parentheses, prognoses, synopses, theses already singularize correctly.

$1 already contains that a, so dropping $2 fixes analyses and leaves the other six untouched:

[regex.plural.analyses, '$1sis'],

Added assertions for analyses, bases and diagnoses in the singularize test to lock the family. Full suite passes.

@p-kuen p-kuen merged commit 0c37535 into dreamerslab:master Jun 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants