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:

  1. Irregular plurals: Words that do not follow regex patterns and must be memorized. This includes words ending in -ão that take -ães or -ãos instead 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.

  2. 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").

  3. 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, mns, lis - rres, zzes - x → invariable, vowel ending → add s

  4. Uncountable 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 -s words (lápis, vírus), compound words (guarda-chuva, beija-flor), and foreign loanwords (software, web, jazz).

Known limitations:

  • Accent restoration: -ões -ão works via regex (tilde restored), but -éis -el and -óis -ol lose accents. Covered by _EXTRA_SINGLES for common words.

  • -ão split: Regex always produces -ões, but ~20% of -ão words take -ães or -ãos. These are in irregulars.

  • -s ambiguity: meses mes (should be mês). Covered by extra singles for common words.

  • -es → strip s: portugueses portuguê (should be português). Covered by extra singles.

Reference: ref/rules.md for the full rules documentation.