|
Joshua
open source statistical hierarchical phrase-based machine translation system
|
Classes | |
| class | DerivationState |
| class | VirtualNode |
Public Member Functions | |
| KBestExtractor (boolean extractUniqueNbest, boolean extractNbestTree, boolean includeAlign, boolean addCombinedScore, boolean isMonolingual, boolean performSanityCheck) | |
| String | getKthHyp (HGNode it, int k, int sentID, List< FeatureFunction > models, int[] numNodesAndEdges) |
| HyperGraph | extractKbestIntoHyperGraph (HyperGraph inHG, int topN) |
| HGNode | getKthHyp (HGNode it, int k, int[] numNodesAndEdges) |
| void | filterKbestHypergraph (HyperGraph hg, Set< String > uniqueHyps) |
| void | lazyKBestExtractOnHG (HyperGraph hg, List< FeatureFunction > models, int topN, int sentID, final List< String > out) |
| void | lazyKBestExtractOnHG (HyperGraph hg, List< FeatureFunction > models, int topN, int sentID, BufferedWriter out) throws IOException |
| void | resetState () |
Static Package Attributes | |
| static String | rootSym = "ROOT" |
| static int | rootID |
Private Member Functions | |
| void | lazyKBestExtractOnHG (HyperGraph hg, List< FeatureFunction > featureFunctions, int topN, int sentID, CoIterator< String > coit) |
| String | convertHyp2String (int sentID, DerivationState cur, List< FeatureFunction > models, String strHypNumeric, double[] modelCost) |
| String | escapeTerminalForTree (String terminal) |
| VirtualNode | addVirtualNode (HGNode it) |
| String | getDerivationStateSignature (HyperEdge edge2, int[] ranks2, int pos) |
Private Attributes | |
| final HashMap< HGNode, VirtualNode > | virtualNodesTbl = new HashMap<HGNode, VirtualNode>() |
| boolean | extractUniqueNbest = true |
| boolean | extractNbestTree = false |
| boolean | includeAlign = false |
| boolean | addCombinedScore = true |
| boolean | isMonolingual = false |
| boolean | performSanityCheck = true |
| int | sentID |
Static Private Attributes | |
| static final Logger | logger = Logger.getLogger(KBestExtractor.class.getName()) |
This class implements lazy k-best extraction on a hyper-graph. To seed the kbest extraction, it only needs that each hyperedge should have the best_cost properly set, and it does not require any list being sorted. Instead, the priority queue heap_cands will do internal sorting In fact, the real crucial cost is the transition-cost at each hyperedge. We store the best-cost instead of the transition cost since it is easy to do pruning and find one-best. Moreover, the transition cost can be recovered by get_transition_cost(), though somewhat expensive.
To recover the model cost for each individual model, we should either have access to the model, or store the model cost in the hyperedge. (For example, in the case of disk-hypergraph, we need to store all these model cost at each hyperedge.)
| joshua.decoder.hypergraph.KBestExtractor.KBestExtractor | ( | boolean | extractUniqueNbest, |
| boolean | extractNbestTree, | ||
| boolean | includeAlign, | ||
| boolean | addCombinedScore, | ||
| boolean | isMonolingual, | ||
| boolean | performSanityCheck | ||
| ) |
| VirtualNode joshua.decoder.hypergraph.KBestExtractor.addVirtualNode | ( | HGNode | it | ) | [private] |
| String joshua.decoder.hypergraph.KBestExtractor.convertHyp2String | ( | int | sentID, |
| DerivationState | cur, | ||
| List< FeatureFunction > | models, | ||
| String | strHypNumeric, | ||
| double[] | modelCost | ||
| ) | [private] |
| String joshua.decoder.hypergraph.KBestExtractor.escapeTerminalForTree | ( | String | terminal | ) | [private] |
| HyperGraph joshua.decoder.hypergraph.KBestExtractor.extractKbestIntoHyperGraph | ( | HyperGraph | inHG, |
| int | topN | ||
| ) |
| void joshua.decoder.hypergraph.KBestExtractor.filterKbestHypergraph | ( | HyperGraph | hg, |
| Set< String > | uniqueHyps | ||
| ) |
Filter out those hypotheses that are already in uniqueHyps
| String joshua.decoder.hypergraph.KBestExtractor.getDerivationStateSignature | ( | HyperEdge | edge2, |
| int[] | ranks2, | ||
| int | pos | ||
| ) | [private] |
| String joshua.decoder.hypergraph.KBestExtractor.getKthHyp | ( | HGNode | it, |
| int | k, | ||
| int | sentID, | ||
| List< FeatureFunction > | models, | ||
| int[] | numNodesAndEdges | ||
| ) |
| HGNode joshua.decoder.hypergraph.KBestExtractor.getKthHyp | ( | HGNode | it, |
| int | k, | ||
| int[] | numNodesAndEdges | ||
| ) |
| void joshua.decoder.hypergraph.KBestExtractor.lazyKBestExtractOnHG | ( | HyperGraph | hg, |
| List< FeatureFunction > | models, | ||
| int | topN, | ||
| int | sentID, | ||
| final List< String > | out | ||
| ) |
| void joshua.decoder.hypergraph.KBestExtractor.lazyKBestExtractOnHG | ( | HyperGraph | hg, |
| List< FeatureFunction > | models, | ||
| int | topN, | ||
| int | sentID, | ||
| BufferedWriter | out | ||
| ) | throws IOException |
| void joshua.decoder.hypergraph.KBestExtractor.lazyKBestExtractOnHG | ( | HyperGraph | hg, |
| List< FeatureFunction > | featureFunctions, | ||
| int | topN, | ||
| int | sentID, | ||
| CoIterator< String > | coit | ||
| ) | [private] |
boolean joshua.decoder.hypergraph.KBestExtractor.addCombinedScore = true [private] |
boolean joshua.decoder.hypergraph.KBestExtractor.extractNbestTree = false [private] |
boolean joshua.decoder.hypergraph.KBestExtractor.extractUniqueNbest = true [private] |
boolean joshua.decoder.hypergraph.KBestExtractor.includeAlign = false [private] |
boolean joshua.decoder.hypergraph.KBestExtractor.isMonolingual = false [private] |
final Logger joshua.decoder.hypergraph.KBestExtractor.logger = Logger.getLogger(KBestExtractor.class.getName()) [static, private] |
Logger for this class.
boolean joshua.decoder.hypergraph.KBestExtractor.performSanityCheck = true [private] |
int joshua.decoder.hypergraph.KBestExtractor.rootID [static, package] |
String joshua.decoder.hypergraph.KBestExtractor.rootSym = "ROOT" [static, package] |
int joshua.decoder.hypergraph.KBestExtractor.sentID [private] |
final HashMap<HGNode, VirtualNode> joshua.decoder.hypergraph.KBestExtractor.virtualNodesTbl = new HashMap<HGNode, VirtualNode>() [private] |