}
/* Parsing */
HyperGraph hypergraph = chart.expand();
if (JoshuaConfiguration.visualize_hypergraph) {
HyperGraphViewer.visualizeHypergraphInFrame(hypergraph, symbolTable);
}
if (logger.isLoggable(Level.FINER))
logger.finer("after expand, time: "
+ ((double)(System.currentTimeMillis() - startTime) / 1000.0)
+ " seconds");
if (oracleSentence != null) {
logger.fine("Creating oracle extractor");
OracleExtractor extractor = new OracleExtractor(this.symbolTable);
logger.finer("Extracting oracle hypergraph...");
HyperGraph oracle = extractor.getOracle(hypergraph, 3, oracleSentence);
logger.finer("... Done Extracting. Getting k-best...");
this.kbestExtractor.lazyKBestExtractOnHG(
oracle, this.featureFunctions,
JoshuaConfiguration.topN,
Integer.parseInt(segment.id()), this.nbestWriter);
logger.finer("... Done getting k-best");
} else {
/* k-best extraction */
this.kbestExtractor.lazyKBestExtractOnHG(
hypergraph, this.featureFunctions,
JoshuaConfiguration.topN,
Integer.parseInt(segment.id()), this.nbestWriter);
if (logger.isLoggable(Level.FINER))
logger.finer("after k-best, time: "
+ ((double)(System.currentTimeMillis() - startTime) / 1000.0)
+ " seconds");
}
if (null != this.hypergraphSerializer) {
if(JoshuaConfiguration.use_kbest_hg){
HyperGraph kbestHG = this.kbestExtractor.extractKbestIntoHyperGraph(hypergraph, JoshuaConfiguration.topN);
this.hypergraphSerializer.saveHyperGraph(kbestHG);
}else{
this.hypergraphSerializer.saveHyperGraph(hypergraph);
}
}