Package org.egothor.stemmer.trie
Class ReducedNode<V>
java.lang.Object
org.egothor.stemmer.trie.ReducedNode<V>
- Type Parameters:
V- value type
Canonical reduced node used during subtree merging.
The maps exposed by the accessors are the internal backing state of the canonical reduced node. They are returned directly for efficiency and are intended only for closely related trie-reduction infrastructure.
-
Constructor Summary
ConstructorsConstructorDescriptionReducedNode(ReductionSignature<V> signature, Map<V, Integer> localCounts, Map<Character, ReducedNode<V>> children) Creates a new reduced node. -
Method Summary
Modifier and TypeMethodDescriptionchildren()Returns the internal canonical child map indexed by transition character.Returns the internal aggregated local value-count map.voidmergeChildren(Map<Character, ReducedNode<V>> additionalChildren) Merges child references into this node.voidmergeLocalCounts(Map<V, Integer> additionalCounts) Merges additional local counts into this node.Returns the reduction signature of this canonical node.
-
Constructor Details
-
ReducedNode
public ReducedNode(ReductionSignature<V> signature, Map<V, Integer> localCounts, Map<Character, ReducedNode<V>> children) Creates a new reduced node.- Parameters:
signature- reduction signaturelocalCounts- local countschildren- children
-
-
Method Details
-
signature
Returns the reduction signature of this canonical node.- Returns:
- reduction signature
-
localCounts
Returns the internal aggregated local value-count map.The returned map is the internal backing state of this canonical reduced node and is exposed only for efficient cooperation with trie-reduction infrastructure.
- Returns:
- internal aggregated local value-count map
-
children
Returns the internal canonical child map indexed by transition character.The returned map is the internal backing state of this canonical reduced node and is exposed only for efficient cooperation with trie-reduction infrastructure.
- Returns:
- internal canonical child map
-
mergeLocalCounts
Merges additional local counts into this node.- Parameters:
additionalCounts- additional local counts
-
mergeChildren
Merges child references into this node.For nodes with the same reduction signature, child edge sets and child signatures must be compatible. This method therefore only needs to verify consistency and store the canonical child instance.
- Parameters:
additionalChildren- additional children
-