@@ -18,81 +18,80 @@ class OnlineDecodeFiles
18
18
class Options
19
19
{
20
20
[ Option ( Required = true , HelpText = "Path to tokens.txt" ) ]
21
- public string Tokens { get ; set ; }
21
+ public string Tokens { get ; set ; } = "" ;
22
22
23
23
[ Option ( Required = false , Default = "cpu" , HelpText = "Provider, e.g., cpu, coreml" ) ]
24
- public string Provider { get ; set ; }
24
+ public string Provider { get ; set ; } = "" ;
25
25
26
26
[ Option ( Required = false , HelpText = "Path to transducer encoder.onnx" ) ]
27
- public string Encoder { get ; set ; }
27
+ public string Encoder { get ; set ; } = "" ;
28
28
29
29
[ Option ( Required = false , HelpText = "Path to transducer decoder.onnx" ) ]
30
- public string Decoder { get ; set ; }
30
+ public string Decoder { get ; set ; } = "" ;
31
31
32
32
[ Option ( Required = false , HelpText = "Path to transducer joiner.onnx" ) ]
33
- public string Joiner { get ; set ; }
33
+ public string Joiner { get ; set ; } = "" ;
34
34
35
35
[ Option ( "paraformer-encoder" , Required = false , HelpText = "Path to paraformer encoder.onnx" ) ]
36
- public string ParaformerEncoder { get ; set ; }
36
+ public string ParaformerEncoder { get ; set ; } = "" ;
37
37
38
38
[ Option ( "paraformer-decoder" , Required = false , HelpText = "Path to paraformer decoder.onnx" ) ]
39
- public string ParaformerDecoder { get ; set ; }
39
+ public string ParaformerDecoder { get ; set ; } = "" ;
40
40
41
41
[ Option ( "zipformer2-ctc" , Required = false , HelpText = "Path to zipformer2 CTC onnx model" ) ]
42
- public string Zipformer2Ctc { get ; set ; }
42
+ public string Zipformer2Ctc { get ; set ; } = "" ;
43
43
44
44
[ Option ( "num-threads" , Required = false , Default = 1 , HelpText = "Number of threads for computation" ) ]
45
- public int NumThreads { get ; set ; }
45
+ public int NumThreads { get ; set ; } = 1 ;
46
46
47
47
[ Option ( "decoding-method" , Required = false , Default = "greedy_search" ,
48
48
HelpText = "Valid decoding methods are: greedy_search, modified_beam_search" ) ]
49
- public string DecodingMethod { get ; set ; }
49
+ public string DecodingMethod { get ; set ; } = "greedy_search" ;
50
50
51
51
[ Option ( Required = false , Default = false , HelpText = "True to show model info during loading" ) ]
52
- public bool Debug { get ; set ; }
52
+ public bool Debug { get ; set ; } = false ;
53
53
54
54
[ Option ( "sample-rate" , Required = false , Default = 16000 , HelpText = "Sample rate of the data used to train the model" ) ]
55
- public int SampleRate { get ; set ; }
55
+ public int SampleRate { get ; set ; } = 16000 ;
56
56
57
57
[ Option ( "max-active-paths" , Required = false , Default = 4 ,
58
58
HelpText = @"Used only when --decoding--method is modified_beam_search.
59
59
It specifies number of active paths to keep during the search" ) ]
60
- public int MaxActivePaths { get ; set ; }
60
+ public int MaxActivePaths { get ; set ; } = 4 ;
61
61
62
62
[ Option ( "enable-endpoint" , Required = false , Default = false ,
63
63
HelpText = "True to enable endpoint detection." ) ]
64
- public bool EnableEndpoint { get ; set ; }
64
+ public bool EnableEndpoint { get ; set ; } = false ;
65
65
66
66
[ Option ( "rule1-min-trailing-silence" , Required = false , Default = 2.4F ,
67
67
HelpText = @"An endpoint is detected if trailing silence in seconds is
68
68
larger than this value even if nothing has been decoded. Used only when --enable-endpoint is true." ) ]
69
- public float Rule1MinTrailingSilence { get ; set ; }
69
+ public float Rule1MinTrailingSilence { get ; set ; } = 2.4F ;
70
70
71
71
[ Option ( "rule2-min-trailing-silence" , Required = false , Default = 1.2F ,
72
72
HelpText = @"An endpoint is detected if trailing silence in seconds is
73
73
larger than this value after something that is not blank has been decoded. Used
74
74
only when --enable-endpoint is true." ) ]
75
- public float Rule2MinTrailingSilence { get ; set ; }
75
+ public float Rule2MinTrailingSilence { get ; set ; } = 1.2F ;
76
76
77
77
[ Option ( "rule3-min-utterance-length" , Required = false , Default = 20.0F ,
78
78
HelpText = @"An endpoint is detected if the utterance in seconds is
79
79
larger than this value. Used only when --enable-endpoint is true." ) ]
80
- public float Rule3MinUtteranceLength { get ; set ; }
80
+ public float Rule3MinUtteranceLength { get ; set ; } = 20.0F ;
81
81
82
82
[ Option ( "hotwords-file" , Required = false , Default = "" , HelpText = "Path to hotwords.txt" ) ]
83
- public string HotwordsFile { get ; set ; }
83
+ public string HotwordsFile { get ; set ; } = "" ;
84
84
85
85
[ Option ( "hotwords-score" , Required = false , Default = 1.5F , HelpText = "hotwords score" ) ]
86
- public float HotwordsScore { get ; set ; }
86
+ public float HotwordsScore { get ; set ; } = 1.5F ;
87
87
88
88
[ Option ( "rule-fsts" , Required = false , Default = "" ,
89
89
HelpText = "If not empty, path to rule fst for inverse text normalization" ) ]
90
- public string RuleFsts { get ; set ; }
90
+ public string RuleFsts { get ; set ; } = "" ;
91
91
92
92
93
93
[ Option ( "files" , Required = true , HelpText = "Audio files for decoding" ) ]
94
- public IEnumerable < string > Files { get ; set ; }
95
-
94
+ public IEnumerable < string > Files { get ; set ; } = new string [ ] { } ;
96
95
}
97
96
98
97
static void Main ( string [ ] args )
0 commit comments