From 682919c502c543198f566ebcc63340e16062c135 Mon Sep 17 00:00:00 2001
From: GlocKieHuan <77883010+GlocKieHuan@users.noreply.github.com>
Date: 星期二, 29 八月 2023 10:34:02 +0800
Subject: [PATCH] Supports hotwords and timestamps (#900)

---
 funasr/runtime/wss-client/FunASRWSClient_Offline/Program.cs |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/funasr/runtime/wss-client/FunASRWSClient_Offline/Program.cs b/funasr/runtime/wss-client/FunASRWSClient_Offline/Program.cs
index a0039e7..cfdddeb 100644
--- a/funasr/runtime/wss-client/FunASRWSClient_Offline/Program.cs
+++ b/funasr/runtime/wss-client/FunASRWSClient_Offline/Program.cs
@@ -19,11 +19,13 @@
     {
         public static string host = "0.0.0.0";
         public static string port = "10095";
+        public static string hotword = null;
         private static CWebSocketClient m_websocketclient = new CWebSocketClient();
         [STAThread]
         public async void FunASR_Main()
         {
             loadconfig();
+            loadhotword();
             //鍒濆鍖栭�氫俊杩炴帴
             string errorStatus = string.Empty;
             string commstatus = ClientConnTest();
@@ -72,6 +74,34 @@
                     }
                 }
             }
+
+        }
+        static void loadhotword()
+        {
+            string filePath = "hotword.txt";
+            try
+            {
+                // 浣跨敤 StreamReader 鎵撳紑鏂囨湰鏂囦欢
+                using (StreamReader sr = new StreamReader(filePath))
+                {
+                    string line;
+                    // 閫愯璇诲彇鏂囦欢鍐呭
+                    while ((line = sr.ReadLine()) != null)
+                    {
+                        hotword += line;
+                        hotword += " ";
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                Console.WriteLine("璇诲彇鏂囦欢鏃跺彂鐢熼敊璇細" + ex.Message);
+            }
+            finally
+            {
+                if (hotword.Length > 0 && hotword[hotword.Length - 1] == ' ')
+                    hotword = hotword.Substring(0,hotword.Length - 1);
+            }
         }
         private static string ClientConnTest()
         {

--
Gitblit v1.9.1