/
m_options.c
1564 lines (1533 loc) · 63.4 KB
/
m_options.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* @file m_options.c
*
* <JA>
* @brief オプション処理
*
* ここにある関数は,jconfファイルおよびコマンドラインからのオプション指定を
* 順に読み込み,値を格納する.
* </JA>
*
* <EN>
* @brief Option parsing.
*
* These functions read option strings from jconf file or command line
* and set values to the configuration structure.
* </EN>
*
* @author Akinobu Lee
* @date Thu May 12 18:52:07 2005
*
* $Revision: 1.32 $
*
*/
/*
* Copyright (c) 1991-2013 Kawahara Lab., Kyoto University
* Copyright (c) 2000-2005 Shikano Lab., Nara Institute of Science and Technology
* Copyright (c) 2005-2013 Julius project team, Nagoya Institute of Technology
* All rights reserved
*/
#include <julius/julius.h>
/**
* <JA>
* @brief 相対パスをフルパスに変換する.
*
* ファイルのパス名が相対パスであれば,カレントディレクトリをつけた
* フルパスに変換して返す. 絶対パスであれば,そのまま返す.
*
* @param filename [in] ファイルのパス名
* @param dirname [in] カレントディレクトリのパス名
*
* @return 絶対パス名の入った,新たに割り付けられたバッファ
* </JA>
* <EN>
* @brief Change relative path to full path.
*
* If the file path is given as relative, prepend the dirname to it.
* If the file path is full, just copy it to new buffer and return.
*
* @param filename [in] file path name
* @param dirname [in] full path of current directory
*
* @return newly malloced buffer holding the full path name.
* </EN>
*/
char *
filepath(char *filename, char *dirname)
{
char *p;
if (dirname != NULL && filename[0] != '/'
#if defined(_WIN32)
&& filename[0] != '\\' && !(strlen(filename) >= 3 && filename[1] == ':')
#endif
) {
p = (char *)mymalloc(strlen(filename) + strlen(dirname) + 1);
strcpy(p, dirname);
strcat(p, filename);
} else {
p = strcpy((char *)mymalloc(strlen(filename)+1), filename);
}
return p;
}
/**
* <EN>
* Returns next argument string.
* </EN>
* <JA>
* 次の引数の文字列を返す.
* </JA>
*
* @param cur [i/o] pointer to current point of the argment array
* @param argc [in] total number of argments
* @param argv [in] argment array
*
* @return pointer to the next argument, or NULL if no more argument vailable.
*
*/
static char *
next_arg(int *cur, int argc, char *argv[])
{
(*cur)++;
if (*cur >= argc) {
jlog("ERROR: m_options: option requires argument -- %s\n", argv[*cur-1]);
return NULL;
}
return(argv[*cur]);
}
static boolean
check_section(Jconf *jconf, char *optname, short sec)
{
if (! jconf->optsectioning) return TRUE;
if (jconf->optsection == sec) return TRUE;
if (jconf->optsection == JCONF_OPT_DEFAULT) return TRUE;
switch(sec) {
case JCONF_OPT_GLOBAL:
jlog("ERROR: \"%s\" is global option (should be before any instance declaration)", optname); break;
case JCONF_OPT_AM:
jlog("ERROR: \"%s\" is AM option", optname); break;
case JCONF_OPT_LM:
jlog("ERROR: \"%s\" is LM option", optname); break;
case JCONF_OPT_SR:
jlog("ERROR: \"%s\" is SR (search) option", optname); break;
}
switch(jconf->optsection) {
case JCONF_OPT_GLOBAL:
jlog(", but exists at global section (-GLOBAL)\n"); break;
case JCONF_OPT_AM:
jlog(", but exists at AM section (-AM \"%s\")\n", jconf->amnow->name); break;
case JCONF_OPT_LM:
jlog(", but exists at LM section (-LM \"%s\")\n", jconf->lmnow->name); break;
case JCONF_OPT_SR:
jlog(", but exists at recognizer section (-SR \"%s\")\n", jconf->searchnow->name); break;
}
jlog("ERROR: fix it, or you can disable this check by \"-nosectioncheck\"\n");
return FALSE;
}
/**
* <JA>
* メモリ領域を解放し NULL で埋める.
* @param p [i/o] メモリ領域の先頭を指すポインタ変数へのポインタ
* @note @a p が NULL の場合は何も起こらない。
* </JA>
* <EN>
* Free memory and fill it with NULL.
* @param p [i/o] pointer to pointer that holds allocated address
* @note Nothing will happen if @a p equals to NULL.
* </EN>
*/
#define FREE_MEMORY(p) \
{if (p) {free(p); p = NULL;}}
/**
* <JA>
* オプション解析.
*
* @param argc [in] @a argv に含まれる引数の数
* @param argv [in] 引数値(文字列)の配列
* @param cwd [in] カレントディレクトリ
* @param jconf [out] 値を格納するjconf構造体
*
* </JA>
* <EN>
* Option parsing.
*
* @param argc [in] number of elements in @a argv
* @param argv [in] array of argument strings
* @param cwd [in] current directory
* @param jconf [out] jconf structure to store data
*
* </EN>
* @return TRUE on success, or FALSE on error.
*
* @callgraph
* @callergraph
*/
boolean
opt_parse(int argc, char *argv[], char *cwd, Jconf *jconf)
{
char *tmparg;
int i;
boolean unknown_opt;
JCONF_AM *amconf, *atmp;
JCONF_LM *lmconf, *ltmp;
JCONF_SEARCH *sconf;
char sname[JCONF_MODULENAME_MAXLEN];
#ifdef ENABLE_PLUGIN
int sid;
FUNC_INT func;
#endif
#define GET_TMPARG if ((tmparg = next_arg(&i, argc, argv)) == NULL) return FALSE
for (i=1;i<argc;i++) {
unknown_opt = FALSE;
if (strmatch(argv[i],"-C")) { /* include jconf file */
GET_TMPARG;
tmparg = filepath(tmparg, cwd);
if (config_file_parse(tmparg, jconf) == FALSE) {
return FALSE;
}
free(tmparg);
continue;
} else if (strmatch(argv[i],"-AM") || strmatch(argv[i], "[AM]")) {
GET_TMPARG;
if (tmparg[0] == '-') {
jlog("ERROR: m_options: -AM needs an argument as module name\n");
return FALSE;
}
if (tmparg[0] >= '0' && tmparg[0] <= '9') {
jlog("ERROR: m_options: AM name \"%s\" not acceptable: first character should not be a digit\n", tmparg);
return FALSE;
}
/* if not first time, create new module instance and switch to it */
/* and switch current to this */
amconf = j_jconf_am_new();
if (j_jconf_am_regist(jconf, amconf, tmparg) == FALSE) {
jlog("ERROR: failed to add new amconf as \"%s\"\n", tmparg);
jlog("ERROR: m_options: failed to create amconf\n");
j_jconf_am_free(amconf);
return FALSE;
}
jconf->amnow = amconf;
jconf->optsection = JCONF_OPT_AM;
continue;
} else if (strmatch(argv[i],"-AM_GMM") || strmatch(argv[i], "[AM_GMM]")) {
/* switch current to GMM */
if (jconf->gmm == NULL) {
/* if new, allocate jconf for GMM */
jconf->gmm = j_jconf_am_new();
}
jconf->amnow = jconf->gmm;
jconf->optsection = JCONF_OPT_AM;
continue;
} else if (strmatch(argv[i],"-LM") || strmatch(argv[i], "[LM]")) {
GET_TMPARG;
if (tmparg[0] == '-') {
jlog("ERROR: m_options: -LM needs an argument as module name\n");
return FALSE;
}
if (tmparg[0] >= '0' && tmparg[0] <= '9') {
jlog("ERROR: m_options: LM name \"%s\" not acceptable: first character should not be a digit\n", tmparg);
return FALSE;
}
/* create new module instance and switch to it */
/* and switch current to this */
lmconf = j_jconf_lm_new();
if (j_jconf_lm_regist(jconf, lmconf, tmparg) == FALSE) {
jlog("ERROR: failed to add new lmconf as \"%s\"\n", tmparg);
jlog("ERROR: m_options: failed to create lmconf\n");
j_jconf_lm_free(lmconf);
return FALSE;
}
jconf->lmnow = lmconf;
jconf->optsection = JCONF_OPT_LM;
continue;
} else if (strmatch(argv[i],"-SR") || strmatch(argv[i], "[SR]")) {
GET_TMPARG;
if (tmparg[0] == '-') {
jlog("ERROR: m_options: -SR needs three arguments: module name, AM name and LM name\n");
return FALSE;
}
if (tmparg[0] >= '0' && tmparg[0] <= '9') {
jlog("ERROR: m_options: SR name \"%s\" not acceptable: first character should not be a digit\n", tmparg);
return FALSE;
}
/* store name temporarly */
strncpy(sname, tmparg, JCONF_MODULENAME_MAXLEN);
/* get link to jconf_am and jconf_lm */
GET_TMPARG;
if (tmparg[0] == '-') {
jlog("ERROR: m_options: -SR needs three arguments: module name, AM name and LM name\n");
return FALSE;
}
if (tmparg[0] >= '0' && tmparg[0] <= '9') { /* arg is number */
if ((amconf = j_get_amconf_by_id(jconf, atoi(tmparg))) == NULL) return FALSE;
} else { /* name string */
if ((amconf = j_get_amconf_by_name(jconf, tmparg)) == NULL) return FALSE;
}
GET_TMPARG;
if (tmparg[0] == '-') {
jlog("ERROR: m_options: -SR needs three arguments: module name, AM name and LM name\n");
return FALSE;
}
if (tmparg[0] >= '0' && tmparg[0] <= '9') { /* arg is number */
if ((lmconf = j_get_lmconf_by_id(jconf, atoi(tmparg))) == NULL) return FALSE;
} else { /* name string */
if ((lmconf = j_get_lmconf_by_name(jconf, tmparg)) == NULL) return FALSE;
}
/* check to avoid assigning an LM for multiple SR */
for(sconf=jconf->search_root;sconf;sconf=sconf->next) {
if (sconf->lmconf == lmconf) {
jlog("ERROR: you are going to share LM \"%s\" among multiple SRs\n");
jlog("ERROR: current Julius cannot share LM among SRs\n");
jlog("ERROR: you should define LM for each SR\n");
return FALSE;
}
}
/* if not first time, create new module instance and switch to it */
sconf = j_jconf_search_new();
sconf->amconf = amconf;
sconf->lmconf = lmconf;
if (j_jconf_search_regist(jconf, sconf, sname) == FALSE) {
jlog("ERROR: failed to add new amconf as \"%s\"\n", sname);
jlog("ERROR: m_options: failed to create search conf\n");
j_jconf_search_free(sconf);
return FALSE;
}
jconf->searchnow = sconf;
jconf->optsection = JCONF_OPT_SR;
continue;
} else if (strmatch(argv[i],"-GLOBAL")) {
jconf->optsection = JCONF_OPT_GLOBAL;
continue;
} else if (strmatch(argv[i],"-sectioncheck")) { /* enable section check */
jconf->optsectioning = TRUE;
continue;
} else if (strmatch(argv[i],"-nosectioncheck")) { /* disable section check */
jconf->optsectioning = FALSE;
continue;
} else if (strmatch(argv[i],"-input")) { /* speech input */
if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE;
GET_TMPARG;
jconf->input.plugin_source = -1;
if (strmatch(tmparg,"file") || strmatch(tmparg,"rawfile")) {
jconf->input.type = INPUT_WAVEFORM;
jconf->input.speech_input = SP_RAWFILE;
jconf->decodeopt.realtime_flag = FALSE;
} else if (strmatch(tmparg,"htkparam") || strmatch(tmparg,"mfcfile") || strmatch(tmparg,"mfc")) {
jconf->input.type = INPUT_VECTOR;
jconf->input.speech_input = SP_MFCFILE;
jconf->decodeopt.realtime_flag = FALSE;
} else if (strmatch(tmparg,"outprob")) {
jconf->input.type = INPUT_VECTOR;
jconf->input.speech_input = SP_OUTPROBFILE;
jconf->decodeopt.realtime_flag = FALSE;
} else if (strmatch(tmparg,"stdin")) {
jconf->input.type = INPUT_WAVEFORM;
jconf->input.speech_input = SP_STDIN;
jconf->decodeopt.realtime_flag = FALSE;
} else if (strmatch(tmparg,"adinnet")) {
jconf->input.type = INPUT_WAVEFORM;
jconf->input.speech_input = SP_ADINNET;
jconf->decodeopt.realtime_flag = TRUE;
#ifdef USE_NETAUDIO
} else if (strmatch(tmparg,"netaudio")) {
jconf->input.type = INPUT_WAVEFORM;
jconf->input.speech_input = SP_NETAUDIO;
jconf->decodeopt.realtime_flag = TRUE;
#endif
#ifdef USE_MIC
} else if (strmatch(tmparg,"mic")) {
jconf->input.type = INPUT_WAVEFORM;
jconf->input.speech_input = SP_MIC;
jconf->input.device = SP_INPUT_DEFAULT;
jconf->decodeopt.realtime_flag = TRUE;
} else if (strmatch(tmparg,"alsa")) {
#ifdef HAS_ALSA
jconf->input.type = INPUT_WAVEFORM;
jconf->input.speech_input = SP_MIC;
jconf->input.device = SP_INPUT_ALSA;
jconf->decodeopt.realtime_flag = TRUE;
#else
jlog("ERROR: m_options: \"-input alsa\": ALSA support is not built-in\n");
return FALSE;
#endif
} else if (strmatch(tmparg,"oss")) {
#ifdef HAS_OSS
jconf->input.type = INPUT_WAVEFORM;
jconf->input.speech_input = SP_MIC;
jconf->input.device = SP_INPUT_OSS;
jconf->decodeopt.realtime_flag = TRUE;
#else
jlog("ERROR: m_options: \"-input oss\": OSS support is not built-in\n");
return FALSE;
#endif
} else if (strmatch(tmparg,"esd")) {
#ifdef HAS_ESD
jconf->input.type = INPUT_WAVEFORM;
jconf->input.speech_input = SP_MIC;
jconf->input.device = SP_INPUT_ESD;
jconf->decodeopt.realtime_flag = TRUE;
#else
jlog("ERROR: m_options: \"-input esd\": ESounD support is not built-in\n");
return FALSE;
#endif
} else if (strmatch(tmparg,"pulseaudio")) {
#ifdef HAS_PULSEAUDIO
jconf->input.type = INPUT_WAVEFORM;
jconf->input.speech_input = SP_MIC;
jconf->input.device = SP_INPUT_PULSEAUDIO;
jconf->decodeopt.realtime_flag = TRUE;
#else
jlog("ERROR: m_options: \"-input pulseaudio\": PulseAudio support is not built-in\n");
return FALSE;
#endif
#endif
} else if (strmatch(tmparg,"vecnet")) {
jconf->input.plugin_source = -1;
jconf->input.type = INPUT_VECTOR;
jconf->input.speech_input = SP_MFCMODULE;
jconf->decodeopt.realtime_flag = FALSE;
#ifdef ENABLE_PLUGIN
} else if ((sid = plugin_find_optname("adin_get_optname", tmparg)) != -1) { /* adin plugin */
jconf->input.plugin_source = sid;
jconf->input.type = INPUT_WAVEFORM;
jconf->input.speech_input = SP_MIC;
func = (FUNC_INT) plugin_get_func(sid, "adin_get_configuration");
if (func == NULL) {
jlog("ERROR: invalid plugin: adin_get_configuration() not exist\n");
jlog("ERROR: skip option \"-input %s\"\n", tmparg);
continue;
}
jconf->decodeopt.realtime_flag = (*func)(0);
} else if ((sid = plugin_find_optname("fvin_get_optname", tmparg)) != -1) { /* vector input plugin */
jconf->input.plugin_source = sid;
jconf->input.type = INPUT_VECTOR;
jconf->input.speech_input = SP_MFCMODULE;
jconf->decodeopt.realtime_flag = FALSE;
#endif
} else {
jlog("ERROR: m_options: unknown speech input source \"%s\"\n", tmparg);
return FALSE;
}
continue;
} else if (strmatch(argv[i],"-filelist")) { /* input file list */
if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE;
GET_TMPARG;
FREE_MEMORY(jconf->input.inputlist_filename);
//jconf->input.inputlist_filename = strcpy((char*)mymalloc(strlen(tmparg)+1),tmparg);
jconf->input.inputlist_filename = filepath(tmparg, cwd);
continue;
} else if (strmatch(argv[i],"-rejectshort")) { /* short input rejection */
if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE;
GET_TMPARG;
jconf->reject.rejectshortlen = atoi(tmparg);
continue;
} else if (strmatch(argv[i],"-rejectlong")) { /* long input rejection */
if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE;
GET_TMPARG;
jconf->reject.rejectlonglen = atoi(tmparg);
continue;
#ifdef POWER_REJECT
} else if (strmatch(argv[i],"-powerthres")) { /* short input rejection */
if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE;
GET_TMPARG;
jconf->reject.powerthres = atoi(tmparg);
continue;
#endif
} else if (strmatch(argv[i],"-force_realtime")) { /* force realtime */
if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE;
GET_TMPARG;
if (strmatch(tmparg, "on")) {
jconf->decodeopt.forced_realtime = TRUE;
} else if (strmatch(tmparg, "off")) {
jconf->decodeopt.forced_realtime = FALSE;
} else {
jlog("ERROR: m_options: \"-force_realtime\" should be either \"on\" or \"off\"\n");
return FALSE;
}
jconf->decodeopt.force_realtime_flag = TRUE;
continue;
} else if (strmatch(argv[i],"-realtime")) { /* equal to "-force_realtime on" */
if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE;
jconf->decodeopt.forced_realtime = TRUE;
jconf->decodeopt.force_realtime_flag = TRUE;
continue;
} else if (strmatch(argv[i], "-norealtime")) { /* equal to "-force_realtime off" */
if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE;
jconf->decodeopt.forced_realtime = FALSE;
jconf->decodeopt.force_realtime_flag = TRUE;
continue;
} else if (strmatch(argv[i],"-forcedict")) { /* skip dict error */
if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE;
jconf->lmnow->forcedict_flag = TRUE;
continue;
} else if (strmatch(argv[i],"-check")) { /* interactive model check mode */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
GET_TMPARG;
if (strmatch(tmparg, "wchmm")) {
jconf->searchnow->sw.wchmm_check_flag = TRUE;
} else if (strmatch(tmparg, "trellis")) {
jconf->searchnow->sw.trellis_check_flag = TRUE;
} else if (strmatch(tmparg, "triphone")) {
jconf->searchnow->sw.triphone_check_flag = TRUE;
} else {
jlog("ERROR: m_options: invalid argument for \"-check\": %s\n", tmparg);
return FALSE;
}
continue;
} else if (strmatch(argv[i],"-notypecheck")) { /* don't check param type */
if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE;
jconf->input.paramtype_check_flag = FALSE;
continue;
} else if (strmatch(argv[i],"-nlimit")) { /* limit N token in a node */
#ifdef WPAIR_KEEP_NLIMIT
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
GET_TMPARG;
jconf->searchnow->pass1.wpair_keep_nlimit = atoi(tmparg);
#else
jlog("WARNING: m_options: WPAIR_KEEP_NLIMIT disabled, \"-nlimit\" ignored\n");
#endif
continue;
} else if (strmatch(argv[i],"-lookuprange")) { /* trellis neighbor range */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
GET_TMPARG;
jconf->searchnow->pass2.lookup_range = atoi(tmparg);
continue;
} else if (strmatch(argv[i],"-graphout")) { /* enable graph output */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
jconf->searchnow->graph.enabled = TRUE;
jconf->searchnow->graph.lattice = TRUE;
jconf->searchnow->graph.confnet = FALSE;
continue;
} else if (strmatch(argv[i],"-lattice")) { /* enable graph output */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
jconf->searchnow->graph.enabled = TRUE;
jconf->searchnow->graph.lattice = TRUE;
continue;
} else if (strmatch(argv[i],"-nolattice")) { /* disable graph output */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
jconf->searchnow->graph.enabled = FALSE;
jconf->searchnow->graph.lattice = FALSE;
continue;
} else if (strmatch(argv[i],"-confnet")) { /* enable confusion network */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
jconf->searchnow->graph.enabled = TRUE;
jconf->searchnow->graph.confnet = TRUE;
continue;
} else if (strmatch(argv[i],"-noconfnet")) { /* disable graph output */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
jconf->searchnow->graph.enabled = FALSE;
jconf->searchnow->graph.confnet = FALSE;
continue;
} else if (strmatch(argv[i],"-graphrange")) { /* neighbor merge range frame */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
GET_TMPARG;
jconf->searchnow->graph.graph_merge_neighbor_range = atoi(tmparg);
continue;
#ifdef GRAPHOUT_DEPTHCUT
} else if (strmatch(argv[i],"-graphcut")) { /* cut graph word by depth */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
GET_TMPARG;
jconf->searchnow->graph.graphout_cut_depth = atoi(tmparg);
continue;
#endif
#ifdef GRAPHOUT_LIMIT_BOUNDARY_LOOP
} else if (strmatch(argv[i],"-graphboundloop")) { /* neighbor merge range frame */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
GET_TMPARG;
jconf->searchnow->graph.graphout_limit_boundary_loop_num = atoi(tmparg);
continue;
#endif
#ifdef GRAPHOUT_SEARCH_DELAY_TERMINATION
} else if (strmatch(argv[i],"-graphsearchdelay")) { /* not do graph search termination before the 1st sentence is found */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
jconf->searchnow->graph.graphout_search_delay = TRUE;
continue;
} else if (strmatch(argv[i],"-nographsearchdelay")) { /* not do graph search termination before the 1st sentence is found */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
jconf->searchnow->graph.graphout_search_delay = FALSE;
continue;
#endif
} else if (strmatch(argv[i],"-looktrellis")) { /* activate loopuprange */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
jconf->searchnow->pass2.looktrellis_flag = TRUE;
continue;
} else if (strmatch(argv[i],"-multigramout")) { /* enable per-grammar decoding on 2nd pass */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
jconf->searchnow->output.multigramout_flag = TRUE;
continue;
} else if (strmatch(argv[i],"-nomultigramout")) { /* disable per-grammar decoding on 2nd pass */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
jconf->searchnow->output.multigramout_flag = FALSE;
continue;
} else if (strmatch(argv[i],"-oldtree")) { /* use old tree function */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
jconf->searchnow->pass1.old_tree_function_flag = TRUE;
continue;
} else if (strmatch(argv[i],"-sb")) { /* score envelope width in 2nd pass */
#ifdef SCAN_BEAM
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
GET_TMPARG;
jconf->searchnow->pass2.scan_beam_thres = atof(tmparg);
#else
jlog("WARNING: m_options: SCAN_BEAM disabled, \"-sb\" ignored\n");
#endif
continue;
#ifdef SCORE_PRUNING
} else if (strmatch(argv[i],"-bs")) { /* score beam width for 1st pass */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
GET_TMPARG;
jconf->searchnow->pass1.score_pruning_width = atof(tmparg);
continue;
#endif
} else if (strmatch(argv[i],"-discount")) { /* (bogus) */
jlog("WARNING: m_options: option \"-discount\" is now bogus, ignored\n");
continue;
} else if (strmatch(argv[i],"-cutsilence")) { /* force (long) silence detection on */
if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE;
jconf->detect.silence_cut = 1;
continue;
} else if (strmatch(argv[i],"-nocutsilence")) { /* force (long) silence detection off */
if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE;
jconf->detect.silence_cut = 0;
continue;
} else if (strmatch(argv[i],"-pausesegment")) { /* force (long) silence detection on (for backward compatibility) */
if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE;
jconf->detect.silence_cut = 1;
continue;
} else if (strmatch(argv[i],"-nopausesegment")) { /* force (long) silence detection off (for backward comatibility) */
if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE;
jconf->detect.silence_cut = 0;
continue;
} else if (strmatch(argv[i],"-lv")) { /* silence detection threshold level */
if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE;
GET_TMPARG;
jconf->detect.level_thres = atoi(tmparg);
continue;
} else if (strmatch(argv[i],"-zc")) { /* silence detection zero cross num */
if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE;
GET_TMPARG;
jconf->detect.zero_cross_num = atoi(tmparg);
continue;
} else if (strmatch(argv[i],"-headmargin")) { /* head silence length */
if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE;
GET_TMPARG;
jconf->detect.head_margin_msec = atoi(tmparg);
continue;
} else if (strmatch(argv[i],"-tailmargin")) { /* tail silence length */
if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE;
GET_TMPARG;
jconf->detect.tail_margin_msec = atoi(tmparg);
continue;
} else if (strmatch(argv[i],"-chunksize")) { /* chunk size for detection */
if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE;
GET_TMPARG;
jconf->detect.chunk_size = atoi(tmparg);
continue;
} else if (strmatch(argv[i],"-hipass")||strmatch(argv[i],"-hifreq")) { /* frequency of upper band limit */
if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE;
GET_TMPARG;
jconf->amnow->analysis.para.hipass = atoi(tmparg);
continue;
} else if (strmatch(argv[i],"-lopass")||strmatch(argv[i],"-lofreq")) { /* frequency of lower band limit */
if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE;
GET_TMPARG;
jconf->amnow->analysis.para.lopass = atoi(tmparg);
continue;
} else if (strmatch(argv[i],"-smpPeriod")) { /* sample period (ns) */
if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE;
GET_TMPARG;
jconf->amnow->analysis.para.smp_period = atoi(tmparg);
jconf->amnow->analysis.para.smp_freq = period2freq(jconf->amnow->analysis.para.smp_period);
continue;
} else if (strmatch(argv[i],"-smpFreq")) { /* sample frequency (Hz) */
if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE;
GET_TMPARG;
jconf->amnow->analysis.para.smp_freq = atoi(tmparg);
jconf->amnow->analysis.para.smp_period = freq2period(jconf->amnow->analysis.para.smp_freq);
continue;
} else if (strmatch(argv[i],"-fsize")) { /* Window size */
if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE;
GET_TMPARG;
jconf->amnow->analysis.para.framesize = atoi(tmparg);
continue;
} else if (strmatch(argv[i],"-fshift")) { /* Frame shiht */
if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE;
GET_TMPARG;
jconf->amnow->analysis.para.frameshift = atoi(tmparg);
continue;
} else if (strmatch(argv[i],"-preemph")) {
if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE;
GET_TMPARG;
jconf->amnow->analysis.para.preEmph = atof(tmparg);
continue;
} else if (strmatch(argv[i],"-fbank")) {
if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE;
GET_TMPARG;
jconf->amnow->analysis.para.fbank_num = atoi(tmparg);
continue;
} else if (strmatch(argv[i],"-ceplif")) {
if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE;
GET_TMPARG;
jconf->amnow->analysis.para.lifter = atoi(tmparg);
continue;
} else if (strmatch(argv[i],"-rawe")) {
if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE;
jconf->amnow->analysis.para.raw_e = TRUE;
continue;
} else if (strmatch(argv[i],"-norawe")) {
if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE;
jconf->amnow->analysis.para.raw_e = FALSE;
continue;
} else if (strmatch(argv[i],"-enormal")) {
if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE;
jconf->amnow->analysis.para.enormal = TRUE;
continue;
} else if (strmatch(argv[i],"-noenormal")) {
if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE;
jconf->amnow->analysis.para.enormal = FALSE;
continue;
} else if (strmatch(argv[i],"-escale")) {
if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE;
GET_TMPARG;
jconf->amnow->analysis.para.escale = atof(tmparg);
continue;
} else if (strmatch(argv[i],"-silfloor")) {
if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE;
GET_TMPARG;
jconf->amnow->analysis.para.silFloor = atof(tmparg);
continue;
} else if (strmatch(argv[i],"-delwin")) { /* Delta window length */
if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE;
GET_TMPARG;
jconf->amnow->analysis.para.delWin = atoi(tmparg);
continue;
} else if (strmatch(argv[i],"-accwin")) { /* Acceleration window length */
if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE;
GET_TMPARG;
jconf->amnow->analysis.para.accWin = atoi(tmparg);
continue;
} else if (strmatch(argv[i],"-ssalpha")) { /* alpha coef. for SS */
if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE;
GET_TMPARG;
jconf->amnow->frontend.ss_alpha = atof(tmparg);
continue;
} else if (strmatch(argv[i],"-ssfloor")) { /* spectral floor for SS */
if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE;
GET_TMPARG;
jconf->amnow->frontend.ss_floor = atof(tmparg);
continue;
} else if (strmatch(argv[i],"-cvn")) {
if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE;
jconf->amnow->analysis.para.cvn = 1;
continue;
} else if (strmatch(argv[i],"-nocvn")) {
if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE;
jconf->amnow->analysis.para.cvn = 0;
continue;
} else if (strmatch(argv[i],"-vtln")) { /* VTLN */
if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE;
GET_TMPARG;
jconf->amnow->analysis.para.vtln_alpha = (float)atof(tmparg);
GET_TMPARG;
jconf->amnow->analysis.para.vtln_lower = (float)atof(tmparg);
GET_TMPARG;
jconf->amnow->analysis.para.vtln_upper = (float)atof(tmparg);
continue;
} else if (strmatch(argv[i],"-novtln")) { /* disable VTLN */
if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE;
jconf->amnow->analysis.para.vtln_alpha = 1.0;
continue;
} else if (strmatch(argv[i],"-48")) { /* use 48kHz input and down to 16kHz */
if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE;
jconf->input.use_ds48to16 = TRUE;
continue;
} else if (strmatch(argv[i],"-version") || strmatch(argv[i], "--version") || strmatch(argv[i], "-setting") || strmatch(argv[i], "--setting")) { /* print version and exit */
j_put_header(stderr);
j_put_compile_defs(stderr);
fprintf(stderr, "\n");
j_put_library_defs(stderr);
return FALSE;
} else if (strmatch(argv[i],"-quiet")) { /* minimum output */
debug2_flag = verbose_flag = FALSE;
continue;
} else if (strmatch(argv[i],"-debug")) { /* debug mode: output huge log */
debug2_flag = verbose_flag = TRUE;
continue;
} else if (strmatch(argv[i],"-callbackdebug")) { /* output callback debug message */
callback_debug_flag = TRUE;
continue;
} else if (strmatch(argv[i],"-progout")) { /* enable progressive output */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
jconf->searchnow->output.progout_flag = TRUE;
continue;
} else if (strmatch(argv[i],"-proginterval")) { /* interval for -progout */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
GET_TMPARG;
jconf->searchnow->output.progout_interval = atoi(tmparg);
continue;
} else if (strmatch(argv[i],"-demo")) { /* quiet + progout */
debug2_flag = verbose_flag = FALSE;
jconf->searchnow->output.progout_flag = TRUE;
continue;
} else if (strmatch(argv[i],"-walign")) { /* do forced alignment by word */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
jconf->searchnow->annotate.align_result_word_flag = TRUE;
continue;
} else if (strmatch(argv[i],"-palign")) { /* do forced alignment by phoneme */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
jconf->searchnow->annotate.align_result_phoneme_flag = TRUE;
continue;
} else if (strmatch(argv[i],"-salign")) { /* do forced alignment by state */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
jconf->searchnow->annotate.align_result_state_flag = TRUE;
continue;
} else if (strmatch(argv[i],"-output")) { /* output up to N candidate */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
GET_TMPARG;
jconf->searchnow->output.output_hypo_maxnum = atoi(tmparg);
continue;
} else if (strmatch(argv[i],"-1pass")) { /* do only 1st pass */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
jconf->searchnow->compute_only_1pass = TRUE;
continue;
} else if (strmatch(argv[i],"-hlist")) { /* HMM list file */
if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE;
FREE_MEMORY(jconf->amnow->mapfilename);
GET_TMPARG;
jconf->amnow->mapfilename = filepath(tmparg, cwd);
continue;
} else if (strmatch(argv[i],"-nlr")) { /* word LR n-gram (ARPA) */
if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE;
FREE_MEMORY(jconf->lmnow->ngram_filename_lr_arpa);
GET_TMPARG;
jconf->lmnow->ngram_filename_lr_arpa = filepath(tmparg, cwd);
FREE_MEMORY(jconf->lmnow->ngram_filename);
continue;
} else if (strmatch(argv[i],"-nrl")) { /* word RL n-gram (ARPA) */
if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE;
FREE_MEMORY(jconf->lmnow->ngram_filename_rl_arpa);
GET_TMPARG;
jconf->lmnow->ngram_filename_rl_arpa = filepath(tmparg, cwd);
FREE_MEMORY(jconf->lmnow->ngram_filename);
continue;
} else if (strmatch(argv[i],"-lmp")) { /* LM weight and penalty (pass1) */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
GET_TMPARG;
jconf->searchnow->lmp.lm_weight = (LOGPROB)atof(tmparg);
GET_TMPARG;
jconf->searchnow->lmp.lm_penalty = (LOGPROB)atof(tmparg);
jconf->searchnow->lmp.lmp_specified = TRUE;
continue;
} else if (strmatch(argv[i],"-lmp2")) { /* LM weight and penalty (pass2) */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
GET_TMPARG;
jconf->searchnow->lmp.lm_weight2 = (LOGPROB)atof(tmparg);
GET_TMPARG;
jconf->searchnow->lmp.lm_penalty2 = (LOGPROB)atof(tmparg);
jconf->searchnow->lmp.lmp2_specified = TRUE;
continue;
} else if (strmatch(argv[i],"-transp")) { /* penalty for transparent word */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
GET_TMPARG;
jconf->searchnow->lmp.lm_penalty_trans = (LOGPROB)atof(tmparg);
continue;
} else if (strmatch(argv[i],"-gram")) { /* comma-separatedlist of grammar prefix */
if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE;
GET_TMPARG;
if (multigram_add_prefix_list(tmparg, cwd, jconf->lmnow, LM_DFA_GRAMMAR) == FALSE) {
jlog("ERROR: m_options: failed to read some grammars\n");
return FALSE;
}
continue;
} else if (strmatch(argv[i],"-gramlist")) { /* file of grammar prefix list */
if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE;
GET_TMPARG;
tmparg = filepath(tmparg, cwd);
if (multigram_add_prefix_filelist(tmparg, jconf->lmnow, LM_DFA_GRAMMAR) == FALSE) {
jlog("ERROR: m_options: failed to read some grammars\n");
free(tmparg);
return FALSE;
}
free(tmparg);
continue;
} else if (strmatch(argv[i],"-userlm")) {
if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE;
/* just set lm flags here */
if (jconf->lmnow->lmtype != LM_PROB && jconf->lmnow->lmtype != LM_UNDEF) {
jlog("ERROR: m_options: LM type conflicts: multiple LM specified?\n");
return FALSE;
}
jconf->lmnow->lmtype = LM_PROB;
if (jconf->lmnow->lmvar != LM_UNDEF && jconf->lmnow->lmvar != LM_NGRAM_USER) {
jlog("ERROR: m_options: statistical model conflict\n");
return FALSE;
}
jconf->lmnow->lmvar = LM_NGRAM_USER;
continue;
} else if (strmatch(argv[i],"-nogram")) { /* remove grammar list */
if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE;
multigram_remove_gramlist(jconf->lmnow);
FREE_MEMORY(jconf->lmnow->dfa_filename);
FREE_MEMORY(jconf->lmnow->dictfilename);
if (jconf->lmnow->lmtype == LM_UNDEF) {
jconf->lmnow->lmtype = LM_DFA;
jconf->lmnow->lmvar = LM_DFA_GRAMMAR;
}
continue;
} else if (strmatch(argv[i],"-dfa")) { /* DFA filename */
if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE;
FREE_MEMORY(jconf->lmnow->dfa_filename);
GET_TMPARG;
jconf->lmnow->dfa_filename = filepath(tmparg, cwd);
continue;
} else if (strmatch(argv[i],"-penalty1")) { /* word insertion penalty (pass1) */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
GET_TMPARG;
jconf->searchnow->lmp.penalty1 = (LOGPROB)atof(tmparg);
continue;
} else if (strmatch(argv[i],"-penalty2")) { /* word insertion penalty (pass2) */
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
GET_TMPARG;
jconf->searchnow->lmp.penalty2 = (LOGPROB)atof(tmparg);
continue;
} else if (strmatch(argv[i],"-spmodel") || strmatch(argv[i], "-sp")) { /* name of short pause word */
if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE;
FREE_MEMORY(jconf->amnow->spmodel_name);
GET_TMPARG;
jconf->amnow->spmodel_name = strcpy((char*)mymalloc(strlen(tmparg)+1),tmparg);
continue;
} else if (strmatch(argv[i],"-multipath")) { /* force multipath mode */
if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE;
jconf->amnow->force_multipath = TRUE;
continue;
} else if (strmatch(argv[i],"-iwsp")) { /* enable inter-word short pause handing (for multipath) */
if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE;
jconf->lmnow->enable_iwsp = TRUE;
continue;
} else if (strmatch(argv[i],"-iwsppenalty")) { /* set inter-word short pause transition penalty (for multipath) */
if (!check_section(jconf, argv[i], JCONF_OPT_AM)) return FALSE;
GET_TMPARG;
jconf->amnow->iwsp_penalty = atof(tmparg);
continue;
} else if (strmatch(argv[i],"-silhead")) { /* head silence word name */
if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE;
FREE_MEMORY(jconf->lmnow->head_silname);
GET_TMPARG;
jconf->lmnow->head_silname = strcpy((char*)mymalloc(strlen(tmparg)+1),tmparg);
continue;
} else if (strmatch(argv[i],"-siltail")) { /* tail silence word name */
if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE;
FREE_MEMORY(jconf->lmnow->tail_silname);
GET_TMPARG;
jconf->lmnow->tail_silname = strcpy((char*)mymalloc(strlen(tmparg)+1),tmparg);
continue;
} else if (strmatch(argv[i],"-mapunk")) { /* unknown word */
if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE;
GET_TMPARG;
strncpy(jconf->lmnow->unknown_name, tmparg, UNK_WORD_MAXLEN);
continue;
} else if (strmatch(argv[i],"-iwspword")) { /* add short pause word */
if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE;
jconf->lmnow->enable_iwspword = TRUE;
continue;
} else if (strmatch(argv[i],"-iwspentry")) { /* content of the iwspword */
if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE;
FREE_MEMORY(jconf->lmnow->iwspentry);
GET_TMPARG;
jconf->lmnow->iwspentry = strcpy((char*)mymalloc(strlen(tmparg)+1),tmparg);
continue;
} else if (strmatch(argv[i],"-iwcache")) { /* control cross-word LM cache */
#ifdef HASH_CACHE_IW
if (!check_section(jconf, argv[i], JCONF_OPT_SR)) return FALSE;
GET_TMPARG;
jconf->searchnow->pass1.iw_cache_rate = atof(tmparg);
if (jconf->searchnow->pass1.iw_cache_rate > 100) jconf->searchnow->pass1.iw_cache_rate = 100;
if (jconf->searchnow->pass1.iw_cache_rate < 1) jconf->searchnow->pass1.iw_cache_rate = 1;
#else
jlog("WARNING: m_options: HASH_CACHE_IW disabled, \"-iwcache\" ignored\n");
#endif
continue;
} else if (strmatch(argv[i],"-sepnum")) { /* N-best frequent word will be separated from tree */
#ifdef SEPARATE_BY_UNIGRAM
if (!check_section(jconf, argv[i], JCONF_OPT_LM)) return FALSE;
GET_TMPARG;
jconf->lmnow->separate_wnum = atoi(tmparg);
#else
jlog("WARNING: m_options: SEPARATE_BY_UNIGRAM disabled, \"-sepnum\" ignored\n");
i++;
#endif
continue;
#ifdef USE_NETAUDIO
} else if (strmatch(argv[i],"-NA")) { /* netautio device name */
if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE;
FREE_MEMORY(jconf->input.netaudio_devname);
GET_TMPARG;
jconf->input.netaudio_devname = strcpy((char*)mymalloc(strlen(tmparg)+1),tmparg);
continue;
#endif
} else if (strmatch(argv[i],"-adport")) { /* adinnet port num */
if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE;
GET_TMPARG;
jconf->input.adinnet_port = atoi(tmparg);
continue;
} else if (strmatch(argv[i],"-nostrip")) { /* do not strip zero samples */
if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE;
jconf->preprocess.strip_zero_sample = FALSE;
continue;
} else if (strmatch(argv[i],"-zmean")) { /* enable DC offset by zero mean */
if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE;
jconf->preprocess.use_zmean = TRUE;
continue;
} else if (strmatch(argv[i],"-nozmean")) { /* disable DC offset by zero mean */
if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE;
jconf->preprocess.use_zmean = FALSE;
continue;
} else if (strmatch(argv[i],"-lvscale")) { /* input level scaling factor */
if (!check_section(jconf, argv[i], JCONF_OPT_GLOBAL)) return FALSE;
GET_TMPARG;
jconf->preprocess.level_coef = (float)atof(tmparg);
continue;