From c57dda7e1e8bcc13dff508752f778c1c95c9f895 Mon Sep 17 00:00:00 2001 From: graehl Date: Wed, 1 Sep 2010 00:05:14 +0000 Subject: fsa notes git-svn-id: https://ws10smt.googlecode.com/svn/trunk@638 ec762483-ff6d-05da-a07a-a48fb63a330f --- decoder/apply_fsa_models.cc | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'decoder/apply_fsa_models.cc') diff --git a/decoder/apply_fsa_models.cc b/decoder/apply_fsa_models.cc index 4431643f..bffd7033 100755 --- a/decoder/apply_fsa_models.cc +++ b/decoder/apply_fsa_models.cc @@ -1,3 +1,7 @@ +//see apply_fsa_models.README for notes on the l2r earley fsa+cfg intersection +//implementation in this file (also some comments in this file) +#define SAFE_VALGRIND 1 + #include "apply_fsa_models.h" #include #include @@ -21,7 +25,6 @@ #include "show.h" #include "string_to.h" -#define SAFE_VALGRIND 1 #define DFSA(x) x //fsa earley chart @@ -78,20 +81,13 @@ I'm using option 1. */ // if we don't greedy-binarize, we want to encode recognized prefixes p (X -> p . rest) efficiently. if we're doing this, we may as well also push costs so we can best-first select rules in a lazy fashion. this is effectively left-branching binarization, of course. + template struct fsa_map_type { - typedef std::map type; + typedef std::map type; // change to HASH_MAP ? }; -//template typedef +//template typedef - and macro to make it less painful #define FSA_MAP(k,v) fsa_map_type >::type -typedef WordID LHS; // so this will be -NTHandle. - -struct get_second { - template - typename P::second_type const& operator()(P const& p) const { - return p.second; - } -}; struct PrefixTrieNode; typedef PrefixTrieNode *NodeP; @@ -136,7 +132,6 @@ ostream& print_map_by_nt(std::ostream &o,V const& v,CFG const*pcfg=print_cfg,cha return o; } - struct PrefixTrieEdge { PrefixTrieEdge() // : dest(0),w(TD::max_wordid) @@ -164,10 +159,8 @@ struct PrefixTrieEdge { print_cfg_rhs(o,w); o<<"{"<"<