drasil-natural-language-0.1.0.0: A framework for code and document generation for scientific software - Natural Language SubPackage
Safe HaskellNone
LanguageGHC2024

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 

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.

Instances

Instances details
HasChunkRefs (NPG a) Source #

Gather the chunk references mentioned within an NP.

Instance details

Defined in Drasil.NaturalLanguage.English.NounPhrase.Core

Methods

chunkRefs :: NPG a -> Set UID #

NounPhrase (NPG a) a 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 Drasil.NaturalLanguage.English.NounPhrase

Methods

phraseNP :: NPG a -> NPStructG a Source #

pluralNP :: NPG a -> PluralFormG a Source #

sentenceCase :: NPG a -> (NPG a -> NPStructG a) -> Capitalization a Source #

titleCase :: NPG a -> (NPG a -> NPStructG a) -> Capitalization a Source #

type PluralFormG a = NPStructG a Source #

Synonym for NPStructG typically used for plural forms.

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 

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