public void Recoginiser()
        {
            myProcessStartInfo.UseShellExecute        = false;
            myProcessStartInfo.RedirectStandardOutput = true;
            //myProcessStartInfo.CreateNoWindow = false;
            //myProcessStartInfo.WindowStyle = ProcessWindowStyle.Minimized;

            // start python app with 3 arguments
            // 1st arguments is pointer to itself, 2nd and 3rd are actual arguments we want to send
            myProcessStartInfo.Arguments = myPythonApp;
            // assign start information to the process
            myProcess.StartInfo = myProcessStartInfo;
            //Console.WriteLine("Value received from script: " + myProcessStartInfo);
            myProcess.Start();
            // Read the standard output of the app we called.
            // in order to avoid deadlock we will read output first and then wait for process terminate:
            StreamReader myStreamReader = myProcess.StandardOutput;
            string       myString       = myStreamReader.ReadToEnd();

            // wait exit signal from the app we called and then close it.
            myProcess.WaitForExit();
            myProcess.Close();
            myProcess.Dispose();

            DirectoryInfo di = new DirectoryInfo(@"C:\Users\vishnu\Desktop\pyfolder\");

            FileInfo[] files = di.GetFiles("start*")
                               .Where(p => p.Extension == ".wav").ToArray();
            foreach (FileInfo file in files)
            {
                try
                {
                    file.Attributes = FileAttributes.Normal;
                    File.Delete(file.FullName);
                }
                catch { }
            }


            TimeRepalcer timeRepalcer = new TimeRepalcer();

            timeRepalcer.replacer();
            Summary summary = new Summary();

            summary.Summariser();
            Luis luis = new Luis();

            luis.MakeRequest();


            Glob.stopper = 0;
        }
예제 #2
0
        private async Task MessageReceivedAsync(IDialogContext context, IAwaitable <object> result)
        {
            SpeechSynthesizer synthesizer         = new SpeechSynthesizer();
            Bing               bing               = new Bing();
            Summary            summary            = new Summary();
            SpeakerRecoginiser speakerrecoginiser = new SpeakerRecoginiser();
            TimeRepalcer       timeRepalcer       = new TimeRepalcer();
            Luis               luis               = new Luis();
            Thread             speechtotext       = new Thread(bing.ConvertSpeechToText);
            Thread             luiscontroller     = new Thread(luis.MakeRequest);
            Thread             Summarycontroller  = new Thread(summary.Summariser);
            Thread             speakercontroller  = new Thread(speakerrecoginiser.Recoginiser);
            Thread             replacerfunc       = new Thread(timeRepalcer.replacer);
            var activity = await result as Activity;

            if (activity.Text == "start")
            {
                // Glob.outfile = @"D:\Output\Output" + DateTime.Now.ToString("h:mm:ss tt") + ".txt";

                //  String namehalf = DateTime.Now.ToString("h:mm:ss tt");
                // Glob.outfile = $"Output{namehalf}.txt";
                //   Glob.resfile = @"D:\Output\Result" + DateTime.Now.ToString("h:mm:ss tt") + ".txt";
                Glob.actioncount         = 0;
                Glob.speechthreadcontrol = true;

                if (i == 1)
                {
                    speechtotext.Start();
                    speakercontroller.Start();

                    i = 2;
                }
            }
            else if (activity.Text == "stop")
            {
                Glob.speechthreadcontrol = false;
                speakerrecoginiser.speakerCloser();
                luiscontroller.Start();
                Summarycontroller.Start();
                replacerfunc.Start();
            }
            // Calculate something for us to return

            // Return our reply to the user
            await context.PostAsync($"Your process {activity.Text} is being processed");

            context.Wait(MessageReceivedAsync);
        }