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

List of all members.

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())

Detailed Description

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.)

Author:
Zhifei Li, zhife.nosp@m.i.wo.nosp@m.rk@gm.nosp@m.ail..nosp@m.com
Version:
$LastChangedDate$

Constructor & Destructor Documentation

joshua.decoder.hypergraph.KBestExtractor.KBestExtractor ( boolean  extractUniqueNbest,
boolean  extractNbestTree,
boolean  includeAlign,
boolean  addCombinedScore,
boolean  isMonolingual,
boolean  performSanityCheck 
)

Here is the call graph for this function:


Member Function Documentation

Here is the caller graph for this function:

String joshua.decoder.hypergraph.KBestExtractor.convertHyp2String ( int  sentID,
DerivationState  cur,
List< FeatureFunction models,
String  strHypNumeric,
double[]  modelCost 
) [private]

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 call graph for this function:

Filter out those hypotheses that are already in uniqueHyps

Here is the call graph for this function:

Here is the caller graph for this function:

String joshua.decoder.hypergraph.KBestExtractor.getDerivationStateSignature ( HyperEdge  edge2,
int[]  ranks2,
int  pos 
) [private]

Here is the caller graph for this function:

String joshua.decoder.hypergraph.KBestExtractor.getKthHyp ( HGNode  it,
int  k,
int  sentID,
List< FeatureFunction models,
int[]  numNodesAndEdges 
)

Here is the call graph for this function:

Here is the caller graph for this function:

HGNode joshua.decoder.hypergraph.KBestExtractor.getKthHyp ( HGNode  it,
int  k,
int[]  numNodesAndEdges 
)

Here is the call graph for this function:

void joshua.decoder.hypergraph.KBestExtractor.lazyKBestExtractOnHG ( HyperGraph  hg,
List< FeatureFunction models,
int  topN,
int  sentID,
final List< String >  out 
)

Here is the caller graph for this function:

void joshua.decoder.hypergraph.KBestExtractor.lazyKBestExtractOnHG ( HyperGraph  hg,
List< FeatureFunction models,
int  topN,
int  sentID,
BufferedWriter  out 
) throws IOException

Here is the call graph for this function:

void joshua.decoder.hypergraph.KBestExtractor.lazyKBestExtractOnHG ( HyperGraph  hg,
List< FeatureFunction featureFunctions,
int  topN,
int  sentID,
CoIterator< String >  coit 
) [private]

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

final Logger joshua.decoder.hypergraph.KBestExtractor.logger = Logger.getLogger(KBestExtractor.class.getName()) [static, private]

Logger for this class.

String joshua.decoder.hypergraph.KBestExtractor.rootSym = "ROOT" [static, package]