Portuguese Rules¶
Portuguese pluralization and singularization rules.
This module defines the complete set of Portuguese pluralization
rules used by pluralio. It is imported automatically when
import pluralio is executed, which triggers the registration
of the pt language in the global registry.
The rules are organized into four categories:
Irregular plurals: Words that do not follow regex patterns and must be memorized. This includes words ending in
-ãothat take-ãesor-ãosinstead of the default-ões(e.g."cão" → "cães","irmão" → "irmãos"), words with accent shifts in the plural (e.g."papel" → "papéis","sol" → "sóis"), and foreign loanwords (e.g."club" → "clubs"). The inverse mapping (plural → singular) is auto-generated.Extra singulars: Additional plural → singular mappings that cannot be derived from the irregular plurals. These handle cases where the singular form requires an accent that the plural does not have (e.g.
"papéis" → "papel","sóis" → "sol") or where the regex singularization would produce the wrong result (e.g."portugueses" → "português").Regex rules: Ordered patterns applied to words that are not in the irregular or uncountable lists. The first matching rule wins. Rules cover common Portuguese pluralization patterns: -
ão→ões,m→ns,l→is-r→res,z→zes-x→ invariable, vowel ending → addsUncountable words: Words that are invariable — their plural form is identical to their singular form. This includes words ending in
x(tórax,látex), invariable-swords (lápis,vírus), compound words (guarda-chuva,beija-flor), and foreign loanwords (software,web,jazz).
Known limitations:
Accent restoration:
-ões → -ãoworks via regex (tilde restored), but-éis → -eland-óis → -ollose accents. Covered by_EXTRA_SINGLESfor common words.-ão split: Regex always produces
-ões, but ~20% of-ãowords take-ãesor-ãos. These are in irregulars.-s ambiguity:
meses → mes(should bemês). Covered by extra singles for common words.-es → strip s:
portugueses → portuguê(should beportuguês). Covered by extra singles.
Reference: ref/rules.md for the full rules documentation.