Nickolay V. Shmyrev
Committed by GitHub

Expose dither in python API (#2127)

@@ -49,6 +49,7 @@ class OfflineRecognizer(object): @@ -49,6 +49,7 @@ class OfflineRecognizer(object):
49 num_threads: int = 1, 49 num_threads: int = 1,
50 sample_rate: int = 16000, 50 sample_rate: int = 16000,
51 feature_dim: int = 80, 51 feature_dim: int = 80,
  52 + dither: float = 0.0,
52 decoding_method: str = "greedy_search", 53 decoding_method: str = "greedy_search",
53 max_active_paths: int = 4, 54 max_active_paths: int = 4,
54 hotwords_file: str = "", 55 hotwords_file: str = "",
@@ -89,6 +90,11 @@ class OfflineRecognizer(object): @@ -89,6 +90,11 @@ class OfflineRecognizer(object):
89 Sample rate of the training data used to train the model. 90 Sample rate of the training data used to train the model.
90 feature_dim: 91 feature_dim:
91 Dimension of the feature used to train the model. 92 Dimension of the feature used to train the model.
  93 + dither:
  94 + Dithering constant (0.0 means no dither).
  95 + By default the audio samples are in range [-1,+1],
  96 + so dithering constant 0.00003 is a good value,
  97 + equivalent to the default 1.0 from kaldi
92 decoding_method: 98 decoding_method:
93 Valid values: greedy_search, modified_beam_search. 99 Valid values: greedy_search, modified_beam_search.
94 max_active_paths: 100 max_active_paths:
@@ -142,6 +148,7 @@ class OfflineRecognizer(object): @@ -142,6 +148,7 @@ class OfflineRecognizer(object):
142 feat_config = FeatureExtractorConfig( 148 feat_config = FeatureExtractorConfig(
143 sampling_rate=sample_rate, 149 sampling_rate=sample_rate,
144 feature_dim=feature_dim, 150 feature_dim=feature_dim,
  151 + dither=dither,
145 ) 152 )
146 153
147 if len(hotwords_file) > 0 and decoding_method != "modified_beam_search": 154 if len(hotwords_file) > 0 and decoding_method != "modified_beam_search":