コード例 #1
0
        public VoiceTranscriptor(MMDevice selectedDevice)
        {
            //Register instance of DeepSpeech
            mSttClient = new DeepSpeech(SPEECH_MODEL);

            InitializeAudioCapture(selectedDevice);
        }
コード例 #2
0
        private void InitDeepSpeech()
        {
            string projectFolder     = Directory.GetCurrentDirectory();
            string modelsFolder      = Path.Combine(projectFolder, "models");
            string acousticModelPath = Path.Combine(modelsFolder, "deepspeech-0.8.0-models.pbmm");
            string scorerPath        = Path.Combine(modelsFolder, "deepspeech-0.8.0-models.scorer");

            client = new DeepSpeechClient.DeepSpeech(acousticModelPath);
            client.EnableExternalScorer(scorerPath);
        }
コード例 #3
0
        public String CreateSpeechRecognitionEngine()
        {
            String message = String.Empty;

            Tuple <string, bool> avx = isAvxSupported();

            if (avx.Item2 == false)
            {
                message =
                    "Methwyd creu'r peiriant DeepSpeech oherwydd ddiffyg yn CPU ("
                    + avx.Item1 + ") y cyfrifiadur.\n\n"
                    + "Mae angen cyfrifiadur sydd a fath diweddar o CPU (fel Intel Core i3/5/7/9) ac sy'n cynorthwyo AVX.\n\n"
                    + "Defnyddiwch raglen fel CoreInfo64 i ddysgu mwy am eich CPU.\n\n"
                    + "RHYBUDD: Am defnyddio peiriant DeepSpeech ar-lein fel ddarpariaeth amgen.";

                useOnlineDeepSpeech = true;

                Console.Out.WriteLine(message);
                Console.Out.WriteLine();
            }
            else
            {
                try
                {
                    _sttClient = new DeepSpeechClient.DeepSpeech(this.model);
                    _sttClient.EnableExternalScorer(this.kenlm_scorer);
                }
                catch (Exception exc)
                {
                    message  = "Methwyd creu'r peiriant DeepSpeech am rheswm anhysbys.\n\n" + exc.Message;
                    message += "RHYBUDD: Am defnyddio peiriant DeepSpeech ar-lein fel ddarpariaeth amgen.";

                    useOnlineDeepSpeech = true;

                    Console.Out.WriteLine(message);
                    Console.Out.WriteLine();
                }
            }

            return(message);
        }