Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- class NounPhrase n where
- phraseNP :: n -> Sentence
- pluralNP :: n -> PluralForm
- sentenceCase :: n -> (NP -> Sentence) -> Capitalization
- titleCase :: n -> (NP -> Sentence) -> Capitalization
- data NP
- atStartNP :: NounPhrase n => n -> Capitalization
- atStartNP' :: NounPhrase n => n -> Capitalization
- titleizeNP :: NounPhrase n => n -> Capitalization
- titleizeNP' :: NounPhrase n => n -> Capitalization
- cn :: String -> NP
- cn' :: String -> NP
- cn'' :: String -> NP
- cn''' :: String -> NP
- cnICES :: String -> NP
- cnIES :: String -> NP
- cnIP :: String -> PluralRule -> NP
- cnIS :: String -> NP
- cnIrr :: String -> PluralRule -> CapitalizationRule -> NP
- cnUM :: String -> NP
- pn :: String -> NP
- pn' :: String -> NP
- pn'' :: String -> NP
- pn''' :: String -> NP
- pnIrr :: String -> PluralRule -> NP
- nounPhrase :: String -> PluralString -> NP
- nounPhrase' :: String -> PluralString -> CapitalizationRule -> NP
- nounPhrase'' :: Sentence -> PluralForm -> CapitalizationRule -> CapitalizationRule -> NP
- nounPhraseSP :: String -> NP
- nounPhraseSent :: Sentence -> NP
- compoundPhrase :: (NounPhrase a, NounPhrase b) => a -> b -> NP
- compoundPhrase' :: NP -> NP -> NP
- compoundPhrase'' :: (NP -> Sentence) -> (NP -> Sentence) -> NP -> NP -> NP
- compoundPhrase''' :: (NP -> Sentence) -> NP -> NP -> NP
- compoundPhraseP1 :: NP -> NP -> NP
- data CapitalizationRule
- data PluralRule
Types
class NounPhrase n where Source #
phraseNP :: n -> Sentence Source #
Retrieves singular form of term. Ex. "the quick brown fox".
pluralNP :: n -> PluralForm Source #
Retrieves plural form of term. Ex. "the quick brown foxes".
sentenceCase :: n -> (NP -> Sentence) -> Capitalization Source #
Retrieves the singular form and applies a captalization
rule (usually capitalizes the first word) to produce a Sentence
.
Ex. "The quick brown fox".
titleCase :: n -> (NP -> Sentence) -> Capitalization Source #
Retrieves the singular form and applies a captalization
rule (usually capitalizes all words) to produce a Sentence
.
Ex. "The Quick Brown Fox".
For nouns and NounPhrase
s. May be constructed from a
proper noun, common noun, or phrase (Sentence
) and their
respective pluralization and capitalization rules.
Phrase Accessors
atStartNP :: NounPhrase n => n -> Capitalization Source #
Singular sentence case.
Helper function for getting the sentence case of a noun phrase.
atStartNP' :: NounPhrase n => n -> Capitalization Source #
Plural sentence case.
Helper function for getting the sentence case of a noun phrase.
titleizeNP :: NounPhrase n => n -> Capitalization Source #
Singular title case.
Helper function for getting the title case of a noun phrase.
titleizeNP' :: NounPhrase n => n -> Capitalization Source #
Plural title case.
Helper function for getting the title case of a noun phrase.
Constructors
Common Noun Constructors
Self plural.
Constructs a common noun which capitalizes the first letter of the first word at the beginning of a sentence.
Plural form simply adds "s" (ex. dog -> dogs).
Constructs a common noun which capitalizes the first letter of the first word at the beginning of a sentence.
Plural form adds "e" (ex. formula -> formulae).
Constructs a common noun which capitalizes the first letter of the first word at the beginning of a sentence.
cn''' :: String -> NP Source #
Plural form adds "es" (ex. bush -> bushes).
Constructs a common noun which capitalizes the first letter of the first word at the beginning of a sentence.
cnICES :: String -> NP Source #
Construct a common noun that pluralizes by dropping the last two letters and adding an "ices" ending (ex. matrix -> matrices).
cnIES :: String -> NP Source #
Constructs a common noun that pluralizes by dropping the last letter and adding an "ies" ending (ex. body -> bodies).
cnIP :: String -> PluralRule -> NP Source #
Constructs a common noun that allows you to specify the pluralization rule
(as in pnIrr
).
Constructs a common noun that pluralizes by dropping the last two letters and adding "es" (ex. analysis -> analyses).
cnIrr :: String -> PluralRule -> CapitalizationRule -> NP Source #
Common noun that allows you to specify both the pluralization rule and the capitalization rule for sentence case (if the noun is used at the beginning of a sentence).
Constructs a common noun that pluralizes by dropping the last two letters and adding "a" (ex. datum -> data).
Proper Noun Constructors
Self plural.
Constructs a Proper Noun, it is always capitalized as written.
Plural form simply adds "s" (ex. Henderson -> Hendersons).
Constructs a Proper Noun, it is always capitalized as written.
Plural form adds "e".
Constructs a Proper Noun, it is always capitalized as written.
pn''' :: String -> NP Source #
Plural form adds "es" (ex. Bush -> Bushes).
Constructs a Proper Noun, it is always capitalized as written.
pnIrr :: String -> PluralRule -> NP Source #
Constructs a ProperNoun
with a custom plural rule (using IrregPlur
from PluralRule
).
First argument is the String representing the noun, second is the rule.
Noun Phrase Constructors
nounPhrase :: String -> PluralString -> NP Source #
nounPhrase' :: String -> PluralString -> CapitalizationRule -> NP Source #
Similar to nounPhrase
, but takes a specified capitalization rule for the sentence case.
nounPhrase'' :: Sentence -> PluralForm -> CapitalizationRule -> CapitalizationRule -> NP Source #
nounPhraseSP :: String -> NP Source #
For things that should not be pluralized (or are self-plural). Works like nounPhrase
, but with
only the first argument.
nounPhraseSent :: Sentence -> NP Source #
Combinators
compoundPhrase :: (NounPhrase a, NounPhrase b) => a -> b -> NP Source #
Combine two noun phrases. The singular form becomes phrase
from t1 followed
by phrase
of t2. The plural becomes phrase
of t1 followed by plural
of t2.
Uses standard CapFirst
sentence case and CapWords
title case.
For example: compoundPhrase system constraint
will have singular form
"system constraint" and plural "system constraints".
compoundPhrase' :: NP -> NP -> NP Source #
Similar to compoundPhrase
, but the sentence case is the same
as the title case (CapWords
).
compoundPhrase'' :: (NP -> Sentence) -> (NP -> Sentence) -> NP -> NP -> NP Source #
Similar to compoundPhrase'
, but accepts two functions that will be used to
construct the plural form. For example,
compoundPhrase'' plural phrase system constraint
would have the plural
form "systems constraint".
compoundPhrase''' :: (NP -> Sentence) -> NP -> NP -> NP Source #
Similar to compoundPhrase
, but used when you need a special function applied
to the first term of both singular and pluralcases (eg. short or plural).
compoundPhraseP1 :: NP -> NP -> NP Source #
Similar to compoundPhrase
, but pluralizes the first NP
for both singular and plural cases.
Re-exported Types
data CapitalizationRule Source #
Capitalization rules.
data PluralRule Source #
Pluralization rules.