| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Language.Drasil.NounPhrase
Synopsis
- class NounPhrase n where
- phraseNP :: n -> NPStruct
- pluralNP :: n -> PluralForm
- sentenceCase :: n -> (NP -> NPStruct) -> Capitalization
- titleCase :: n -> (NP -> NPStruct) -> 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'' :: NPStruct -> PluralForm -> CapitalizationRule -> CapitalizationRule -> NP
- nounPhraseSP :: String -> NP
- nounPhraseSent :: NPStruct -> NP
- compoundPhrase :: (NounPhrase a, NounPhrase b) => a -> b -> NP
- compoundPhrase' :: NP -> NP -> NP
- compoundPhrase'' :: (NP -> NPStruct) -> (NP -> NPStruct) -> NP -> NP -> NP
- compoundPhrase''' :: (NP -> NPStruct) -> NP -> NP -> NP
- compoundPhraseP1 :: NP -> NP -> NP
- surroundNPStruct :: String -> String -> NPStruct -> NPStruct
- data CapitalizationRule
- data PluralRule
- data NPStruct
Types
class NounPhrase n where Source #
Methods
phraseNP :: n -> NPStruct 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 -> NPStruct) -> Capitalization Source #
Retrieves the singular form and applies a captalization rule (usually capitalizes the first word) to produce a 'NPStruct. Ex. "The quick brown fox".
titleCase :: n -> (NP -> NPStruct) -> Capitalization Source #
Retrieves the singular form and applies a captalization rule (usually capitalizes all words) to produce a 'NPStruct. Ex. "The Quick Brown Fox".
For nouns and NounPhrases. 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'' :: NPStruct -> PluralForm -> CapitalizationRule -> CapitalizationRule -> NP Source #
Custom noun phrase constructor that takes a singular form ('NPStruct), plural form ('NPStruct), sentence case capitalization rule, and title case capitalization rule.
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 :: NPStruct -> NP Source #
Similar to nounPhrase, except it only accepts one 'NPStruct.
Plural case is just AddS.
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 -> NPStruct) -> (NP -> NPStruct) -> 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 -> NPStruct) -> 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.
Constructors
| CapFirst | Capitalize the first letter of the first word only. |
| CapWords | Capitalize the first letter of each word. |
| Replace NPStruct | Replace the noun phrase with the given 'NPStruct. Used for custom capitalization. |
| CapNothing |
data PluralRule Source #
Pluralization rules.