drasil-lang-0.1.60.0: A framework for code and document generation for scientific software - Language SubPackage
Safe HaskellNone
LanguageGHC2024

Language.Drasil.NaturalLanguage.English.NounPhrase.Core

Contents

Description

Basic data types for noun phrases.

Synopsis

Types

data CapitalizationRuleG a Source #

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 NPStruct. Used for custom capitalization.

CapNothing 

type CapitalizationRule = CapitalizationRuleG Symbol Source #

CapitalizationRuleG filled with a Symbol the version used outside the file.

data NPG a Source #

For nouns and NounPhrases. May be constructed from a proper noun, common noun, or phrase (Sentence) and their respective pluralization and capitalization rules.

Constructors

ProperNoun String PluralRule

Stores a proper noun and its pluralization.

CommonNoun String PluralRule (CapitalizationRuleG a)

Stores a common noun and its pluralization.

Phrase (NPStructG a) (PluralFormG a) (CapitalizationRuleG a) (CapitalizationRuleG a)

Stores noun phrase and its pluralization. Phrase plurals can get very odd, so it seems best (for now) to encode them directly. FIXME: If the singular/plural phrase has special (replace) capitalization, one of the two cannot be capitalized right now. The two capitalization rules are for sentenceCase / titleCase respectively

Instances

Instances details
NounPhrase NP Source #

Defines NP as a NounPhrase. Default capitalization rules for proper and common nouns are CapFirst for sentence case and CapWords for title case. Also accepts a Phrase where the capitalization case may be specified.

Instance details

Defined in Language.Drasil.NaturalLanguage.English.NounPhrase

Methods

phraseNP :: NP -> NPStruct Source #

pluralNP :: NP -> PluralForm Source #

sentenceCase :: NP -> (NP -> NPStruct) -> Capitalization Source #

titleCase :: NP -> (NP -> NPStruct) -> Capitalization Source #

HasChunkRefs (NPG a) Source #

Gather the chunk references mentioned within an NP.

Instance details

Defined in Language.Drasil.NaturalLanguage.English.NounPhrase.Core

Methods

chunkRefs :: NPG a -> Set UID #

type NP = NPG Symbol Source #

NPG filled with a Symbol the version used outside the file.

type PluralFormG a = NPStructG a Source #

Synonym for NPStructG typically used for plural forms.

type PluralForm = PluralFormG Symbol Source #

PluralFormG filled with a Symbol the version used outside the file.

data PluralRule Source #

Pluralization rules.

Constructors

AddS

Add "s" to the end of the noun phrase.

AddE

Add "e" to the end of the noun phrase.

AddES

Add "es" to the end of the noun phrase.

SelfPlur

The noun phrase is already plural.

IrregPlur (String -> String)

Apply the given function to the noun phrase to get the plural.

data NPStructG a Source #

Essentially a subset of Sentence that contains only the parts that make sense for a NounPhrase use smart constructor here instead s, p, .-., .+.

Constructors

SC String 
(NPStructG a) :-!: (NPStructG a) 
(NPStructG a) :+!: (NPStructG a) 
PC a 

type NPStruct = NPStructG Symbol Source #

Synonym for NPStructG filled with a Symbol the version used outside the file.

smart constructors

npS :: String -> NPStructG a Source #

smart constructor for a literal string

npP :: a -> NPStructG a Source #

smart constructor for a literal string

(.-.) :: NPStructG a -> NPStructG a -> NPStructG a Source #

smart constructor: join two NPStructGs with no space in between

(.+.) :: NPStructG a -> NPStructG a -> NPStructG a Source #

smart constructor: join two NPStructGs with a space in between