countable-inflections-0.3.0: Countable Text Inflections
Copyright© 2016 Brady Ouren
LicenseMIT
MaintainerBrady Ouren <brady.ouren@gmail.com>
Stabilitystable
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Text.Countable

Description

pluralization and singularization transformations

Note: This library is portable in the sense of haskell extensions however, it is _not_ portable in the sense of requiring PCRE regex bindings on the system

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

inflect :: Text -> Int -> Text Source #

inflect a word given any number

inflectWith :: [Inflection] -> Text -> Int -> Text Source #

inflect a word given any number and inflection mapping

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