edu.cmu.sphinx.result
Class Node

java.lang.Object
  extended byedu.cmu.sphinx.result.Node

public class Node
extends java.lang.Object

Nodes are part of Lattices. The represent theories that words were spoken over a given time.


Method Summary
 boolean equals(java.lang.Object obj)
          Assumes ids are unique node identifiers
 Edge findEquivalentLeavingEdge(Edge edge)
          Returns a leaving edge that is equivalent to the given edge.
 double getBackwardScore()
           
 int getBeginTime()
          Get the frame number when the word began
 java.util.List getChildNodes()
          Get the nodes at the other ends of outgoing edges of this node.
 java.util.Collection getCopyOfLeavingEdges()
          Returns a copy of the Edges from this Node, so that the underlying data structure will not be modified.
 Edge getEdgeFromNode(Node n)
          given a node find the edge from that node
 Edge getEdgeToNode(Node n)
          given a node find the edge to that node
 int getEndTime()
          Get the frame number when the word ends
 java.util.Collection getEnteringEdges()
          Get the Edges to this Node
 double getForwardScore()
           
 java.lang.String getId()
          Get the ID associated with this Node
 java.util.Collection getLeavingEdges()
          Get the Edges from this Node
 double getPosterior()
           
 Word getWord()
          Get the word associated with this Node
 boolean hasAncestralRelationship(Node node)
          Check whether this node has an ancestral relationship with another node (i.e. either this node is an ancestor of the other node, or vice versa)
 boolean hasEquivalentLeavingEdges(Node n)
          Test if a Node has all Edges to the same Nodes and another Node.
 int hashCode()
           
 boolean isAncestorOf(Node node)
          Check whether this node is an ancestor of another node.
 boolean isEquivalent(Node other)
          Returns true if the given node is equivalent to this node.
 void removeLeavingEdge(Edge e)
          Remove an Edge to this Node
 void setBackwardScore(double backwardScore)
           
 void setForwardScore(double forwardScore)
           
 void setPosterior(double posterior)
           
 java.lang.String toString()
          Returns a description of this Node that contains the word, the start time, and the end time.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getEdgeToNode

public Edge getEdgeToNode(Node n)
given a node find the edge to that node

Parameters:
n - the node of interest
Returns:
the edge to that node or null if no edge could be found.

getEdgeFromNode

public Edge getEdgeFromNode(Node n)
given a node find the edge from that node

Parameters:
n - the node of interest
Returns:
the edge from that node or null if no edge could be found.

hasEquivalentLeavingEdges

public boolean hasEquivalentLeavingEdges(Node n)
Test if a Node has all Edges to the same Nodes and another Node.

Parameters:
n - the node of interest
Returns:
true if this Node has all Edges to the sames Nodes as n

getEnteringEdges

public java.util.Collection getEnteringEdges()
Get the Edges to this Node

Returns:
Edges to this Node

getLeavingEdges

public java.util.Collection getLeavingEdges()
Get the Edges from this Node

Returns:
Edges from this Node

getCopyOfLeavingEdges

public java.util.Collection getCopyOfLeavingEdges()
Returns a copy of the Edges from this Node, so that the underlying data structure will not be modified.

Returns:
a copy of the edges from this node

removeLeavingEdge

public void removeLeavingEdge(Edge e)
Remove an Edge to this Node

Parameters:
e - the edge to remove

getId

public java.lang.String getId()
Get the ID associated with this Node

Returns:
the ID

getWord

public Word getWord()
Get the word associated with this Node

Returns:
the word

getBeginTime

public int getBeginTime()
Get the frame number when the word began

Returns:
the begin frame number, or -1 if the frame number is unknown

getEndTime

public int getEndTime()
Get the frame number when the word ends

Returns:
the end time, or -1 if the frame number if is unknown

toString

public java.lang.String toString()
Returns a description of this Node that contains the word, the start time, and the end time.

Returns:
a description of this Node

getBackwardScore

public double getBackwardScore()
Returns:
Returns the backwardScore.

setBackwardScore

public void setBackwardScore(double backwardScore)
Parameters:
backwardScore - The backwardScore to set.

getForwardScore

public double getForwardScore()
Returns:
Returns the forwardScore.

setForwardScore

public void setForwardScore(double forwardScore)
Parameters:
forwardScore - The forwardScore to set.

getPosterior

public double getPosterior()
Returns:
Returns the posterior probability of this node.

setPosterior

public void setPosterior(double posterior)
Parameters:
posterior - The node posterior probability to set.

hashCode

public int hashCode()
See Also:
Object.hashCode()

equals

public boolean equals(java.lang.Object obj)
Assumes ids are unique node identifiers

See Also:
Object.equals(java.lang.Object)

getChildNodes

public java.util.List getChildNodes()
Get the nodes at the other ends of outgoing edges of this node.

Returns:
a list of child nodes

isAncestorOf

public boolean isAncestorOf(Node node)
Check whether this node is an ancestor of another node.

Parameters:
node - the Node to check
Returns:
whether this node is an ancestor of the passed in node.

hasAncestralRelationship

public boolean hasAncestralRelationship(Node node)
Check whether this node has an ancestral relationship with another node (i.e. either this node is an ancestor of the other node, or vice versa)

Parameters:
node - the Node to check for a relationship
Returns:
whether a relationship exists

isEquivalent

public boolean isEquivalent(Node other)
Returns true if the given node is equivalent to this node. Two nodes are equivalent only if they have the same word, the same number of entering and leaving edges, and that their begin and end times are the same.

Parameters:
other - the Node we're comparing to
Returns:
true if the Node is equivalent; false otherwise

findEquivalentLeavingEdge

public Edge findEquivalentLeavingEdge(Edge edge)
Returns a leaving edge that is equivalent to the given edge. Two edges are eqivalent if Edge.isEquivalent() returns true.

Parameters:
edge - the Edge to compare the leaving edges of this node against
Returns:
an equivalent edge, if any; or null if no equivalent edge