Ejemplo n.º 1
0
        public AsrtClientProxy(string host, string port, string protocol)
        {
            this._host        = host;
            this._port        = port;
            this._protocol    = protocol;
            _speechRecognizer = SDK.GetSpeechRecognizer(host, port, protocol);

            if (NAudioRecorder.DeviceCount < 1)
            {
                throw new Exception("There is no record device found");
            }
        }
Ejemplo n.º 2
0
        private async void btn_recognite_file_Click(object sender, RoutedEventArgs e)
        {
            string filename = "";

            Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog();
            openFileDialog.Filter     = "WAVE音频文件|*.wav";
            openFileDialog.DefaultExt = "WAVE音频文件|*.wav";
            if (openFileDialog.ShowDialog() == true)
            {
                filename = openFileDialog.FileName;

                Ailemon.Asrt.BaseSpeechRecognizer sr  = Ailemon.Asrt.SDK.GetSpeechRecognizer(host, port, protocol);
                Ailemon.Asrt.AsrtApiResponse      rsp = (Ailemon.Asrt.AsrtApiResponse) await sr.RecogniteFile(filename);

                System.Console.WriteLine((string)rsp.Result);
                AsrtResult result = new AsrtResult("\n" + (string)rsp.Result + "\n", true, rsp.StatusCode, rsp.StatusMessage);
                SpeechRecognizer_OnReceiveText(sender, result);
            }
        }