Joshua
open source statistical hierarchical phrase-based machine translation system
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
joshua.decoder.hypergraph.GrammarBuilderWalkerFunction Class Reference
Inheritance diagram for joshua.decoder.hypergraph.GrammarBuilderWalkerFunction:
[legend]
Collaboration diagram for joshua.decoder.hypergraph.GrammarBuilderWalkerFunction:
[legend]

List of all members.

Public Member Functions

 GrammarBuilderWalkerFunction (String goal)
 GrammarBuilderWalkerFunction (String goal, PrintStream out)
void apply (HGNode node)
Grammar getGrammar ()

Static Public Member Functions

static int goalSymbol (HyperGraph hg)

Static Public Attributes

static final int MAX_NTS = 500000

Private Member Functions

boolean nodeHasGoalSymbol (HGNode node)
BilingualRule getRuleWithSpans (HyperEdge edge, HGNode head)

Static Private Member Functions

static int getLabelWithSpan (HGNode node)
static String getLabelWithSpanAsString (HGNode node)
static int[] getNewSource (boolean isGlue, HyperEdge edge)
static int[] getNewTargetFromSource (int[] source)
static HGNode getGoalSymbolNode (HGNode root)

Private Attributes

MemoryBasedBatchGrammar grammar
PrintStream outStream
int goalSymbol
HashSet< Rulerules

Static Private Attributes

static HieroFormatReader reader = new HieroFormatReader()
static final int MAX_SENTENCE_LENGTH = 64

Detailed Description

This walker function builds up a new context-free grammar by visiting each node in a hypergraph. For a quick overview, see Chris Dyer's 2010 NAACL paper "Two monlingual parses are better than one (synchronous parse)".

From a functional-programming point of view, this walker really wants to calculate a fold over the entire hypergraph: the initial value is an empty grammar, and as we visit each node, we add more rules to the grammar. After we have traversed the whole hypergraph, the resulting grammar will contain all rules needed for synchronous parsing.

These rules look just like the rules already present in the hypergraph, except that each non-terminal symbol is annotated with the span of its node.


Constructor & Destructor Documentation

Here is the call graph for this function:


Member Function Documentation

Implements joshua.decoder.hypergraph.WalkerFunction.

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

Here is the call graph for this function:

static int [] joshua.decoder.hypergraph.GrammarBuilderWalkerFunction.getNewSource ( boolean  isGlue,
HyperEdge  edge 
) [static, private]

Here is the call graph for this function:

Here is the caller graph for this function:

static int [] joshua.decoder.hypergraph.GrammarBuilderWalkerFunction.getNewTargetFromSource ( int[]  source) [static, private]

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation