alex.components.nlg.tectotpl.block.util package

Submodules

alex.components.nlg.tectotpl.block.util.copytree module

class alex.components.nlg.tectotpl.block.util.copytree.CopyTree(scenario, args)[source]

Bases: alex.components.nlg.tectotpl.core.block.Block

This block is able to copy a tree on the same layer from a different zone.

Arguments:
language: the language of the TARGET zone selector: the selector of the TARGET zone source_language the language of the SOURCE zone (defaults to same as target) source_selector the selector of the SOURCE zone (defaults to same as target) layer: the layer to which this conversion should be applied

TODO: apply to more layers at once

copy_subtree(source_root, target_root)[source]

Deep-copy a subtree, creating nodes with the same attributes, but different IDs

process_bundle(bundle)[source]

For each bundle, copy the tree on the given layer in the given zone to another zone.

alex.components.nlg.tectotpl.block.util.eval module

class alex.components.nlg.tectotpl.block.util.eval.Eval(scenario, args)[source]

Bases: alex.components.nlg.tectotpl.core.block.Block

This block executes arbitrary Python code for each document/bundle or each zone/tree/node matching the current language and selector.

Arguments:
document, bundle, zone, atree, anode, ttree, tnode, ntree, nnode, ptree, pnode: code to execute
for each <name of the argument>

Arguments may be combined, but at least one of them must be set. If only X<tree/node> are set, language and selector is required.

process_bundle(bundle)[source]

Process a document (execute code from the ‘bundle’ argument and dive deeper)

process_document(doc)[source]

Process a document (execute code from the ‘document’ argument and dive deeper)

process_zone(zone)[source]

Process a zone (according to language and selector; execute code for the zone or X<tree|node>) arguments)

valid_args = [u'document', u'doc', u'bundle', u'zone', u'atree', u'anode', u'ttree', u'tnode', u'ntree', u'nnode', u'ptree', u'pnode']

alex.components.nlg.tectotpl.block.util.setglobal module

class alex.components.nlg.tectotpl.block.util.setglobal.SetGlobal(scenario, args)[source]

Bases: alex.components.nlg.tectotpl.core.block.Block

process_bundle(doc)[source]

This block does nothing with the documents, its only work is setting the global arguments in the initialization phase.

Module contents