Bladeren bron

small fixes (#78)

Fangjun Kuang 2 jaren geleden
bovenliggende
commit
757dff26ce
3 gewijzigde bestanden met toevoegingen van 7 en 6 verwijderingen
  1. 3 2
      sherpa-ncnn/csrc/display.h
  2. 3 3
      sherpa-ncnn/csrc/sherpa-ncnn-alsa.cc
  3. 1 1
      sherpa-ncnn/csrc/sherpa-ncnn-microphone.cc

+ 3 - 2
sherpa-ncnn/csrc/display.h

@@ -56,7 +56,8 @@ class Display {
       }
 
       ++i;
-      if (i >= max_word_per_line_ && n + 1 < s.size() && s[n] == ' ') {
+      if (i >= max_word_per_line_ && n + 1 < s.size() &&
+          (s[n] == ' ' || s[n] < 0)) {
         fprintf(stderr, "\n\r ");
         ++num_previous_lines_;
         i = 0;
@@ -82,7 +83,7 @@ class Display {
   void GoUpOneLine() const { fprintf(stderr, "\033[1A\r"); }
 
  private:
-  int32_t max_word_per_line_ = 80;
+  int32_t max_word_per_line_ = 60;
   int32_t num_previous_lines_ = 0;
   int32_t last_segment_ = -1;
 };

+ 3 - 3
sherpa-ncnn/csrc/sherpa-ncnn-alsa.cc

@@ -102,8 +102,8 @@ as the device_name.
   fprintf(stderr, "%s\n", model_conf.ToString().c_str());
 
   sherpa_ncnn::DecoderConfig decoder_conf;
-  if (argc == 10) {
-    std::string method = argv[9];
+  if (argc == 11) {
+    std::string method = argv[10];
     if (method.compare("greedy_search") ||
         method.compare("modified_beam_search")) {
       decoder_conf.method = method;
@@ -114,7 +114,7 @@ as the device_name.
 
   sherpa_ncnn::EndpointConfig endpoint_config;
   endpoint_config.rule1.min_trailing_silence = 2.4;
-  endpoint_config.rule2.min_trailing_silence = 0.8;  // <--tune this value !
+  endpoint_config.rule2.min_trailing_silence = 1.2;  // <--tune this value !
   endpoint_config.rule3.min_utterance_length = 300;
 
   decoder_conf.endpoint_config = endpoint_config;

+ 1 - 1
sherpa-ncnn/csrc/sherpa-ncnn-microphone.cc

@@ -103,7 +103,7 @@ for a list of pre-trained models to download.
 
   sherpa_ncnn::EndpointConfig endpoint_config;
   endpoint_config.rule1.min_trailing_silence = 2.4;
-  endpoint_config.rule2.min_trailing_silence = 0.8;  // <--tune this value !
+  endpoint_config.rule2.min_trailing_silence = 1.2;  // <--tune this value !
   endpoint_config.rule3.min_utterance_length = 300;
 
   decoder_conf.endpoint_config = endpoint_config;