public void ValidateAnswer()
        {
            ParagraphQA para2 = new ParagraphQA("Input5");

            para2.GetLines();
            para2.GetRequiredEntities();
            Assert.AreEqual(para2.isValidInput, true);
            Assert.AreEqual(para2.answer, "No valid answer;No valid answer;No valid answer;No valid answer;No valid answer;");
        }
Beispiel #2
0
        public void Check()
        {
            QASystemDriver QAVal = new QASystemDriver();

            string[] q = { "Which Zebras are endangered ?", "Which are the three species of zebras ?" };

            ParagraphQA inputData = new ParagraphQA("Grévy's zebra and the mountain zebra are endangered.", q, "Grévy's zebra and the mountain zebra;subgenus Hippotigris;");

            QAVal.MatchWordsInSentences(inputData);
            Collection <QARanker> xCol = new Collection <QARanker>();

            var x = new QARanker(1, 1, 2, 3, 2, 3, false);

            xCol.Add(x);
            var y = new QARanker(2, 1, 1, 4, 3, 4, false);

            xCol.Add(y);

            //CollectionAssert.AreEqual(xCol, QAVal.colQARank);
            //Assert.AreEqual(QAVal.colQARank[0].questionId, 1);
            //Assert.AreEqual(QAVal.colQARank[0].answerID, 1);
            //Assert.AreEqual(xCol[0].questionCount, QAVal.colQARank[0].questionCount);
            //Assert.AreEqual(xCol[0].answerCount, QAVal.colQARank[0].answerCount);
            //Assert.AreEqual(xCol[0].TotalQCount, QAVal.colQARank[0].TotalQCount);
            ////Assert.AreEqual(xCol[0].TotalACount, QAVal.colQARank[0].TotalACount);
            //Assert.AreEqual(xCol[0].Rank, QAVal.colQARank[0].Rank);

            xCol = new Collection <QARanker>();
            QASystemDriver QAVal1 = new QASystemDriver();

            string[] q1 = { "Which Zebras are endangered ?", "Which are the three species of zebras ?" };

            ParagraphQA inputData1 = new ParagraphQA("There are three species of zebras: the plains zebra, the Grévy's zebra and the mountain zebra", q1, "Grévy's zebra and the mountain zebra;the plains zebra, the Grévy's zebra and the mountain zebra;");

            QAVal1.MatchWordsInSentences(inputData1);
            Collection <QARanker> xCol1 = new Collection <QARanker>();

            var x1 = new QARanker(1, 1, 1, 3, 2, 3, true);

            xCol.Add(x1);
            var x2 = new QARanker(1, 2, 1, 4, 2, 4, false);
            var y1 = new QARanker(2, 1, 3, 3, 3, 3, false);
            var y2 = new QARanker(2, 2, 3, 4, 3, 4, false);

            xCol.Add(x1);
            xCol.Add(x2);
            xCol.Add(y1);
            xCol.Add(y2);
            Assert.AreEqual(QAVal1.colQARank[0].questionId, 1);
            Assert.AreEqual(QAVal1.colQARank[0].answerID, 1);
            Assert.AreEqual(xCol[0].questionCount, QAVal1.colQARank[0].questionCount);
            Assert.AreEqual(xCol[0].answerCount, QAVal1.colQARank[0].answerCount);
            Assert.AreEqual(xCol[0].TotalQCount, QAVal1.colQARank[0].TotalQCount);
            Assert.AreEqual(xCol[0].TotalACount, QAVal1.colQARank[0].TotalACount);
            Assert.AreEqual(xCol[0].Rank, QAVal1.colQARank[0].Rank);
        }
        public void ValidateQuestion()
        {
            ParagraphQA para = new ParagraphQA("Input1");

            para.GetLines();
            para.GetRequiredEntities();
            Assert.AreEqual(para.isValidInput, false);
            ParagraphQA para2 = new ParagraphQA("Input2");

            para2.GetLines();
            para2.GetRequiredEntities();
            Assert.AreEqual(para2.isValidInput, true);
            Assert.AreEqual(para2.questions.Count, 5);
            Assert.AreEqual(para2.questions[1], "What is the aim of the Quagga Project?");
        }
        public void ValidateParagraph()
        {
            ParagraphQA para = new ParagraphQA("InputTest");

            string[] lval = { "Zebra is an Animal.", "Chennai is my city.", "Who are you?", "How are things?" };
            CollectionAssert.AreEqual(para.GetLines(), lval);

            para.GetRequiredEntities();
            Assert.AreEqual(para.isValidInput, false);

            ParagraphQA para1 = new ParagraphQA("Input5");

            para1.GetLines();
            Assert.AreEqual(para1.lines.Count(), 7);
            String s = "Zebras are several species of African equids (horse family) united by their distinctive black and white stripes. Their stripes come in different patterns, unique to each individual. They are generally         social animals that live in small harems to large herds. Unlike their closest relatives, horses and donkeys, zebras have never been truly domesticated. There are three species of zebras: the plains zebra,the Grévy's zebra and the mountain zebra. The plains zebra and the mountain zebra belong to the subgenus Hippotigris, but Grévy's zebrais the sole species of subgenus Dolichohippus. The latter resembles an ass, to which it is closely related, while the former two are more horse-like. All three belong to the genus Equus, along with other living equids. The unique stripes of zebras make them one of the animals most familiar to people. They occur in a variety of habitats,such as grasslands, savannas, woodlands, thorny scrublands, mountains, and coastal hills. However, various anthropogenic factors have had a severe impact on zebra populations, in particular hunting for skins and habitat destruction. Grévy's zebra and the mountain zebra are endangered. While plains zebras are much more plentiful,  one subspecies - the Quagga - became extinct in the late 19th century. Though there is currently a plan, called the Quagga Project,           that aims to breed zebras that are phenotypically similar to the Quagga, in a process called breeding back.";

            para1.GetRequiredEntities();
            Assert.AreEqual(para1.isValidInput, true);
            Assert.AreEqual(para1.paragraph, s);
        }
        public void TestEmptyFile()
        {
            var para = new ParagraphQA("Input7");

            CollectionAssert.AreEqual(para.GetLines(), new string[] { });
        }