Linguistics::EN::

Pluralization

module

Plural inflection methods for the English-language Linguistics module.

It provides conversion of plural forms of all nouns, most verbs, and some adjectives. It also provides “classical” variants (for example: “brother” -> “brethren”, “dogma” -> “dogmata”, etc.) where appropriate.

Constants

PL_adj_poss
PL_adj_poss_h
PL_adj_special
PL_adj_special_h
PL_count_one
PL_count_zero
PL_prep
PL_pron_acc
PL_pron_acc_h
PL_pron_nom
PL_pron_nom_h
PL_sb_C_a_ae

Classical “..a” -> “..ae”

PL_sb_C_a_ata

Classical “..a” -> “..ata”

PL_sb_C_en_ina

Classical “..en” -> “..ina”

PL_sb_C_ex_ices

Classical “..[ei]x” -> “..ices”

PL_sb_C_i

Arabic: “..” -> “..i”

PL_sb_C_im

Hebrew: “..” -> “..im”

PL_sb_C_ix_ices
PL_sb_C_o_i
PL_sb_C_o_i_a

Classical “..o” -> “..i” (but normally -> “..os”)

PL_sb_C_on_a

Classical “..on” -> “..a”

PL_sb_C_um_a

Classical “..um” -> “..a”

PL_sb_C_us_i

Classical “..us” -> “..i”

PL_sb_C_us_us

Classical “..us” -> “..us” (assimilated 4th declension latin nouns)

PL_sb_U_a_ae

Unconditional “..a” -> “..ae”

PL_sb_U_ex_ices

Unconditional “..[ei]x” -> “..ices”

PL_sb_U_ix_ices
PL_sb_U_man_mans

Unconditional “..man” -> “..mans”

PL_sb_U_o_os

Always “..o” -> “..os”

PL_sb_U_on_a

Unconditional “..on” -> “a”

PL_sb_U_um_a

Unconditional “..um” -> “..a”

PL_sb_U_us_i

Unconditional “..us” -> “i”

PL_sb_general
PL_sb_irregular
PL_sb_irregular_h
PL_sb_irregular_s

Plurals

PL_sb_military
PL_sb_postfix_adj
PL_sb_prep_compound
PL_sb_prep_dual_compound
PL_sb_singular_s

Singular words ending in …s (all inflect with …es)

PL_sb_uninflected
PL_sb_uninflected_herd

Don't inflect in classical mode, otherwise normal inflection

PL_sb_uninflected_s
PL_v_ambiguous_non_pres
PL_v_ambiguous_pres
PL_v_ambiguous_pres_h
PL_v_irregular_non_pres
PL_v_irregular_pres
PL_v_irregular_pres_h
PL_v_special_s

Public Instance Methods

anchor
plural( count=2 )

Return the plural of the given phrase if count indicates it should be plural.

# File lib/linguistics/en/pluralization.rb, line 399
def plural( count=2 )
        phrase = if self.respond_to?( :to_int )
                        self.numwords
                else
                        self.to_s
                end

        self.log.debug "Pluralizing %p" % [ phrase ]
        pre = text = post = nil

        # If the string has whitespace, only pluralize the middle bit, but
        # preserve the whitespace to add back to the result.
        if md = /\A(\s*)(.+?)(\s*)\Z/.match( phrase.to_s )
                pre, text, post = md.captures
        else
                return phrase
        end

        plural = postprocess( text,
                pluralize_special_adjective(text, count) ||
                pluralize_special_verb(text, count) ||
                pluralize_noun(text, count) )

        return pre + plural + post
end
anchor
plural_adj( count=2 )
Alias for: plural_adjective
anchor
plural_adjective( count=2 )

Return the plural of the given adjectival phrase if count indicates it should be plural.

# File lib/linguistics/en/pluralization.rb, line 461
def plural_adjective( count=2 )
        phrase = self.to_s
        md = /\A(\s*)(.+?)(\s*)\Z/.match( phrase )
        pre, word, post = md.captures

        return phrase if word.nil? or word.empty?

        plural = postprocess( word, pluralize_special_adjective(word, count) || word )

        return pre + plural + post
end
Also aliased as: plural_adj
anchor
plural_noun( count=2 )

Return the plural of the given noun phrase if count indicates it should be plural.

# File lib/linguistics/en/pluralization.rb, line 429
def plural_noun( count=2 )
        phrase = self.to_s
        md = /\A(\s*)(.+?)(\s*)\Z/.match( phrase )
        pre, word, post = md.captures

        return phrase if word.nil? or word.empty?

        plural = postprocess( word, pluralize_noun(word, count) )

        return pre + plural + post
end
anchor
plural_verb( count=2 )

Return the plural of the given verb phrase if count indicates it should be plural.

# File lib/linguistics/en/pluralization.rb, line 444
def plural_verb( count=2 )
        phrase = self.to_s
        md = /\A(\s*)(.+?)(\s*)\Z/.match( phrase )
        pre, word, post = md.captures

        return phrase if word.nil? or word.empty?

        plural = postprocess( word,
                pluralize_special_verb(word, count) ||
                pluralize_general_verb(word, count) )

        return pre + plural + post
end