Exemplo n.º 1
0
        private void CoreNLPForm_Load(object sender, EventArgs e)
        {
            OutputType.Items.Add("XML");
            OutputType.Items.Add("Json");
            OutputType.Items.Add("Conll");
            OutputType.Items.Add("Pretty");
            OutputType.Text       = "XML";
            OutputText.ScrollBars = ScrollBars.Both;
            InputText.Text        = "";


            //PWF.Show();
            PWF = new PleaseWaitForm();
            PWF.Show();
            this.Visible = false;

            //----------------java
            jarRoot = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName) + @"\stanford-corenlp-full-2016-10-31";

            props.setProperty("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref");
            props.setProperty("ner.useSUTime", "0");
            curDir = Environment.CurrentDirectory;
            Directory.SetCurrentDirectory(jarRoot);
            pipeline = new StanfordCoreNLP(props);
            Directory.SetCurrentDirectory(curDir);
            this.Visible = true;
            PWF.Close();
            //----------------
        }
Exemplo n.º 2
0
 private void ToggleLoadingForm()
 {
     if (LoadingScreenOn == false)
     {
         LoadingScreenOn = true;
         PWF             = new PleaseWaitForm();
         PWF.Show();
     }
     else if (LoadingScreenOn == true)
     {
         LoadingScreenOn = false;
         PWF.Close();
     }
 }
Exemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            text   = InputText.Text.ToString();
            option = OutputType.Text.ToString();
            if (text != "")
            {
                PWF = new PleaseWaitForm();
                PWF.Show();
                this.Visible = false;

                var annotation = new Annotation(text);
                pipeline.annotate(annotation);

                using (var stream = new ByteArrayOutputStream())
                {
                    if (option == "Pretty")
                    {
                        pipeline.prettyPrint(annotation, new PrintWriter(stream));
                    }
                    else if (option == "Json")
                    {
                        pipeline.jsonPrint(annotation, new PrintWriter(stream));
                    }
                    else if (option == "XML")
                    {
                        pipeline.xmlPrint(annotation, new PrintWriter(stream));
                    }
                    else if (option == "Conll")
                    {
                        pipeline.conllPrint(annotation, new PrintWriter(stream));
                    }
                    else
                    {
                        pipeline.conllPrint(annotation, new PrintWriter(stream));
                    }

                    OutputText.Text = stream.ToString();

                    stream.close();
                }

                PWF.Close();
                this.Visible = true;
            }
        }
Exemplo n.º 4
0
 private void ShowLoading()
 {
     LoadingScreenOn = true;
     PWF             = new PleaseWaitForm();
     PWF.Show();
 }