architxt.simplification.tree_rewriting.operations.operation#
Classes
|
Abstract base class representing a tree rewriting operation. |
- class architxt.simplification.tree_rewriting.operations.operation.Operation(*, tau, min_support, metric)[source]#
Bases:
ABC
Abstract base class representing a tree rewriting operation.
This class encapsulates the definition of operations that can be applied to a tree structure using certain equivalence subtrees, a threshold value, a minimum support value, and a metric function. It acts as the base class for any concrete operation and enforces the structure through abstract methods.
- Parameters:
tau (
float
) – Threshold for subtree similarity when clustering.min_support (
int
) – The minimum support value for a structure to be considered frequent.metric (
Callable
[Collection
[str
],Collection
[str
],float
]) – The metric function used to compute similarity between subtrees.
- abstractmethod apply(tree, *, equiv_subtrees)[source]#
Apply the rewriting operation on the given tree.
- Parameters:
- Return type:
- Returns:
A tuple containing the transformed tree and a boolean flag. The boolean flag typically indicates whether the operation modified the tree (True) or left it unaltered (False).