minimorph-0.1.0.0: English spelling functions with an emphasis on simplicity.

Portabilityportable
Stabilityexperimental
Maintainereric.kow@gmail.com
Safe HaskellSafe-Infered

NLP.Minimorph.English

Description

Simple default rules for English morphology

Synopsis

Documentation

commas :: Text -> [Text] -> TextSource

No Oxford commas, alas.

 commas "and" "foo bar"       == "foo and bar"
 commas "and" "foo, bar, baz" == "foo, bar and baz"

cardinal :: Int -> TextSource

 cardinal 1 == "one"
 cardinal 2 == "two"
 cardinal 3 == "three"
 cardinal 4 == "4"

ordinal :: Int -> TextSource

 cardinal 1 == "first"
 cardinal 2 == "second"
 cardinal 3 == "third"
 cardinal 4 == "4th"

defaultNounPlural :: Text -> TextSource

Heuristics for English plural for an unknown noun

 defaultNounPlural "egg"    == "eggs"
 defaultNounPlural "patch"  == "patches"
 defaultNounPlural "boy"    == "boys"
 defaultNounPlural "spy"    == "spies"
 defaultNounPlural "thesis" == "theses"

defaultVerbStuff :: Text -> (Text, Text)Source

Heuristics for 3rd person singular and past participle for an unknown regular verb

 defaultVerbStuff "walk"  == ("walks",  "walked")
 defaultVerbStuff "push"  == ("pushes", "pushed")
 defaultVerbStuff "play"  == ("plays",  "played")
 defaultVerbStuff "cry"   == ("cries",  "cried")

indefiniteDet :: Text -> TextSource

 indefiniteDet "dog"  == "a"
 indefiniteDet "egg"  == "an"
 indefiniteDet "ewe"  == "a"
 indefiniteDet "ewok" == "an"

hasSibilantSuffix :: Text -> BoolSource

Ends with a sh sound

hasSemivowelPrefix :: Text -> BoolSource

Starts with a semivowel

hasCySuffix :: Text -> BoolSource

Last two letters are a consonant and y

isVowel :: Char -> BoolSource

Is a vowel (this includes '1' and '8' because of one and eight)

isConsonant :: Char -> BoolSource

Is a consonant