|
Joshua
open source statistical hierarchical phrase-based machine translation system
|
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< Rule > | rules |
Static Private Attributes | |
| static HieroFormatReader | reader = new HieroFormatReader() |
| static final int | MAX_SENTENCE_LENGTH = 64 |
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.
| joshua.decoder.hypergraph.GrammarBuilderWalkerFunction.GrammarBuilderWalkerFunction | ( | String | goal, |
| PrintStream | out | ||
| ) |
| static HGNode joshua.decoder.hypergraph.GrammarBuilderWalkerFunction.getGoalSymbolNode | ( | HGNode | root | ) | [static, private] |
| static int joshua.decoder.hypergraph.GrammarBuilderWalkerFunction.getLabelWithSpan | ( | HGNode | node | ) | [static, private] |
| static String joshua.decoder.hypergraph.GrammarBuilderWalkerFunction.getLabelWithSpanAsString | ( | HGNode | node | ) | [static, private] |
| static int [] joshua.decoder.hypergraph.GrammarBuilderWalkerFunction.getNewSource | ( | boolean | isGlue, |
| HyperEdge | edge | ||
| ) | [static, private] |
| static int [] joshua.decoder.hypergraph.GrammarBuilderWalkerFunction.getNewTargetFromSource | ( | int[] | source | ) | [static, private] |
| BilingualRule joshua.decoder.hypergraph.GrammarBuilderWalkerFunction.getRuleWithSpans | ( | HyperEdge | edge, |
| HGNode | head | ||
| ) | [private] |
| static int joshua.decoder.hypergraph.GrammarBuilderWalkerFunction.goalSymbol | ( | HyperGraph | hg | ) | [static] |
| boolean joshua.decoder.hypergraph.GrammarBuilderWalkerFunction.nodeHasGoalSymbol | ( | HGNode | node | ) | [private] |
final int joshua.decoder.hypergraph.GrammarBuilderWalkerFunction.MAX_NTS = 500000 [static] |
final int joshua.decoder.hypergraph.GrammarBuilderWalkerFunction.MAX_SENTENCE_LENGTH = 64 [static, private] |
PrintStream joshua.decoder.hypergraph.GrammarBuilderWalkerFunction.outStream [private] |
HieroFormatReader joshua.decoder.hypergraph.GrammarBuilderWalkerFunction.reader = new HieroFormatReader() [static, private] |
HashSet<Rule> joshua.decoder.hypergraph.GrammarBuilderWalkerFunction.rules [private] |