drasil-lang-0.1.60.0: A framework for code and document generation for scientific software - Language SubPackage
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.Drasil.NounPhrase.Core

Contents

Description

Noun phrases are used to hold terms with knowledge of proper capitalization and pluralization.

Synopsis

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 Sentence

Replace the noun phrase with the given Sentence. Used for custom capitalization.

data NP 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 CapitalizationRule

Stores a common noun and its pluralization.

Phrase Sentence PluralForm CapitalizationRule CapitalizationRule

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.NounPhrase

Methods

phraseNP :: NP -> Sentence Source #

pluralNP :: NP -> PluralForm Source #

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

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

type PluralForm = Sentence Source #

Synonym for Sentence 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.