Class FullMarkovModel.Node
java.lang.Object
com.github.szgabsz91.morpher.languagehandlers.hunmorph.impl.markov.FullMarkovModel.Node
- All Implemented Interfaces:
Comparable<FullMarkovModel.Node>
- Enclosing class:
FullMarkovModel
Node class for the
FullMarkovModel.-
Constructor Summary
ConstructorsConstructorDescriptionNode(com.github.szgabsz91.morpher.core.model.AffixType affixType, long relativeFrequency, FullMarkovModel.Node parent) Constructor that sets the affix type, relative frequency and the optional parent. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(FullMarkovModel.Node other) Compares the objects by their probabilities.static FullMarkovModel.Nodecreate(com.github.szgabsz91.morpher.core.model.AffixType affixType, FullMarkovModel.Node parent) Creates a new node with the given affix type and parent, setting its relative frequency to zero.static FullMarkovModel.Nodeend(FullMarkovModel.Node parent) Returns a new end node and sets its parent to the given node, as well as its relative frequency to one.booleanReturns if this node equals the given other object.getChild(com.github.szgabsz91.morpher.core.model.AffixType affixType) Returns the optional child node for the given affix type.Returns the optional parent node.inthashCode()Returns the hash code of this node.voidIncrements the relative frequency by 1.voidincrementRelativeFrequencyBy(long relativeFrequencyIncrement) Increments the relative frequency by the given value.static FullMarkovModel.Nodestart()Returns a new start node with a relative frequency of -1.
-
Constructor Details
-
Node
public Node(com.github.szgabsz91.morpher.core.model.AffixType affixType, long relativeFrequency, FullMarkovModel.Node parent) Constructor that sets the affix type, relative frequency and the optional parent.- Parameters:
affixType- the affix typerelativeFrequency- the relative frequencyparent- the optional parent
-
-
Method Details
-
start
Returns a new start node with a relative frequency of -1.- Returns:
- the new start node
-
end
Returns a new end node and sets its parent to the given node, as well as its relative frequency to one.- Parameters:
parent- the parent of the new end node- Returns:
- the new end node
-
create
public static FullMarkovModel.Node create(com.github.szgabsz91.morpher.core.model.AffixType affixType, FullMarkovModel.Node parent) Creates a new node with the given affix type and parent, setting its relative frequency to zero.- Parameters:
affixType- the affix typeparent- the parent- Returns:
- the new node
-
incrementRelativeFrequency
public void incrementRelativeFrequency()Increments the relative frequency by 1. -
incrementRelativeFrequencyBy
public void incrementRelativeFrequencyBy(long relativeFrequencyIncrement) Increments the relative frequency by the given value.- Parameters:
relativeFrequencyIncrement- the relative frequency to increment by
-
getParent
Returns the optional parent node.- Returns:
- the optional parent node
-
getChild
public Optional<FullMarkovModel.Node> getChild(com.github.szgabsz91.morpher.core.model.AffixType affixType) Returns the optional child node for the given affix type.- Parameters:
affixType- the affix type- Returns:
- the optional child node
-
compareTo
Compares the objects by their probabilities.- Specified by:
compareToin interfaceComparable<FullMarkovModel.Node>- Parameters:
other- the other node- Returns:
- -1 if the given object has higher probability, 0 is they are equal, +1 otherwise
-
equals
Returns if this node equals the given other object. -
hashCode
public int hashCode()Returns the hash code of this node.
-