Print a more user-friendly error message when using --hotwords-file. (#344)
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
from _sherpa_onnx import (
|
||||
CircularBuffer,
|
||||
Display,
|
||||
|
||||
@@ -102,6 +102,12 @@ class OfflineRecognizer(object):
|
||||
feature_dim=feature_dim,
|
||||
)
|
||||
|
||||
if len(hotwords_file) > 0 and decoding_method != "modified_beam_search":
|
||||
raise ValueError(
|
||||
"Please use --decoding-method=modified_beam_search when using "
|
||||
f"--hotwords-file. Currently given: {decoding_method}"
|
||||
)
|
||||
|
||||
recognizer_config = OfflineRecognizerConfig(
|
||||
feat_config=feat_config,
|
||||
model_config=model_config,
|
||||
|
||||
@@ -132,6 +132,12 @@ class OnlineRecognizer(object):
|
||||
rule3_min_utterance_length=rule3_min_utterance_length,
|
||||
)
|
||||
|
||||
if len(hotwords_file) > 0 and decoding_method != "modified_beam_search":
|
||||
raise ValueError(
|
||||
"Please use --decoding-method=modified_beam_search when using "
|
||||
f"--hotwords-file. Currently given: {decoding_method}"
|
||||
)
|
||||
|
||||
recognizer_config = OnlineRecognizerConfig(
|
||||
feat_config=feat_config,
|
||||
model_config=model_config,
|
||||
|
||||
Reference in New Issue
Block a user