countable-inflections-0.2.0: Countable Text Inflections

Copyright© 2016 Brady Ouren
LicenseMIT
MaintainerBrady Ouren <brady@andand.co>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Text.Countable

Description

pluralization and singularization transformations

Synopsis

Documentation

pluralize :: Text -> Text Source #

pluralize a word given a default mapping

pluralizeWith :: [Inflection] -> Text -> Text Source #

pluralize a word given a custom mapping. Build the [Inflection] with a combination of makeUncountableMapping makeIrregularMapping makeMatchMapping

singularize :: Text -> Text Source #

singularize a word given a default mapping

singularizeWith :: [Inflection] -> Text -> Text Source #

singularize a word given a custom mapping. Build the [Inflection] with a combination of makeUncountableMapping makeIrregularMapping makeMatchMapping

makeMatchMapping :: [(RegexPattern, RegexReplace)] -> [Inflection] Source #

Makes a simple list of mappings from singular to plural, e.g [("person", "people")] the output of [Inflection] should be consumed by singularizeWith or pluralizeWith

makeIrregularMapping :: [(Singular, Plural)] -> [Inflection] Source #

Makes a simple list of mappings from singular to plural, e.g [("person", "people")] the output of [Inflection] should be consumed by singularizeWith or pluralizeWith

makeUncountableMapping :: [Text] -> [Inflection] Source #

Makes a simple list of uncountables which don't have singular plural versions, e.g ["fish", "money"] the output of [Inflection] should be consumed by singularizeWith or pluralizeWith