package inflection

Import Path
	github.com/jinzhu/inflection (on go.dev)

Dependency Relation
	imports 2 packages, and imported by one package

Involved Source Files Package inflection pluralizes and singularizes English nouns. inflection.Plural("person") => "people" inflection.Plural("Person") => "People" inflection.Plural("PERSON") => "PEOPLE" inflection.Singular("people") => "person" inflection.Singular("People") => "Person" inflection.Singular("PEOPLE") => "PERSON" inflection.Plural("FancyPerson") => "FancydPeople" inflection.Singular("FancyPeople") => "FancydPerson" Standard rules are from Rails's ActiveSupport (https://github.com/rails/rails/blob/master/activesupport/lib/active_support/inflections.rb) If you want to register more rules, follow: inflection.AddUncountable("fish") inflection.AddIrregular("person", "people") inflection.AddPlural("(bu)s$", "${1}ses") # "bus" => "buses" / "BUS" => "BUSES" / "Bus" => "Buses" inflection.AddSingular("(bus)(es)?$", "${1}") # "buses" => "bus" / "Buses" => "Bus" / "BUSES" => "BUS"
Package-Level Type Names (total 4)
/* sort by: | */
Irregular is a hard replace inflection, containing both singular and plural forms
IrregularSlice is a slice of Irregular inflections func GetIrregular() IrregularSlice func SetIrregular(inflections IrregularSlice)
Regular is a regexp find replace inflection
RegularSlice is a slice of Regular inflections func GetPlural() RegularSlice func GetSingular() RegularSlice func SetPlural(inflections RegularSlice) func SetSingular(inflections RegularSlice)
Package-Level Functions (total 14)
AddIrregular adds an irregular inflection
AddPlural adds a plural inflection
AddSingular adds a singular inflection
AddUncountable adds an uncountable inflection
GetIrregular retrieves the irregular inflection values
GetPlural retrieves the plural inflection values
GetSingular retrieves the singular inflection values
GetUncountable retrieves the uncountable inflection values
Plural converts a word to its plural form
SetIrregular sets the irregular inflections slice
SetPlural sets the plural inflections slice
SetSingular sets the singular inflections slice
SetUncountable sets the uncountable inflections slice
Singular converts a word to its singular form