| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Language.Drasil.NaturalLanguage.English.NounPhrase
Synopsis
- class NounPhrase n a | n -> a where
- phraseNP :: n -> NPStructG a
- pluralNP :: n -> PluralFormG a
- sentenceCase :: n -> (n -> NPStructG a) -> Capitalization a
- titleCase :: n -> (n -> NPStructG a) -> Capitalization a
- type NP = NPG Symbol
- atStartNP :: NounPhrase n a => n -> Capitalization a
- atStartNP' :: NounPhrase n a => n -> Capitalization a
- titleizeNP :: NounPhrase n a => n -> Capitalization a
- titleizeNP' :: NounPhrase n a => n -> Capitalization a
- cn :: String -> NPG a
- cn' :: String -> NPG a
- cn'' :: String -> NPG a
- cn''' :: String -> NPG a
- cnICES :: String -> NPG a
- cnIES :: String -> NPG a
- cnIP :: String -> PluralRule -> NPG a
- cnIS :: String -> NPG a
- cnIrr :: String -> PluralRule -> CapitalizationRuleG a -> NPG a
- cnUM :: String -> NPG a
- pn :: String -> NPG a
- pn' :: String -> NPG a
- pn'' :: String -> NPG a
- pn''' :: String -> NPG a
- pnIrr :: String -> PluralRule -> NPG a
- nounPhrase :: String -> PluralString -> NPG a
- nounPhrase' :: String -> PluralString -> CapitalizationRuleG a -> NPG a
- nounPhrase'' :: NPStructG a -> PluralFormG a -> CapitalizationRuleG a -> CapitalizationRuleG a -> NPG a
- nounPhraseSP :: String -> NPG a
- nounPhraseSent :: NPStructG a -> NPG a
- compoundPhrase :: (NounPhrase ta a, NounPhrase tb a) => ta -> tb -> NPG a
- compoundPhrase' :: NPG a -> NPG a -> NPG a
- compoundPhrase'' :: (NPG a -> NPStructG a) -> (NPG a -> NPStructG a) -> NPG a -> NPG a -> NPG a
- compoundPhrase''' :: (NPG a -> NPStructG a) -> NPG a -> NPG a -> NPG a
- compoundPhraseP1 :: NPG a -> NPG a -> NPG a
- surroundNPStruct :: String -> String -> NPStructG a -> NPStructG a
- data CapitalizationRuleG a
- = CapFirst
- | CapWords
- | Replace (NPStructG a)
- | CapNothing
- type CapitalizationRule = CapitalizationRuleG Symbol
- data PluralRule
- type NPStruct = NPStructG Symbol
- type PluralForm = PluralFormG Symbol
- data NPG a
- data NPStructG a
- npS :: String -> NPStructG a
- npP :: a -> NPStructG a
- (.-.) :: NPStructG a -> NPStructG a -> NPStructG a
- (.+.) :: NPStructG a -> NPStructG a -> NPStructG a
Types
class NounPhrase n a | n -> a where #
Methods
phraseNP :: n -> NPStructG a #
Retrieves singular form of term. Ex. "the quick brown fox".
pluralNP :: n -> PluralFormG a #
Retrieves plural form of term. Ex. "the quick brown foxes".
sentenceCase :: n -> (n -> NPStructG a) -> Capitalization a #
Retrieves the singular form and applies a captalization
rule (usually capitalizes the first word) to produce a NPStructG.
Ex. "The quick brown fox".
titleCase :: n -> (n -> NPStructG a) -> Capitalization a #
Retrieves the singular form and applies a captalization
rule (usually capitalizes all words) to produce a NPStructG.
Ex. "The Quick Brown Fox".
Instances
| NounPhrase (NPG a) a | Defines NP as a NounPhrase.
Default capitalization rules for proper and common nouns
are |
Phrase Accessors
atStartNP :: NounPhrase n a => n -> Capitalization a #
Helper function for getting the sentence case of a noun phrase.
Singular sentence case.
atStartNP' :: NounPhrase n a => n -> Capitalization a #
Helper function for getting the sentence case of a noun phrase.
Plural sentence case.
titleizeNP :: NounPhrase n a => n -> Capitalization a #
Helper function for getting the title case of a noun phrase.
Singular title case.
titleizeNP' :: NounPhrase n a => n -> Capitalization a #
Helper function for getting the title case of a noun phrase.
Plural title case.
Constructors
Common Noun Constructors
Constructs a common noun which capitalizes the first letter of the first word at the beginning of a sentence.
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.
Plural form adds "es" (ex. bush -> bushes).
Construct a common noun that pluralizes by dropping the last two letters and adding an "ices" ending (ex. matrix -> matrices).
Constructs a common noun that pluralizes by dropping the last letter and adding an "ies" ending (ex. body -> bodies).
cnIP :: String -> PluralRule -> NPG a #
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 -> CapitalizationRuleG a -> NPG a #
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
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.
Plural form adds "es" (ex. Bush -> Bushes).
pnIrr :: String -> PluralRule -> NPG a #
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 -> NPG a #
nounPhrase' :: String -> PluralString -> CapitalizationRuleG a -> NPG a #
Similar to nounPhrase, but takes a specified capitalization rule for the sentence case.
nounPhrase'' :: NPStructG a -> PluralFormG a -> CapitalizationRuleG a -> CapitalizationRuleG a -> NPG a #
nounPhraseSP :: String -> NPG a #
For things that should not be pluralized (or are self-plural). Works like nounPhrase, but with
only the first argument.
nounPhraseSent :: NPStructG a -> NPG a #
Combinators
compoundPhrase :: (NounPhrase ta a, NounPhrase tb a) => ta -> tb -> NPG a #
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' :: NPG a -> NPG a -> NPG a #
Similar to compoundPhrase, but the sentence case is the same
as the title case (CapWords).
compoundPhrase'' :: (NPG a -> NPStructG a) -> (NPG a -> NPStructG a) -> NPG a -> NPG a -> NPG a #
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''' :: (NPG a -> NPStructG a) -> NPG a -> NPG a -> NPG a #
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 :: NPG a -> NPG a -> NPG a #
Similar to compoundPhrase, but pluralizes the first NPG for both singular and plural cases.
Re-exported Types
data CapitalizationRuleG a #
Capitalization rules.
Constructors
| CapFirst | Capitalize the first letter of the first word only. |
| CapWords | Capitalize the first letter of each word. |
| Replace (NPStructG a) | Replace the noun phrase with the given
|
| CapNothing |
type CapitalizationRule = CapitalizationRuleG Symbol Source #
CapitalizationRuleG filled with a Symbol the version used outside this file.
data PluralRule #
Pluralization rules.
type PluralForm = PluralFormG Symbol Source #
PluralFormG filled with a Symbol the version used outside this file.
For nouns and NounPhrases. May be constructed from a
proper noun, common noun, or phrase (Sentence) and their
respective pluralization and capitalization rules.
Instances
| HasChunkRefs (NPG a) | Gather the chunk references mentioned within an |
| NounPhrase (NPG a) a | Defines NP as a NounPhrase.
Default capitalization rules for proper and common nouns
are |