Exemple #1
0
        public Form1()
        {
            InitializeComponent();

            AppUpdate appUpdate = new AppUpdate();

            if (appUpdate.IsAvailableUpdate())
            {
                appUpdate.ShowDialog();
            }

            buttonStopRecord.Enabled         = false;
            pictureBoxSpinner.Visible        = false;
            labelRecordingInProgress.Visible = false;
            pictureBoxSpinner.BringToFront();
            this.Text = this.Text + " - v" + appUpdate.getInstalledAppVersion();

            backgroundWorkerTranscribe.DoWork             += new DoWorkEventHandler(Transcribe_DoWork);
            backgroundWorkerTranscribe.RunWorkerCompleted += new RunWorkerCompletedEventHandler(Transcribe_Completed);

            _transcriber = new DeepSpeechTranscriber();
            String message = _transcriber.CreateSpeechRecognitionEngine();

            if (!String.IsNullOrEmpty(message))
            {
                MessageBox.Show(message);
            }

            if (_transcriber.isUsingOnlineDeepSpeech())
            {
                this.Text = this.Text + " (MODD PEIRIANT AR-LEIN)";
            }
            else
            {
                this.Text = this.Text + " (MODD PEIRIANT LLEOL)";
            }
        }
Exemple #2
0
        //
        static void Main(string[] args)
        {
            string model    = null;
            string scorer   = null;
            string audio    = null;
            bool   extended = true;

            model    = GetArgument(args, "--model");
            scorer   = GetArgument(args, "--scorer");
            audio    = GetArgument(args, "--audio");
            extended = !string.IsNullOrWhiteSpace(GetArgument(args, "--extended"));

            DeepSpeechTranscriber _transcriber;

            try
            {
                _transcriber = new DeepSpeechTranscriber(model: model,
                                                         kenlm_scorer: scorer);
            }
            catch (Exception exc)
            {
                Console.Out.WriteLine(exc.Message);
                Console.Out.WriteLine("Pwyswch 'Return' i gau'r rhaglen.");
                Console.In.ReadLine();
                return;
            }


            List <string> sttResult;

            if (!String.IsNullOrEmpty(audio))
            {
                _transcriber.AddRecording(audio);
                sttResult = _transcriber.Transcribe();
                foreach (String r in sttResult)
                {
                    Console.Out.WriteLine(r);
                }
            }
            else
            {
                Console.Out.WriteLine("Adnabod lleferydd o'r microffon");
                while (true)
                {
                    Console.Out.WriteLine(Environment.NewLine);
                    Console.Out.WriteLine("Pwyswch 'Return' i ddechrau recordio...");
                    Console.In.ReadLine();

                    Console.Out.WriteLine("Yn recordio... pwyswch 'Return' i stopio'r recordio.");

                    _transcriber.StartRecording();

                    Console.In.ReadLine();
                    _transcriber.StopRecording();

                    sttResult = _transcriber.Transcribe();
                    foreach (String r in sttResult)
                    {
                        Console.Out.WriteLine(r);
                    }
                }
            }
        }