alex.components.nlg.tools package

Submodules

alex.components.nlg.tools.cs module

A collection of helper functions for generating Czech.

class alex.components.nlg.tools.cs.CzechTemplateNLGPostprocessing[source]

Bases: alex.components.nlg.template.TemplateNLGPostprocessing

Postprocessing filled in NLG templates for Czech.

Currently, this class only handles preposition vocalization.

postprocess(nlg_text)[source]
vocalize_prepos(text)[source]

Vocalize prepositions in the utterance, i.e. ‘k’, ‘v’, ‘z’, ‘s’ are changed to ‘ke’, ‘ve’, ‘ze’, ‘se’ if appropriate given the following word.

This is mainly needed for time expressions, e.g. “v jednu hodinu” (at 1:00), but “ve dvě hodiny” (at 2:00).

alex.components.nlg.tools.cs.vocalize_prep(prep, following_word)[source]

Given a base for of a preposition and the form of the word following it, return the appropriate form (base or vocalized).

Case insensitive; however, the returned vocalization is always lowercase.

alex.components.nlg.tools.cs.word_for_number(number, categ=u'M1')[source]

Returns a word given a number 1-100 (in the given gender + case). Gender (M, I, F, N) and case (1-7) are given concatenated.

alex.components.nlg.tools.en module

A collection of helper functions for generating English.

alex.components.nlg.tools.en.every_word_for_number(number, ordinary=False, use_coupling=False)[source]
params: ordinary - if set to True, it returns ordinal of the number (fifth rather than five etc).
use_coupling if set to True, it returns number greater than 100 with “and” between hundreds and tens
(two hundred and seventeen rather than two hundred seventeen).

Returns a word given a number 1-100

alex.components.nlg.tools.en.word_for_number(number, ordinary=False)[source]

Returns a word given a number 1-100

Module contents