Copyright | © 2016 Brady Ouren |
---|---|
License | MIT |
Maintainer | Brady Ouren <brady.ouren@gmail.com> |
Stability | stable |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
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
- pluralize :: Text -> Text
- pluralizeWith :: [Inflection] -> Text -> Text
- singularize :: Text -> Text
- singularizeWith :: [Inflection] -> Text -> Text
- inflect :: Text -> Int -> Text
- inflectWith :: [Inflection] -> Text -> Int -> Text
- makeMatchMapping :: [(RegexPattern, RegexReplace)] -> [Inflection]
- makeIrregularMapping :: [(Singular, Plural)] -> [Inflection]
- makeUncountableMapping :: [Text] -> [Inflection]
Documentation
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
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