summaryrefslogtreecommitdiff
path: root/decoder/cfg_format.h
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-10 02:29:56 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-10 02:29:56 +0000
commit52c656a62d05135cf6ffd80249d5a44a07a40816 (patch)
tree7f9c7b0862dc02f2a0b3fbe2c6d6d4c3da9322f7 /decoder/cfg_format.h
parent4f99f17541c1fe104afbcf04e3d8d04ad9f1227a (diff)
parse trule(string) using lexer - needs testing, affects earley_composer
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@497 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/cfg_format.h')
-rwxr-xr-xdecoder/cfg_format.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/decoder/cfg_format.h b/decoder/cfg_format.h
new file mode 100755
index 00000000..1bce3d06
--- /dev/null
+++ b/decoder/cfg_format.h
@@ -0,0 +1,36 @@
+#ifndef CFG_FORMAT_H
+#define CFG_FORMAT_H
+
+#include <program_options.h>
+#include <string>
+
+struct CFGFormat {
+ bool identity_scfg;bool features;bool logprob_feat;bool cfg_comma_nt;std::string goal_nt_name;std::string nt_prefix;
+ template <class Opts> // template to support both printable_opts and boost nonprintable
+ void AddOptions(Opts *opts) {
+ using namespace boost::program_options;
+ using namespace std;
+ opts->add_options()
+ ("identity_scfg",defaulted_value(&identity_scfg),"output an identity SCFG: add an identity target side - '[X12] ||| [X13,1] a ||| [1] a ||| feat= ...' - the redundant target '[1] a |||' is omitted otherwise.")
+ ("features",defaulted_value(&features),"print the CFG feature vector")
+ ("logprob_feat",defaulted_value(&logprob_feat),"print a LogProb=-1.5 feature irrespective of --features.")
+ ("cfg_comma_nt",defaulted_value(&cfg_comma_nt),"if false, omit the usual [NP,1] ',1' variable index in the source side")
+ ("goal_nt_name",defaulted_value(&goal_nt_name),"if nonempty, the first production will be '[goal_nt_name] ||| [x123] ||| LogProb=y' where x123 is the actual goal nt, and y is the pushed prob, if any")
+ ("nt_prefix",defaulted_value(&nt_prefix),"NTs are [<nt_prefix>123] where 123 is the node number starting at 0, and the highest node (last in file) is the goal node in an acyclic hypergraph")
+ ;
+ }
+ void set_defaults() {
+ identity_scfg=false;
+ features=true;
+ logprob_feat=true;
+ cfg_comma_nt=true;
+ goal_nt_name="S";
+ nt_prefix="";
+ }
+ CFGFormat() {
+ set_defaults();
+ }
+};
+
+
+#endif