|
Joshua
open source statistical hierarchical phrase-based machine translation system
|
Public Member Functions | |
| AbstractGrammar () | |
| int | getOOVRuleID () |
| void | sortGrammar (List< FeatureFunction > models) |
| boolean | isSorted () |
| void | writeGrammarOnDisk (String file) |
| void | changeGrammarCosts (Map< String, Double > weightTbl, HashMap< String, Integer > featureMap, double[] scores, String prefix, int column, boolean negate) |
| void | obtainRulesIDTable (Map< String, Integer > rulesIDTable) |
Static Public Attributes | |
| static final int | OOV_RULE_ID = 0 |
Protected Member Functions | |
| void | setSorted (boolean sorted) |
Protected Attributes | |
| boolean | sorted |
Private Member Functions | |
| void | sort (Trie node, List< FeatureFunction > models) |
| void | changeGrammarCosts (Trie trie, HashMap< String, Integer > featureMap, double[] scores, String prefix, int column, boolean negate) |
| void | obtainRulesIDTable (Trie trie, Map< String, Integer > rulesIDTable) |
Static Private Attributes | |
| static final Logger | logger = Logger.getLogger(AbstractGrammar.class.getName()) |
Partial implementation of the Grammar interface that provides logic for sorting a grammar.
Note: New classes implementing the Grammar interface should probably inherit from this class, unless a specific sorting technique different from that implemented by this class is required.
Constructs an empty, unsorted grammar.
| void joshua.decoder.ff.tm.AbstractGrammar.changeGrammarCosts | ( | Map< String, Double > | weightTbl, |
| HashMap< String, Integer > | featureMap, | ||
| double[] | scores, | ||
| String | prefix, | ||
| int | column, | ||
| boolean | negate | ||
| ) |
Implements joshua.decoder.ff.tm.Grammar.
| void joshua.decoder.ff.tm.AbstractGrammar.changeGrammarCosts | ( | Trie | trie, |
| HashMap< String, Integer > | featureMap, | ||
| double[] | scores, | ||
| String | prefix, | ||
| int | column, | ||
| boolean | negate | ||
| ) | [private] |
Gets the integer identifier of this grammar's out-of-vocabulary (OOV) rule.
Implements joshua.decoder.ff.tm.Grammar.
| boolean joshua.decoder.ff.tm.AbstractGrammar.isSorted | ( | ) |
Determines whether the rules in this grammar have been sorted based on the latest feature function values.
This method is needed for the cube-pruning algorithm.
true if the rules in this grammar have been sorted based on the latest feature function values, false otherwise Implements joshua.decoder.ff.tm.Grammar.
| void joshua.decoder.ff.tm.AbstractGrammar.obtainRulesIDTable | ( | Map< String, Integer > | rulesIDTable | ) |
Implements joshua.decoder.ff.tm.Grammar.
| void joshua.decoder.ff.tm.AbstractGrammar.obtainRulesIDTable | ( | Trie | trie, |
| Map< String, Integer > | rulesIDTable | ||
| ) | [private] |
| void joshua.decoder.ff.tm.AbstractGrammar.setSorted | ( | boolean | sorted | ) | [protected] |
Sets the flag indicating whether this grammar is sorted.
This method is called by sortGrammar(ArrayList) to indicate that the grammar has been sorted.
Its scope is protected so that child classes that override sortGrammar will also be able to call this method to indicate that the grammar has been sorted.
| sorted |
| void joshua.decoder.ff.tm.AbstractGrammar.sort | ( | Trie | node, |
| List< FeatureFunction > | models | ||
| ) | [private] |
Recursively sorts the grammar using the provided feature functions.
This method first sorts the rules stored at the provided node, then recursively calls itself on the child nodes of the provided node.
| node | Grammar node in the Trie whose rules should be sorted. |
| models | Feature function models to use during sorting. |
| void joshua.decoder.ff.tm.AbstractGrammar.sortGrammar | ( | List< FeatureFunction > | models | ) |
Cube-pruning requires that the grammar be sorted based on the latest feature functions. To avoid synchronization, this method should be called before multiple threads are initialized for parallel decoding
Implements joshua.decoder.ff.tm.Grammar.
| void joshua.decoder.ff.tm.AbstractGrammar.writeGrammarOnDisk | ( | String | file | ) |
Implements joshua.decoder.ff.tm.Grammar.
final Logger joshua.decoder.ff.tm.AbstractGrammar.logger = Logger.getLogger(AbstractGrammar.class.getName()) [static, private] |
Logger for this class.
Reimplemented in joshua.decoder.ff.tm.hash_based.MemoryBasedBatchGrammar, and joshua.decoder.ff.tm.packed.PackedGrammar.
final int joshua.decoder.ff.tm.AbstractGrammar.OOV_RULE_ID = 0 [static] |
boolean joshua.decoder.ff.tm.AbstractGrammar.sorted [protected] |
Indicates whether the rules in this grammar have been sorted based on the latest feature function values.