Joshua
open source statistical hierarchical phrase-based machine translation system
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
joshua.lattice.Lattice< Value > Class Reference
Collaboration diagram for joshua.lattice.Lattice< Value >:
[legend]

List of all members.

Public Member Functions

 Lattice (List< Node< Value >> nodes)
 Lattice (List< Node< Value >> nodes, boolean isAmbiguous)
 Lattice (Value[] linearChain)
final boolean hasMoreThanOnePath ()
double getShortestPath (int from, int to)
Node< Value > getNode (int index)
Iterator< Node< Value > > iterator ()
int size ()
String toString ()

Static Public Member Functions

static Lattice< Integer > createIntLattice (int[] linearChain)
static Lattice< Integer > createIntLatticeFromString (String data)
static Lattice< String > createStringLatticeFromString (String data)
static void main (String[] args)

Private Member Functions

double[][] calculateAllPairsShortestPath (List< Node< Value >> nodes)

Private Attributes

final boolean latticeHasAmbiguity
final double[][] costs
final List< Node< Value > > nodes

Static Private Attributes

static final Logger logger = Logger.getLogger(Lattice.class.getName())

Detailed Description

A lattice representation of a directed graph.

Author:
Lane Schwartz
Since:
2008-07-08
Version:
$LastChangedDate$
Parameters:
LabelType of label associated with an arc.

Constructor & Destructor Documentation

joshua.lattice.Lattice< Value >.Lattice ( List< Node< Value >>  nodes)

Constructs a new lattice from an existing list of (connected) nodes.

The list of nodes must already be in topological order. If the list is not in topological order, the behavior of the lattice is not defined.

Parameters:
nodesA list of nodes which must be in topological order.
joshua.lattice.Lattice< Value >.Lattice ( List< Node< Value >>  nodes,
boolean  isAmbiguous 
)
joshua.lattice.Lattice< Value >.Lattice ( Value[]  linearChain)

Member Function Documentation

double [][] joshua.lattice.Lattice< Value >.calculateAllPairsShortestPath ( List< Node< Value >>  nodes) [private]

Calculate the all-pairs shortest path for all pairs of nodes.

Note: This method assumes no backward arcs. If there are backward arcs, the returned shortest path costs for that node may not be accurate.

Parameters:
nodesA list of nodes which must be in topological order.
Returns:
The all-pairs shortest path for all pairs of nodes.
static Lattice<Integer> joshua.lattice.Lattice< Value >.createIntLattice ( int[]  linearChain) [static]

Convenience method to get a lattice from an int[].

This method is useful because Java's generics won't allow a primitive array to be passed as a generic array.

Parameters:
linearChain
Returns:
Lattice representation of the linear chain.
static Lattice<Integer> joshua.lattice.Lattice< Value >.createIntLatticeFromString ( String  data) [static]

Here is the call graph for this function:

static Lattice<String> joshua.lattice.Lattice< Value >.createStringLatticeFromString ( String  data) [static]

Constructs a lattice from a given string representation.

Parameters:
dataString representation of a lattice.
Returns:
A lattice that corresponds to the given string.
Node<Value> joshua.lattice.Lattice< Value >.getNode ( int  index)

Gets the node with a specified integer identifier.

Parameters:
indexInteger identifier for a node.
Returns:
The node with the specified integer identifier
double joshua.lattice.Lattice< Value >.getShortestPath ( int  from,
int  to 
)

Gets the cost of the shortest path between two nodes.

Parameters:
fromID of the starting node.
toID of the ending node.
Returns:
The cost of the shortest path between the two nodes.
final boolean joshua.lattice.Lattice< Value >.hasMoreThanOnePath ( )
Iterator<Node<Value> > joshua.lattice.Lattice< Value >.iterator ( )

Returns an iterator over the nodes in this lattice.

Returns:
An iterator over the nodes in this lattice.
static void joshua.lattice.Lattice< Value >.main ( String[]  args) [static]
int joshua.lattice.Lattice< Value >.size ( )

Returns the number of nodes in this lattice.

Returns:
The number of nodes in this lattice.
String joshua.lattice.Lattice< Value >.toString ( )

Member Data Documentation

final double [][] joshua.lattice.Lattice< Value >.costs [private]

Costs of the best path between each pair of nodes in the lattice.

final boolean joshua.lattice.Lattice< Value >.latticeHasAmbiguity [private]

True if there is more than one path through the lattice.

final Logger joshua.lattice.Lattice< Value >.logger = Logger.getLogger(Lattice.class.getName()) [static, private]

Logger for this class.

final List<Node<Value> > joshua.lattice.Lattice< Value >.nodes [private]

List of all nodes in the lattice. Nodes are assumed to be in topological order.