alex.components.nlg.tectotpl.block.t2a package



alex.components.nlg.tectotpl.block.t2a.addauxwords module

class alex.components.nlg.tectotpl.block.t2a.addauxwords.AddAuxWords(scenario, args)[source]

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

Add auxiliary a-nodes according to formemes.

This is a base class for all steps adding auxiliary nodes.

language: the language of the target tree selector: the selector of the target tree

Return the a-node corresponding to the given t-node. Defaults to lexical a-node.


This should return a list of new forms for the auxiliaries, or None if none should be added

new_aux_node(aparent, form)[source]

Create an auxiliary node with the given surface form and parent.

postprocess(tnode, anode, aux_nodes)[source]

Apply content-specific post-processing to the newly created auxiliary a-nodes (to be overridden if needed).


Add auxiliary words to the a-layer for a t-node.

alex.components.nlg.tectotpl.block.t2a.copyttree module

class alex.components.nlg.tectotpl.block.t2a.copyttree.CopyTTree(scenario, args)[source]

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

This block creates an a-tree based on a t-tree in the same zone.

language: the language of the target zone selector: the selector of the target zone
copy_subtree(troot, aroot)[source]

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


Starting tree copy

alex.components.nlg.tectotpl.block.t2a.imposeagreement module

class alex.components.nlg.tectotpl.block.t2a.imposeagreement.ImposeAgreement(scenario, args)[source]

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

A common ancestor for blocks that impose a grammatical agreement of some kind: they should override the should_agree(tnode), process_excepts(tnode), and impose(tnode) methods.

language: the language of the target tree selector: the selector of the target tree
impose(tnode, match_nodes)[source]

Impose the agreement onto the given (regular) node.

process_excepts(tnode, match_nodes)[source]

Process exceptions from the agreement. If an exception has been found and impose() should not fire, return True.


Impose the required agreement on a node, if applicable.


Check whether the agreement applies to the given node; if so, return the relevant nodes this node should agree with.

Module contents