diff options
-rw-r--r-- | decoder/cdec.cc | 7 | ||||
-rw-r--r-- | decoder/decoder.cc | 5 |
2 files changed, 10 insertions, 2 deletions
diff --git a/decoder/cdec.cc b/decoder/cdec.cc index b47ab380..5c40f56e 100644 --- a/decoder/cdec.cc +++ b/decoder/cdec.cc @@ -12,6 +12,7 @@ int main(int argc, char** argv) { Decoder decoder(argc, argv); const string input = decoder.GetConf()["input"].as<string>(); + const bool show_feature_dictionary = decoder.GetConf().count("show_feature_dictionary"); if (!SILENT) cerr << "Reading input from " << ((input == "-") ? "STDIN" : input.c_str()) << endl; ReadFile in_read(input); istream *in = in_read.stream(); @@ -23,6 +24,12 @@ int main(int argc, char** argv) { if (buf.empty()) continue; decoder.Decode(buf); } + if (show_feature_dictionary) { + int num = FD::NumFeats(); + for (int i = 1; i < num; ++i) { + cout << FD::Convert(i) << endl; + } + } return 0; } diff --git a/decoder/decoder.cc b/decoder/decoder.cc index d2b64285..0d7e84ad 100644 --- a/decoder/decoder.cc +++ b/decoder/decoder.cc @@ -394,6 +394,7 @@ DecoderImpl::DecoderImpl(po::variables_map& conf, int argc, char** argv, istream ("quiet", "Disable verbose output") ("show_config", po::bool_switch(&show_config), "show contents of loaded -c config files.") ("show_weights", po::bool_switch(&show_weights), "show effective feature weights") + ("show_feature_dictionary", "After decoding the last input, write the contents of the feature dictionary") ("show_joshua_visualization,J", "Produce output compatible with the Joshua visualization tools") ("show_tree_structure", "Show the Viterbi derivation structure") ("show_expected_length", "Show the expected translation length under the model") @@ -417,8 +418,8 @@ DecoderImpl::DecoderImpl(po::variables_map& conf, int argc, char** argv, istream ("max_translation_sample,X", po::value<int>(), "Sample the max translation from the chart") ("pb_max_distortion,D", po::value<int>()->default_value(4), "Phrase-based decoder: maximum distortion") ("cll_gradient,G","Compute conditional log-likelihood gradient and write to STDOUT (src & ref required)") - ("get_oracle_forest,o", "Calculate rescored hypregraph using approximate BLEU scoring of rules") - ("feature_expectations","Write feature expectations for all features in chart (**OBJ** will be the partition)") + ("get_oracle_forest,o", "Calculate rescored hypregraph using approximate BLEU scoring of rules") + ("feature_expectations","Write feature expectations for all features in chart (**OBJ** will be the partition)") ("vector_format",po::value<string>()->default_value("b64"), "Sparse vector serialization format for feature expectations or gradients, includes (text or b64)") ("combine_size,C",po::value<int>()->default_value(1), "When option -G is used, process this many sentence pairs before writing the gradient (1=emit after every sentence pair)") ("forest_output,O",po::value<string>(),"Directory to write forests to"); |