inflection
Word transformation. Transforms words from singular to plural, class names to table names, modularized class names to ones without, and class names to foreign keys.
Inflection is language specific and the default inflection handles English language inflection. You can access inflection handlers for other languages by importing the appropriate inflector. For example from miwa.inflection.sv import inflection to use Swedish inflection.
| Author | Rasmus Andersson — http://hunch.se/ |
|---|---|
| var inflections | locale-to-Inflection-object map |
| var inflection | English inflection (default) |
Modules
Classes
- class
smisk.inflection.Inflector(*locales) -
Language inflector. Encapsulates all rules for pluralizing and singularizing words in a given locale.
Variable locales languages this inflection handles Variable plurals plural rules Variable singulars singular rules Variable uncountables list of uncountable words pluralize(word)Parameters word (str) Return type str Return the plural form of word.
singularize(word)Parameters word (str) Return type str Return the singular form of word.
camelize(word)Convert
underscored_wordtoCamelCase.underscore(word)Convert
CamelCasetounderscored_lower_case.tableize(class_name)Create the table name for a given class name.
foreign_key(class_name)Create a foreign key name from a class name.