diff options
author | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-13 03:30:49 +0000 |
---|---|---|
committer | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-13 03:30:49 +0000 |
commit | 6ca64b5cf2d4c0c2698d4298e88dde274f766ac4 (patch) | |
tree | c37af6ea1ae5159b8bea55a94b120359ba9188c3 /decoder/apply_fsa_models.cc | |
parent | e1458e933f41a95bb5f98aeffbc15242ef7752f1 (diff) |
named_enum, itoa, cdec replace --a-b=x with --a_b=x
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@536 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/apply_fsa_models.cc')
-rwxr-xr-x | decoder/apply_fsa_models.cc | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/decoder/apply_fsa_models.cc b/decoder/apply_fsa_models.cc index 1c30eb90..2854b28b 100755 --- a/decoder/apply_fsa_models.cc +++ b/decoder/apply_fsa_models.cc @@ -13,6 +13,8 @@ using namespace std; +DEFINE_NAMED_ENUM(FSA_BY) + struct ApplyFsa { ApplyFsa(HgCFG &i, const SentenceMetadata& smeta, @@ -74,6 +76,7 @@ void ApplyFsaModels(HgCFG &i, a.Compute(); } +/* namespace { char const* anames[]={ "BU_CUBE", @@ -82,14 +85,18 @@ char const* anames[]={ 0 }; } +*/ //TODO: named enum type in boost? std::string ApplyFsaBy::name() const { - return anames[algorithm]; +// return anames[algorithm]; + return GetName(algorithm); } std::string ApplyFsaBy::all_names() { + return FsaByNames(" "); + /* std::ostringstream o; for (int i=0;i<N_ALGORITHMS;++i) { assert(anames[i]); @@ -97,19 +104,24 @@ std::string ApplyFsaBy::all_names() { o<<anames[i]; } return o.str(); + */ } ApplyFsaBy::ApplyFsaBy(std::string const& n, int pop_limit) : pop_limit(pop_limit) { - algorithm=0; std::string uname=toupper(n); + algorithm=GetFsaBy(uname); +/*anames=0; while(anames[algorithm] && anames[algorithm] != uname) ++algorithm; if (!anames[algorithm]) throw std::runtime_error("Unknown ApplyFsaBy type: "+n+" - legal types: "+all_names()); +*/ } -ApplyFsaBy::ApplyFsaBy(int i, int pop_limit) : pop_limit(pop_limit) { - if (i<0 || i>=N_ALGORITHMS) +ApplyFsaBy::ApplyFsaBy(FsaBy i, int pop_limit) : pop_limit(pop_limit) { +/* if (i<0 || i>=N_ALGORITHMS) throw std::runtime_error("Unknown ApplyFsaBy type id: "+itos(i)+" - legal types: "+all_names()); +*/ + GetName(i); // checks validity algorithm=i; } |