コード例 #1
0
        public void TestParseSingleQuantity()
        {
            IParser p = new SimChineseQuantityParser(TestUtility.CreateParserContext("一棵树通常有二十五根树杈。"));
            ParseResultCollection prc = p.Parse(0);

            Assert.AreEqual(2, prc.Count);
            TestUtility.AssertParseResult(prc[0], "一", 0, POSType.A_M);
            TestUtility.AssertParseResult(prc[1], "棵", 1, POSType.A_Q);

            prc = p.Parse(6);
            Assert.AreEqual(2, prc.Count);
            TestUtility.AssertParseResult(prc[0], "二十五", 6, POSType.A_M);
            TestUtility.AssertParseResult(prc[1], "根", 9, POSType.A_Q);
        }
コード例 #2
0
        public void TestInvalidQuantityCase()
        {
            IParser p = new SimChineseQuantityParser(TestUtility.CreateParserContext("兆棵树"));
            ParseResultCollection prc = p.Parse(0);

            Assert.AreEqual(0, prc.Count);
        }