diff options
Diffstat (limited to 'decoder/decoder.cc')
-rw-r--r-- | decoder/decoder.cc | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/decoder/decoder.cc b/decoder/decoder.cc index 69fbaf85..d4f8f06d 100644 --- a/decoder/decoder.cc +++ b/decoder/decoder.cc @@ -57,7 +57,6 @@ static const double kMINUS_EPSILON = -1e-6; // don't be too strict using namespace std; using namespace std::tr1; -using boost::shared_ptr; namespace po = boost::program_options; static bool verbose_feature_functions=true; @@ -101,7 +100,7 @@ inline string str(char const* name,po::variables_map const& conf) { // print just the --long_opt names suitable for bash compgen inline void print_options(std::ostream &out,po::options_description const& opts) { - typedef std::vector< shared_ptr<po::option_description> > Ds; + typedef std::vector< boost::shared_ptr<po::option_description> > Ds; Ds const& ds=opts.options(); out << '"'; for (unsigned i=0;i<ds.size();++i) { @@ -120,13 +119,13 @@ inline bool store_conf(po::variables_map const& conf,std::string const& name,V * return false; } -inline shared_ptr<FeatureFunction> make_ff(string const& ffp,bool verbose_feature_functions,char const* pre="") { +inline boost::shared_ptr<FeatureFunction> make_ff(string const& ffp,bool verbose_feature_functions,char const* pre="") { string ff, param; SplitCommandAndParam(ffp, &ff, ¶m); cerr << pre << "feature: " << ff; if (param.size() > 0) cerr << " (with config parameters '" << param << "')\n"; else cerr << " (no config parameters)\n"; - shared_ptr<FeatureFunction> pf = ff_registry.Create(ff, param); + boost::shared_ptr<FeatureFunction> pf = ff_registry.Create(ff, param); if (!pf) exit(1); int nbyte=pf->NumBytesContext(); if (verbose_feature_functions) @@ -135,13 +134,13 @@ inline shared_ptr<FeatureFunction> make_ff(string const& ffp,bool verbose_featur } #ifdef FSA_RESCORING -inline shared_ptr<FsaFeatureFunction> make_fsa_ff(string const& ffp,bool verbose_feature_functions,char const* pre="") { +inline boost::shared_ptr<FsaFeatureFunction> make_fsa_ff(string const& ffp,bool verbose_feature_functions,char const* pre="") { string ff, param; SplitCommandAndParam(ffp, &ff, ¶m); cerr << "FSA Feature: " << ff; if (param.size() > 0) cerr << " (with config parameters '" << param << "')\n"; else cerr << " (no config parameters)\n"; - shared_ptr<FsaFeatureFunction> pf = fsa_ff_registry.Create(ff, param); + boost::shared_ptr<FsaFeatureFunction> pf = fsa_ff_registry.Create(ff, param); if (!pf) exit(1); if (verbose_feature_functions) cerr<<"State is "<<pf->state_bytes()<<" bytes for "<<pre<<"feature "<<ffp<<endl; @@ -156,10 +155,10 @@ inline shared_ptr<FsaFeatureFunction> make_fsa_ff(string const& ffp,bool verbose // passes are carried over into subsequent passes (where they may have different weights). struct RescoringPass { RescoringPass() : fid_summary(), density_prune(), beam_prune() {} - shared_ptr<ModelSet> models; - shared_ptr<IntersectionConfiguration> inter_conf; + boost::shared_ptr<ModelSet> models; + boost::shared_ptr<IntersectionConfiguration> inter_conf; vector<const FeatureFunction*> ffs; - shared_ptr<vector<weight_t> > weight_vector; + boost::shared_ptr<vector<weight_t> > weight_vector; int fid_summary; // 0 == no summary feature double density_prune; // 0 == don't density prune double beam_prune; // 0 == don't beam prune @@ -293,15 +292,15 @@ struct DecoderImpl { po::variables_map& conf; OracleBleu oracle; string formalism; - shared_ptr<Translator> translator; - shared_ptr<vector<weight_t> > init_weights; // weights used with initial parse - vector<shared_ptr<FeatureFunction> > pffs; + boost::shared_ptr<Translator> translator; + boost::shared_ptr<vector<weight_t> > init_weights; // weights used with initial parse + vector<boost::shared_ptr<FeatureFunction> > pffs; #ifdef FSA_RESCORING CFGOptions cfg_options; - vector<shared_ptr<FsaFeatureFunction> > fsa_ffs; + vector<boost::shared_ptr<FsaFeatureFunction> > fsa_ffs; vector<string> fsa_names; #endif - shared_ptr<RandomNumberGenerator<boost::mt19937> > rng; + boost::shared_ptr<RandomNumberGenerator<boost::mt19937> > rng; int sample_max_trans; bool aligner_mode; bool graphviz; @@ -310,7 +309,7 @@ struct DecoderImpl { bool kbest; bool unique_kbest; bool get_oracle_forest; - shared_ptr<WriteFile> extract_file; + boost::shared_ptr<WriteFile> extract_file; int combine_size; int sent_id; SparseVector<prob_t> acc_vec; // accumulate gradient @@ -622,7 +621,7 @@ DecoderImpl::DecoderImpl(po::variables_map& conf, int argc, char** argv, istream } // set up weight vectors since later phases may reuse weights from earlier phases - shared_ptr<vector<weight_t> > prev_weights = init_weights; + boost::shared_ptr<vector<weight_t> > prev_weights = init_weights; for (int pass = 0; pass < rescoring_passes.size(); ++pass) { RescoringPass& rp = rescoring_passes[pass]; if (!rp.weight_vector) { |