summaryrefslogtreecommitdiff
path: root/decoder/cdec.cc
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-12 03:42:39 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-12 03:42:39 +0000
commit7220bd3685bb7cbd6a68749f55314892af5605c9 (patch)
tree524621fbdb2a2a3a4bfceb82bca72172f12412d1 /decoder/cdec.cc
parent1cf86da06f6a0ab5d9a78bd39a1627df142ea8c5 (diff)
inebriated, but sped up inside/outside pruning and made cube poplimit scale with promise of nodes from previous global pruning, if --promise_power=N for N>0.
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@219 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/cdec.cc')
-rw-r--r--decoder/cdec.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/decoder/cdec.cc b/decoder/cdec.cc
index bcba1409..09760f6b 100644
--- a/decoder/cdec.cc
+++ b/decoder/cdec.cc
@@ -127,6 +127,7 @@ void InitCommandLine(int argc, char** argv, po::variables_map* confp) {
("prelm_beam_prune", po::value<double>(), "Prune paths from -LM forest before LM rescoring, keeping paths within exp(alpha>=0)")
("beam_prune", po::value<double>(), "Prune paths from +LM forest, keep paths within exp(alpha>=0)")
("scale_prune_srclen", "scale beams by the input length (in # of tokens; may not be what you want for lattices")
+ ("promise_power",po::value<double>()->default_value(0), "Give more beam budget to more promising previous-pass nodes when pruning - but allocate the same average beams. 0 means off, 1 means beam proportional to inside*outside prob, n means nth power (affects just --cubepruning_pop_limit)")
("lexalign_use_null", "Support source-side null words in lexical translation")
("tagger_tagset,t", po::value<string>(), "(Tagger) file containing tag set")
("csplit_output_plf", "(Compound splitter) Output lattice in PLF format")
@@ -337,7 +338,7 @@ void forest_stats(Hypergraph &forest,string name,bool show_tree,bool show_featur
}
void maybe_prune(Hypergraph &forest,po::variables_map const& conf,string nbeam,string ndensity,string forestname,double srclen) {
- double beam_prune,density_prune;
+ double beam_prune=0,density_prune=0;
bool use_beam_prune=beam_param(conf,nbeam,&beam_prune,conf.count("scale_prune_srclen"),srclen);
bool use_density_prune=beam_param(conf,ndensity,&density_prune);
if (use_beam_prune || use_density_prune) {
@@ -348,10 +349,7 @@ void maybe_prune(Hypergraph &forest,po::variables_map const& conf,string nbeam,s
preserve_mask[CompoundSplit::GetFullWordEdgeIndex(forest)] = true;
pm=&preserve_mask;
}
- if (use_beam_prune)
- forest.BeamPruneInsideOutside(1.0, false, beam_prune, pm);
- if (use_density_prune)
- forest.DensityPruneInsideOutside(1.0 ,false, density_prune, pm);
+ forest.PruneInsideOutside(beam_prune,density_prune,pm,false,1,conf["promise_power"].as<double>());
if (!forestname.empty()) forestname=" "+forestname;
forest_stats(forest," Pruned "+forestname+" forest",false,false);
cerr << " Pruned "<<forestname<<" forest portion of edges kept: "<<forest.edges_.size()/presize<<endl;