architxt.simplification.tree_rewriting.operations.groups

architxt.simplification.tree_rewriting.operations.groups#

Classes

FindSubGroupsOperation(*, tree_clusterer, ...)

Identifies and create subgroup of entities for each subtree.

MergeGroupsOperation(*, tree_clusterer, ...)

Attempt to add ENT to an existing ` GROUP ` within a tree.

class architxt.simplification.tree_rewriting.operations.groups.FindSubGroupsOperation(*, tree_clusterer, min_support)[source]#

Bases: Operation

Identifies and create subgroup of entities for each subtree.

It creates a group only if the support of the newly created subgroup is greater than the support of the subtree.

apply(tree)[source]#

Apply the rewriting operation on the given tree.

Parameters:

tree (Tree) – The tree to perform the reduction on.

Return type:

bool

Returns:

A boolean indicating whether the operation modified the tree (True) or left it unaltered (False).

class architxt.simplification.tree_rewriting.operations.groups.MergeGroupsOperation(*, tree_clusterer, min_support)[source]#

Bases: Operation

Attempt to add ENT to an existing ` GROUP ` within a tree.

It tries to form a new GROUP node that does not reduce the support of the given group.

apply(tree)[source]#

Apply the rewriting operation on the given tree.

Parameters:

tree (Tree) – The tree to perform the reduction on.

Return type:

bool

Returns:

A boolean indicating whether the operation modified the tree (True) or left it unaltered (False).