Exemple #1
0
 private void CheckLoadAnaFile(string sFile, int iExpectedCount, int iExpectedCountOfParsesInFirstSentence, out PcPatrDocument doc, out PcPatrSentence sentence, out string sGrammarFile)
 {
     doc = new PcPatrDocument(sFile, out sGrammarFile);
     Assert.IsNotNull(doc.Sentences, "no sentences found in " + sFile);
     Assert.AreEqual(iExpectedCount, doc.Sentences.Length, sFile + " has " + iExpectedCount.ToString() + " Sentences");
     sentence = doc.FirstSentence;
     Assert.IsNotNull(sentence, "could not get first sentence in " + sFile);
     Assert.IsNotNull(sentence.Parses, "no parses found in 1st sentence of " + sFile);
     Assert.AreEqual(iExpectedCountOfParsesInFirstSentence, sentence.Parses.Length, sFile + " has " + iExpectedCountOfParsesInFirstSentence.ToString() + " parses in first sentence");
 }
 private void CheckLoadAnaFile(string sFile, int iExpectedCount, int iExpectedCountOfParsesInFirstSentence, out PcPatrDocument doc, out PcPatrSentence sentence, out string sGrammarFile)
 {
     doc = new PcPatrDocument(sFile, out sGrammarFile);
     Assert.IsNotNull(doc.Sentences, "no sentences found in " + sFile);
     Assert.AreEqual(iExpectedCount, doc.Sentences.Length, sFile + " has " + iExpectedCount.ToString() + " Sentences");
     sentence = doc.FirstSentence;
     Assert.IsNotNull(sentence, "could not get first sentence in " + sFile);
     Assert.IsNotNull(sentence.Parses, "no parses found in 1st sentence of " + sFile);
     Assert.AreEqual(iExpectedCountOfParsesInFirstSentence, sentence.Parses.Length, sFile + " has " + iExpectedCountOfParsesInFirstSentence.ToString() + " parses in first sentence");
 }
        private void LoadAnaFile()
        {
            Cursor.Current = Cursors.WaitCursor;
            string sGrammarFile;
            m_doc = new PcPatrDocument(m_sLogOrAnaFileName, out sGrammarFile);
            if (sGrammarFile != null)
            {
                m_sGrammarFileName = sGrammarFile;
                LoadGrammarFile();
            }
            else
            {
                richTextBox1.Text = m_ksGrammarMessage;
            }

            PcPatrSentence sent = m_doc.CurrentSentence;
            if (sent != null)
            {
                ShowParseTree(sent, sent.FirstParse);
            }
            else
            {
                m_tree.Root = null;
                m_tree.Invalidate();
                wbFeatureStructure.Navigate(m_sInitFeatureMessagePath);
                sbpnlSentence.Text = m_ksNoSentences;
                sbpnlParse.Text = m_ksNoParses;
            }
            ShowInterlinear(sent);
            Cursor.Current = Cursors.Arrow;
            SetTitle();
        }