architxt.simplification.simple_rewrite

Contents

architxt.simplification.simple_rewrite#

Functions

simple_rewrite(forest, **_)

Rewrite a given forest into a valid schema, treating each tree as a distinct group.

architxt.simplification.simple_rewrite.simple_rewrite(forest, **_)[source]#

Rewrite a given forest into a valid schema, treating each tree as a distinct group.

Entities within a tree are grouped together, and duplicate entities are discarded. The function creates a unique group name for each distinct set of entities.

Parameters:

forest (Collection[Tree]) – Input forest consisting of a list of Tree objects.

Return type:

Collection[Tree]

Returns:

A new forest where each tree is restructured as a valid group. Already valid trees are kept as is.