-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | English spelling functions with an emphasis on simplicity.
--   
--   A set of simplistic functions capturing the more regular parts of
--   English spelling (for generation, not parsing). You will need to
--   complement this with some account for irregular nouns/verbs. This
--   package is not meant to provide anything resembling a full account of
--   English morphology (something like Functional Morphology or sequor
--   could be better suited). The main goal is to provide something cheap
--   and cheerful with no learning curve, that you can use until your
--   application calls for more robustness. See
--   https://github.com/Mikolaj/miniutter for a simple use case.
@package minimorph
@version 0.2.2.0

module NLP.Minimorph.Number

-- | Singular and Plural.
data SingPlu a
SP :: a -> a -> SingPlu a
[sg] :: SingPlu a -> a
[pl] :: SingPlu a -> a
data Number
Singular :: Number
Plural :: Number
fromSP :: Number -> SingPlu a -> a
instance GHC.Show.Show NLP.Minimorph.Number.Number
instance GHC.Classes.Eq NLP.Minimorph.Number.Number
instance GHC.Classes.Eq a => GHC.Classes.Eq (NLP.Minimorph.Number.SingPlu a)
instance GHC.Show.Show a => GHC.Show.Show (NLP.Minimorph.Number.SingPlu a)

-- | Text utility functions.
module NLP.Minimorph.Util

-- | Separated by space unless one of them is empty (in which case just the
--   non-empty one).
(<+>) :: Text -> Text -> Text
infixr 6 <+>

-- | Show a value in Text format.
tshow :: Show a => a -> Text

-- | Simple default rules for English morphology
module NLP.Minimorph.English

-- | No Oxford commas, alas.
--   
--   
--   commas "and" "foo bar"       == "foo and bar"
--   commas "and" "foo, bar, baz" == "foo, bar and baz"
--   
commas :: Text -> [Text] -> Text

-- | 
--   cardinal 0 == "zero"
--   cardinal 1 == "one"
--   cardinal 2 == "two"
--   cardinal 10 == "ten"
--   cardinal 11 == "11"
--   
cardinal :: Int -> Text

-- | 
--   ordinalNotSpelled 1 == "1st"
--   ordinalNotSpelled 2 == "2nd"
--   ordinalNotSpelled 11 == "11th"
--   
ordinalNotSpelled :: Int -> Text

-- | 
--   ordinal 1 == "first"
--   ordinal 2 == "second"
--   ordinal 3 == "third"
--   ordinal 11 == "11th"
--   ordinal 42 == "42nd"
--   
ordinal :: Int -> Text

-- | Heuristics for English plural for an unknown noun.
--   
--   
--   defaultNounPlural "egg"    == "eggs"
--   defaultNounPlural "patch"  == "patches"
--   defaultNounPlural "boy"    == "boys"
--   defaultNounPlural "spy"    == "spies"
--   defaultNounPlural "thesis" == "theses"
--   
--   
--   
--   http://www.paulnoll.com/Books/Clear-English/English-plurals-1.html
--   
--   http://en.wikipedia.org/wiki/English_plural
defaultNounPlural :: Text -> Text

-- | Heuristics for 3rd person singular and past participle for an unknown
--   regular verb. Doubling of final consonants can be handled via a table
--   of (partially) irregular verbs.
--   
--   
--   defaultVerbStuff "walk"  == ("walks",  "walked")
--   defaultVerbStuff "push"  == ("pushes", "pushed")
--   defaultVerbStuff "play"  == ("plays",  "played")
--   defaultVerbStuff "cry"   == ("cries",  "cried")
--   
defaultVerbStuff :: Text -> (Text, Text)

-- | Heuristics for a possesive form for an unknown noun.
--   
--   
--   defaultPossesive "pass"        == "pass'"
--   defaultPossesive "SOS"         == "SOS'"
--   defaultPossesive "Mr Blinkin'" == "Mr Blinkin's"
--   defaultPossesive "cry"         == "cry's"
--   
defaultPossesive :: Text -> Text
anNumerals :: [Text]

-- | 
--   indefiniteDet "dog"  == "a"
--   indefiniteDet "egg"  == "an"
--   indefiniteDet "ewe"  == "a"
--   indefiniteDet "ewok" == "an"
--   indefiniteDet "8th"  == "an"
--   
indefiniteDet :: Text -> Text

-- | True if the indefinite determiner for a word would normally be 'an' as
--   opposed to 'a'.
wantsAn :: Text -> Bool

-- | Variant of wantsAn that assumes the input string is pronounced
--   one letter at a time.
--   
--   
--   wantsAn        "x-ray" == False
--   acronymWantsAn "x-ray" == True
--   
--   
--   Note that this won't do the right thing for words like "SCUBA". You
--   really have to reserve it for those separate-letter acronyms.
acronymWantsAn :: Text -> Bool

-- | True if all upper case from second letter and up.
--   
--   
--   looksLikeAcronym "DNA"  == True
--   looksLikeAcronym "tRNA" == True
--   looksLikeAcronym "x"    == False
--   looksLikeAcronym "DnA"  == False
--   
looksLikeAcronym :: Text -> Bool

-- | True if the first word (separating on either hyphen or space) looks
--   like an acronym.
startsWithAcronym :: Text -> Bool

-- | Ends with a 'sh' sound.
hasSibilantSuffix :: Text -> Bool

-- | Starts with a semivowel.
hasSemivowelPrefix :: Text -> Bool

-- | Starts with a vowel-y 'U' sound
hasVowel_U_Prefix :: Text -> Bool

-- | Last two letters are a consonant and 'y'.
hasCySuffix :: Text -> Bool

-- | Last two letters are a consonant and 'o'.
hasCoSuffix :: Text -> Bool

-- | Is a vowel.
isVowel :: Char -> Bool

-- | Letters that when pronounced independently in English sound like they
--   begin with vowels.
--   
--   
--   isLetterWithInitialVowelSound 'r' == True
--   isLetterWithInitialVowelSound 'k' == False
--   
--   
--   (In the above, 'r' is pronounced "are", but 'k' is pronounced "kay".)
isLetterWithInitialVowelSound :: Char -> Bool

-- | Is a consonant.
isConsonant :: Char -> Bool
