File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,6 +39,9 @@ int main(int argc, char *argv[]) {
3939
4040 ParseOptions po (usage);
4141
42+ bool strict = true ;
43+ po.Register (" strict" , &strict, " Will allow 0 lattice if it is set to false." );
44+
4245 po.Read (argc, argv);
4346
4447 if (po.NumArgs () < 2 || po.NumArgs () > 3 ) {
@@ -64,6 +67,8 @@ int main(int argc, char *argv[]) {
6467 n_done++;
6568 }
6669
70+ KALDI_LOG << " Union done, now optimization." ;
71+
6772 // Do the encoded epsilon removal, determinization and minimization
6873 KwsLexicographicFst ifst = global_index;
6974 EncodeMapper<KwsLexicographicArc> encoder (kEncodeLabels , ENCODE );
@@ -76,7 +81,10 @@ int main(int argc, char *argv[]) {
7681 index_writer.Write (" global" , global_index);
7782
7883 KALDI_LOG << " Done " << n_done << " indices" ;
79- return (n_done != 0 ? 0 : 1 );
84+ if (strict == true )
85+ return (n_done != 0 ? 0 : 1 );
86+ else
87+ return 0 ;
8088 } catch (const std::exception &e) {
8189 std::cerr << e.what ();
8290 return -1 ;
Original file line number Diff line number Diff line change @@ -94,9 +94,11 @@ int main(int argc, char *argv[]) {
9494
9595 int32 n_best = -1 ;
9696 double negative_tolerance = -0.1 ;
97+ bool strict = true ;
9798 po.Register (" nbest" , &n_best, " Return the best n hypotheses." );
9899 po.Register (" negative-tolerance" , &negative_tolerance,
99100 " The program will die if we get negative score smaller than the tolerance." );
101+ po.Register (" strict" , &strict, " Will allow 0 lattice if it is set to false." );
100102 if (n_best < 0 && n_best != -1 ) {
101103 KALDI_ERR << " Bad number for nbest" ;
102104 exit (1 );
@@ -212,7 +214,10 @@ int main(int argc, char *argv[]) {
212214 }
213215
214216 KALDI_LOG << " Done " << n_done << " keywords" ;
215- return (n_done != 0 ? 0 : 1 );
217+ if (strict == true )
218+ return (n_done != 0 ? 0 : 1 );
219+ else
220+ return 0 ;
216221 } catch (const std::exception &e) {
217222 std::cerr << e.what ();
218223 return -1 ;
Original file line number Diff line number Diff line change @@ -43,7 +43,9 @@ int main(int argc, char *argv[]) {
4343 ParseOptions po (usage);
4444
4545 int32 max_silence_frames = 50 ;
46+ bool strict = true ;
4647 po.Register (" max-silence-frames" , &max_silence_frames, " Maximum #frames for silence arc." );
48+ po.Register (" strict" , &strict, " Will allow 0 lattice if it is set to false." );
4749
4850 po.Read (argc, argv);
4951
@@ -144,7 +146,10 @@ int main(int argc, char *argv[]) {
144146 }
145147
146148 KALDI_LOG << " Done " << n_done << " lattices, failed for " << n_fail;
147- return (n_done != 0 ? 0 : 1 );
149+ if (strict == true )
150+ return (n_done != 0 ? 0 : 1 );
151+ else
152+ return 0 ;
148153 } catch (const std::exception &e) {
149154 std::cerr << e.what ();
150155 return -1 ;
You can’t perform that action at this time.
0 commit comments