public void TestParseResultsBySentences() { PtTagset.TagDelimiter = '_'; TagsetBase[][] testOutList; var testResult = PtTagset.TryParse(_largeTestFile, out testOutList); Assert.IsTrue(testResult); Assert.IsNotNull(testOutList); Assert.AreNotEqual(0, testOutList.Length); Assert.IsNotNull(testOutList[0]); Assert.AreNotEqual(0, testOutList[0].Length); Console.WriteLine("Number of sentences '{0}'", testOutList.Length); for (var i = 0; i < testOutList.Length; i++) { Console.WriteLine("Sentence '{0}' length is '{1}'", i, testOutList[i].Length); } Assert.IsNotNull(testOutList[1]); Assert.AreNotEqual(0, testOutList[1].Length); Assert.IsInstanceOf(typeof(Determiner), testOutList[1][0]); Assert.IsInstanceOf(typeof(Adjective), testOutList[1][1]); var secondtolastValue = testOutList[36][0].Value; var lastValue = testOutList[36][1].Value; Console.WriteLine(secondtolastValue); Console.WriteLine(lastValue); }
public void TestParseResults() { const string TEST_INPUT = "This_DT is_VBZ a_DT sample_NN sentence_NN"; TagsetBase[] testOutList = null; var testResult = PtTagset.TryParse(TEST_INPUT, out testOutList); for (var i = 0; i < testOutList.Length; i++) { Console.WriteLine("{0,-8}{1}", i, testOutList[i].Value); } Assert.IsTrue(testResult); Assert.AreEqual(5, testOutList.Count()); Assert.IsInstanceOf(typeof(Determiner), testOutList[0]); Assert.AreEqual("This", testOutList[0].Value); Assert.IsInstanceOf(typeof(Verb3rdPersonSingularPresent), testOutList[1]); Assert.AreEqual("is", testOutList[1].Value); Assert.IsInstanceOf(typeof(Determiner), testOutList[2]); Assert.AreEqual("a", testOutList[2].Value); Assert.IsInstanceOf(typeof(NounSingularOrMass), testOutList[3]); Assert.AreEqual("sample", testOutList[3].Value); Assert.IsInstanceOf(typeof(NounSingularOrMass), testOutList[4]); Assert.AreEqual("sentence", testOutList[4].Value); }
public void TestAllCodesRepresented() { foreach (var allCode in AllCodes) { Console.WriteLine(allCode); Assert.IsNotNull(PtTagset.GetTagset(allCode)); } }
public void TestTryParseJaggedArray() { TagsetBase[][] tagsOut; var testInput = @"When_WRB in_IN the_DT Course_NNP of_IN human_JJ events_NNS ,_, it_PRP becomes_VBZ necessary_JJ for_IN one_CD people_NNS to_TO dissolve_VB the_DT political_JJ bands_NNS which_WDT have_VBP connected_VBN them_PRP with_IN another_DT ,_, and_CC to_TO assume_VB among_IN the_DT powers_NNS of_IN the_DT earth_NN ,_, the_DT separate_JJ and_CC equal_JJ station_NN to_TO which_WDT the_DT Laws_NNPS of_IN Nature_NNP and_CC of_IN Nature_NNP 's_POS God_NNP entitle_VB them_PRP ,_, a_DT decent_JJ respect_NN to_TO the_DT opinions_NNS of_IN mankind_NN requires_VBZ that_IN they_PRP should_MD declare_VB the_DT causes_NNS which_WDT impel_VBP them_PRP to_TO the_DT separation_NN ._."; var testResult = PtTagset.TryParse(testInput, out tagsOut); Assert.IsTrue(testResult); Assert.IsNotNull(tagsOut); Assert.AreNotEqual(0, tagsOut.Length); }
public static TagsetBase[] ToPosTagsets(this string commonEnText) { var taggedText = ToTaggedString(commonEnText); if (string.IsNullOrWhiteSpace(taggedText)) { return(null); } TagsetBase[] tagsOut; if (!PtTagset.TryParse(taggedText, out tagsOut)) { return(null); } return(tagsOut); }