java.lang.Object
com.github.szgabsz91.morpher.languagehandlers.hunmorph.impl.markov.FullMarkovModel.Node
All Implemented Interfaces:
Comparable<FullMarkovModel.Node>
Enclosing class:
FullMarkovModel

public static class FullMarkovModel.Node extends Object implements Comparable<FullMarkovModel.Node>
Node class for the FullMarkovModel.
  • 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 type
      relativeFrequency - the relative frequency
      parent - the optional parent
  • Method Details

    • start

      public static FullMarkovModel.Node start()
      Returns a new start node with a relative frequency of -1.
      Returns:
      the new start node
    • end

      public static FullMarkovModel.Node end(FullMarkovModel.Node parent)
      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 type
      parent - 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

      public Optional<FullMarkovModel.Node> 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

      public int compareTo(FullMarkovModel.Node other)
      Compares the objects by their probabilities.
      Specified by:
      compareTo in interface Comparable<FullMarkovModel.Node>
      Parameters:
      other - the other node
      Returns:
      -1 if the given object has higher probability, 0 is they are equal, +1 otherwise
    • equals

      public boolean equals(Object other)
      Returns if this node equals the given other object.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Returns the hash code of this node.
      Overrides:
      hashCode in class Object