summaryrefslogtreecommitdiff
path: root/decoder/apply_fsa_models.h
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-10 23:49:33 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-10 23:49:33 +0000
commit46dd30c7d4da68b83ebfd5975153521ee237311f (patch)
treeaba07e1f24639c56b341393880b67987b08854da /decoder/apply_fsa_models.h
parent0fec6f37266ecbaf6f72d2f3d7e652c78004af17 (diff)
CFG binarize opts
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@503 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/apply_fsa_models.h')
-rwxr-xr-xdecoder/apply_fsa_models.h43
1 files changed, 3 insertions, 40 deletions
diff --git a/decoder/apply_fsa_models.h b/decoder/apply_fsa_models.h
index 0227664a..5120fb4e 100755
--- a/decoder/apply_fsa_models.h
+++ b/decoder/apply_fsa_models.h
@@ -4,11 +4,11 @@
#include <string>
#include <iostream>
#include "feature_vector.h"
-#include "cfg.h"
struct FsaFeatureFunction;
struct Hypergraph;
struct SentenceMetadata;
+struct HgCFG;
struct ApplyFsaBy {
enum {
@@ -36,40 +36,6 @@ struct ApplyFsaBy {
static std::string all_names(); // space separated
};
-// in case you might want the CFG whether or not you apply FSA models:
-struct HgCFG {
- HgCFG(Hypergraph const& ih) : ih(ih) { have_cfg=false; }
- Hypergraph const& ih;
- CFG cfg;
- bool have_cfg;
- void InitCFG(CFG &to) {
- to.Init(ih,true,false,true);
- }
-
- CFG &GetCFG()
- {
- if (!have_cfg) {
- have_cfg=true;
- InitCFG(cfg);
- }
- return cfg;
- }
- void GiveCFG(CFG &to) {
- if (!have_cfg)
- InitCFG(to);
- else {
- have_cfg=false;
- to.Clear();
- to.Swap(cfg);
- }
- }
- CFG const& GetCFG() const {
- assert(have_cfg);
- return cfg;
- }
-};
-
-
void ApplyFsaModels(HgCFG &hg_or_cfg_in,
const SentenceMetadata& smeta,
const FsaFeatureFunction& fsa,
@@ -77,15 +43,12 @@ void ApplyFsaModels(HgCFG &hg_or_cfg_in,
ApplyFsaBy const& cfg,
Hypergraph* out);
-inline void ApplyFsaModels(Hypergraph const& ih,
+void ApplyFsaModels(Hypergraph const& ih,
const SentenceMetadata& smeta,
const FsaFeatureFunction& fsa,
DenseWeightVector const& weights, // pre: in is weighted by these (except with fsa featval=0 before this)
ApplyFsaBy const& cfg,
- Hypergraph* out) {
- HgCFG i(ih);
- ApplyFsaModels(i,smeta,fsa,weights,cfg,out);
-}
+ Hypergraph* out);
#endif