commit f423f09250e3925313ceba178747055b4b1e3ac9 Author: Ahmed Siam Date: Wed Mar 29 14:44:32 2023 +0200 Add option to set compound_max_elements in lt-proc. diff --git a/lttoolbox/fst_processor.cc b/lttoolbox/fst_processor.cc index fe188b5..198d2be 100644 --- a/lttoolbox/fst_processor.cc +++ b/lttoolbox/fst_processor.cc @@ -2627,6 +2627,12 @@ FSTProcessor::setMaxWeightClassesValue(int value) maxWeightClasses = value; } +void +FSTProcessor::setCompoundMaxElements(int value) +{ + compound_max_elements = value; +} + bool FSTProcessor::getDecompoundingMode() { diff --git a/lttoolbox/fst_processor.h b/lttoolbox/fst_processor.h index 4ddea7a..26aedff 100644 --- a/lttoolbox/fst_processor.h +++ b/lttoolbox/fst_processor.h @@ -507,6 +507,7 @@ public: void setDisplayWeightsMode(bool value); void setMaxAnalysesValue(int value); void setMaxWeightClassesValue(int value); + void setCompoundMaxElements(int value); bool getNullFlush(); bool getDecompoundingMode(); }; diff --git a/lttoolbox/lt_proc.cc b/lttoolbox/lt_proc.cc index 19b2e91..a7f188f 100644 --- a/lttoolbox/lt_proc.cc +++ b/lttoolbox/lt_proc.cc @@ -59,6 +59,7 @@ int main(int argc, char *argv[]) cli.add_bool_arg('W', "show-weights", "Print final analysis weights (if any)"); cli.add_str_arg('N', "analyses", "Output no more than N analyses (if the transducer is weighted, the N best analyses)", "N"); cli.add_str_arg('L', "weight-classes", "Output no more than N best weight classes (where analyses with equal weight constitute a class)", "N"); + cli.add_str_arg('M', "compound-max-elements", "Set compound max elements", "N"); cli.add_bool_arg('h', "help", "show this help"); cli.parse_args(argc, argv); @@ -157,6 +158,14 @@ int main(int argc, char *argv[]) } fstp.setMaxWeightClassesValue(n); } + if (strs.find("compound-max-elements") != strs.end()) { // Test + int n = atoi(strs["compound-max-elements"].back().c_str()); + if (n < 1) { + std::cerr << "Invalid or no argument for compound max elements" << std::endl; + exit(EXIT_FAILURE); + } + fstp.setCompoundMaxElements(n); + } FILE* in = openInBinFile(cli.get_files()[0]); fstp.load(in);