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

Subpackages

Submodules

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.

Arguments:
language: the language of the target tree selector: the selector of the target tree
get_anode(tnode)[source]

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

get_aux_forms(tnode)[source]

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

process_tnode(tnode)[source]

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.

Arguments:
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.

process_zone(zone)[source]

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.

Arguments:
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.

process_tnode(tnode)[source]

Impose the required agreement on a node, if applicable.

should_agree(tnode)[source]

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

Module contents