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

Description

Defines various NounPhrase-level combinators. These hold more information than those of the Sentence level but may not necessarily have a conceptual link. See the Wiki for more information and details about the naming process for combinators. A summary of the function naming scheme is as follows:

  • Combinators that conflict with haskell-native functions have an underscore appended.
  • Default plural case for combinators will be first term singular, second term plural.
  • P and S denote the plural case of the combinator when it does not follow the above default.
  • Gen denotes the general function case.

This module should be used as a qualified import (usually as NP), as many function names clash with those in Concepts.hs and Sentence.hs.

Synopsis

General Combinator Helper Functions

insertString :: String -> NP -> NP -> NP Source #

Helper function that places a String in between two NPs. Plural case is (phraseNP t1) :+: S s :+: (pluralNP t2).

prependString :: String -> NP -> NP Source #

Helper function that prepends a String to a NP.

insertStringOp :: String -> NP -> NP -> NP Source #

Helper function that places a String in between two NPs. Plural case is (pluralNP t1) :+: S s :+: (phraseNP t2), i.e. opposite of insertString

insertStringGen :: String -> (NP -> NPStruct) -> (NP -> NPStruct) -> NP -> NP -> NP Source #

Helper function that places a String in between two NPs. Plural case is given by two generic functions.

Prepositions

"The" Combinators

the :: NP -> NP Source #

Prepends "the" to a NP.

theGen :: (NP -> NPStruct) -> NP -> NP Source #

Similar to the, but accepts a function that determines the plural case.

"A" Combinators

a_ :: NP -> NP Source #

Prepends "a" to a NP.

a_Gen :: (NP -> NPStruct) -> NP -> NP Source #

Similar to a, but accepts a function that determines the plural case.

Conjunctions

"And" Combinators

and_ :: NP -> NP -> NP Source #

Inserts "and" between two NPs. Plural case is (phraseNP t1) :+: "and" :+: (pluralNP t2).

and_PS :: NP -> NP -> NP Source #

Same as and_, but plural case is now (pluralNP t1) and_ (phraseNP t2).

and_Gen :: (NP -> NPStruct) -> (NP -> NPStruct) -> NP -> NP -> NP Source #

Same as and_, but takes two functions for the plural case.

andThe :: NP -> NP -> NP Source #

Inserts "and the" between two NPs. Plural case is (phraseNP t1) :+: "and the" :+: (pluralNP t2).

"The" Combinators

ofThe :: NP -> NP -> NP Source #

Inserts "of the" between two NPs. Plural case is (phraseNP t1) :+: "of the" :+: (pluralNP t2).

ofThePS :: NP -> NP -> NP Source #

Similar to ofThe, but the plural case is now (pluralNP t1) ofThe (phraseNP t2).

ofTheGen :: (NP -> NPStruct) -> (NP -> NPStruct) -> NP -> NP -> NP Source #

Similar to ofThe, but accepts two functions for the plural case.

inThe :: NP -> NP -> NP Source #

Inserts "in the" between two NPs. Plural case is (phraseNP t1) :+: "in the" :+: (pluralNP t2).

inThePS :: NP -> NP -> NP Source #

Similar to ofThe, but the plural case is now (pluralNP t1) inThe (phraseNP t2).

inTheGen :: (NP -> NPStruct) -> (NP -> NPStruct) -> NP -> NP -> NP Source #

Similar to ofThe, but accepts two functions for the plural case.

the_ofThe :: NP -> NP -> NP Source #

Prepends "the" and inserts "of the". Plural case is "the" :+: (phraseNP t1) :+: "of the" :+: (pluralNP t2).

the_ofThePS :: NP -> NP -> NP Source #

Similar to the_ofThe, but the plural case is now S "the" :+: (pluralNP t1) ofThe (phraseNP t2).

the_ofTheGen :: (NP -> NPStruct) -> (NP -> NPStruct) -> NP -> NP -> NP Source #

Similar to the_ofThe', but takes two functions for the plural case.

"For" Combinators

for :: NP -> NP -> NP Source #

Inserts "for" between two NPs. Plural case is (phraseNP t1) :+: "for" :+: (pluralNP t2).

forPS :: NP -> NP -> NP Source #

Same as for, but plural case is now (pluralNP t1) for (phraseNP t2).

forGen :: (NP -> NPStruct) -> (NP -> NPStruct) -> NP -> NP -> NP Source #

Same as for', but takes two functions for the plural case.

"Of" Combinators

of_ :: NP -> NP -> NP Source #

Inserts "of" between two NPs. Plural case is (phraseNP t1) :+: "of" :+: (pluralNP t2).

of_PS :: NP -> NP -> NP Source #

Same as of_, but plural case is now (pluralNP t1) of_ (phraseNP t2).

of_Gen :: (NP -> NPStruct) -> (NP -> NPStruct) -> NP -> NP -> NP Source #

Same as of_, but takes two functions for the plural case.

Other Combinators

with :: NP -> NP -> NP Source #

Inserts "with" between two NPs. Plural case is (phraseNP t1) :+: "with" :+: (pluralNP t2).

parensNP :: NP -> NP Source #

Puts parentheses around a word; to be used as a kind of postfix qualifier

data NPStruct Source #

Essentially a subset of Sentence that contains only the parts that make sense for a NounPhrase

Constructors

S String 
NPStruct :+: NPStruct 
P Symbol