| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
NLP.Miniutter.English
Description
Simple English clause creation parameterized by individual words. See the tests for example texts generated.
Synopsis
- data Part
- = String !String
- | Text !Text
- | Cardinal !Int
- | Car !Int
- | Ws !Part
- | CardinalAWs !Int !Part
- | CardinalWs !Int !Part
- | CarAWs !Int !Part
- | CarWs !Int !Part
- | Car1Ws !Int !Part
- | Ordinal !Int
- | Ord !Int
- | AW !Part
- | WWandW ![Part]
- | WWxW !Part ![Part]
- | Wown !Part
- | WownW !Part !Part
- | Append !Part !Part
- | Phrase ![Part]
- | Capitalize !Part
- | SubjectVerb !Person !Polarity !Part !Part
- | SubjectVerbSg !Part !Part
- | SubjectVVxV !Part !Person !Polarity !Part ![Part]
- | SubjectVVandVSg !Part ![Part]
- data Person
- data Polarity
- data Irregular = Irregular {}
- makeSentence :: Irregular -> [Part] -> Text
- makePhrase :: Irregular -> [Part] -> Text
- defIrregular :: Irregular
- (<+>) :: Text -> Text -> Text
Documentation
Various basic and compound parts of English simple present tense clauses. Many of the possible nestings do not make sense. We don't care.
Constructors
| String !String | handle for a |
| Text !Text | handle for a |
| Cardinal !Int | cardinal number, spelled in full up to 10 |
| Car !Int | cardinal number, not spelled |
| Ws !Part | plural form of a phrase |
| CardinalAWs !Int !Part | plural prefixed with a cardinal, spelled, with "a" for 1 and "no" for 0 |
| CardinalWs !Int !Part | plural prefixed with a cardinal, spelled |
| CarAWs !Int !Part | plural prefixed with a cardinal, not spelled, with "a" for 1 and "no" for 0 |
| CarWs !Int !Part | plural prefixed with a cardinal, not spelled |
| Car1Ws !Int !Part | plural prefixed with a cardinal, not spelled, with no prefix at all for 1 |
| Ordinal !Int | ordinal number, spelled in full up to 10 |
| Ord !Int | ordinal number, not spelled |
| AW !Part | phrase with indefinite article |
| WWandW ![Part] | enumeration |
| WWxW !Part ![Part] | collection |
| Wown !Part | non-premodifying possesive |
| WownW !Part !Part | attributive possesive |
| Append !Part !Part | no space in between; one can also just use |
| Phrase ![Part] | space-separated sequence |
| Capitalize !Part | make the first letter into a capital letter |
| SubjectVerb !Person !Polarity !Part !Part | conjugation according to polarity, with a default person (pronouns override it) |
| SubjectVerbSg !Part !Part | a shorthand for |
| SubjectVVxV !Part !Person !Polarity !Part ![Part] | conjugation of all verbs according to polarity, with a default person (pronouns override it) |
| SubjectVVandVSg !Part ![Part] | a shorthand for "and", |
Instances
Persons: singular 1st, singular 3rd and the rest.
Instances
| Eq Person Source # | |
| Ord Person Source # | |
| Show Person Source # | |
| Generic Person Source # | |
| Binary Person Source # | |
| type Rep Person Source # | |
Defined in NLP.Miniutter.English type Rep Person = D1 ('MetaData "Person" "NLP.Miniutter.English" "miniutter-0.5.1.2-OSOKrfxwDa5hbEd4pp0zO" 'False) (C1 ('MetaCons "Sg1st" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "Sg3rd" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PlEtc" 'PrefixI 'False) (U1 :: Type -> Type))) | |
Generalized polarity: affirmative, negative, interrogative.
Instances
| Eq Polarity Source # | |
| Ord Polarity Source # | |
Defined in NLP.Miniutter.English | |
| Show Polarity Source # | |
| Generic Polarity Source # | |
| Binary Polarity Source # | |
| type Rep Polarity Source # | |
Defined in NLP.Miniutter.English type Rep Polarity = D1 ('MetaData "Polarity" "NLP.Miniutter.English" "miniutter-0.5.1.2-OSOKrfxwDa5hbEd4pp0zO" 'False) (C1 ('MetaCons "Yes" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "No" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Why" 'PrefixI 'False) (U1 :: Type -> Type))) | |
Nouns with irregular plural form and nouns with irregular indefinite article.
makeSentence :: Irregular -> [Part] -> Text Source #
Realise a complete sentence, capitalized, ending with a dot.
makePhrase :: Irregular -> [Part] -> Text Source #
Realise a phrase. The spacing between parts resembles
the semantics of (<+>), that is, it ignores empty words.
defIrregular :: Irregular Source #
Default set of words with irregular forms.