-- 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
--   <a>https://github.com/Mikolaj/miniutter</a> for a simple use case.
@package minimorph
@version 0.3.0.1

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.Classes.Eq a => GHC.Classes.Eq (NLP.Minimorph.Number.SingPlu a)
instance GHC.Show.Show a => GHC.Show.Show (NLP.Minimorph.Number.SingPlu a)
instance GHC.Show.Show NLP.Minimorph.Number.Number
instance GHC.Classes.Eq NLP.Minimorph.Number.Number


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

-- | Separated by space unless one of them is empty (in which case just the
--   non-empty one) or the first ends or the last begins with whitespace.
(<+>) :: Text -> Text -> Text
infixr 6 <+>

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


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

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

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

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

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

-- | Heuristics for English plural for an unknown noun.
--   
--   <pre>
--   defaultNounPlural "egg"    == "eggs"
--   defaultNounPlural "patch"  == "patches"
--   defaultNounPlural "boy"    == "boys"
--   defaultNounPlural "spy"    == "spies"
--   defaultNounPlural "thesis" == "theses"
--   </pre>
--   
--   
--   <a>http://www.paulnoll.com/Books/Clear-English/English-plurals-1.html</a>
--   
--   <a>http://en.wikipedia.org/wiki/English_plural</a>
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.
--   
--   <pre>
--   defaultVerbStuff "walk"  == ("walks",  "walked")
--   defaultVerbStuff "push"  == ("pushes", "pushed")
--   defaultVerbStuff "play"  == ("plays",  "played")
--   defaultVerbStuff "cry"   == ("cries",  "cried")
--   </pre>
defaultVerbStuff :: Text -> (Text, Text)

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

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

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

-- | Variant of <a>wantsAn</a> that assumes the input string is pronounced
--   one letter at a time.
--   
--   <pre>
--   wantsAn        "x-ray" == False
--   acronymWantsAn "x-ray" == True
--   </pre>
--   
--   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.
--   
--   <pre>
--   looksLikeAcronym "DNA"  == True
--   looksLikeAcronym "tRNA" == True
--   looksLikeAcronym "x"    == False
--   looksLikeAcronym "DnA"  == False
--   </pre>
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.
--   
--   <pre>
--   isLetterWithInitialVowelSound 'r' == True
--   isLetterWithInitialVowelSound 'k' == False
--   </pre>
--   
--   (In the above, 'r' is pronounced "are", but 'k' is pronounced "kay".)
isLetterWithInitialVowelSound :: Char -> Bool

-- | Is a consonant.
--   
--   Note that not every <a>Char</a> is either a vowel or a consonant. We
--   consider numbers, spaces and symbols to be neither vowel or consonants
isConsonant :: Char -> Bool
