Пример #1
0
        public static void Main(string[] args)
        {
            System.Console.Out.WriteLine("Testing unknown matching");
            string s = "\u5218\u00b7\u9769\u547d";

            if (s.Matches(properNameMatch))
            {
                System.Console.Out.WriteLine("hooray names!");
            }
            else
            {
                System.Console.Out.WriteLine("Uh-oh names!");
            }
            string s1 = "\uff13\uff10\uff10\uff10";

            if (s1.Matches(numberMatch))
            {
                System.Console.Out.WriteLine("hooray numbers!");
            }
            else
            {
                System.Console.Out.WriteLine("Uh-oh numbers!");
            }
            string s11 = "\u767e\u5206\u4e4b\u56db\u5341\u4e09\u70b9\u4e8c";

            if (s11.Matches(numberMatch))
            {
                System.Console.Out.WriteLine("hooray numbers!");
            }
            else
            {
                System.Console.Out.WriteLine("Uh-oh numbers!");
            }
            string s12 = "\u767e\u5206\u4e4b\u4e09\u5341\u516b\u70b9\u516d";

            if (s12.Matches(numberMatch))
            {
                System.Console.Out.WriteLine("hooray numbers!");
            }
            else
            {
                System.Console.Out.WriteLine("Uh-oh numbers!");
            }
            string s2 = "\u4e09\u6708";

            if (s2.Matches(dateMatch))
            {
                System.Console.Out.WriteLine("hooray dates!");
            }
            else
            {
                System.Console.Out.WriteLine("Uh-oh dates!");
            }
            System.Console.Out.WriteLine("Testing tagged word");
            ClassicCounter <TaggedWord> c = new ClassicCounter <TaggedWord>();
            TaggedWord tw1 = new TaggedWord("w", "t");

            c.IncrementCount(tw1);
            TaggedWord tw2 = new TaggedWord("w", "t2");

            System.Console.Out.WriteLine(c.ContainsKey(tw2));
            System.Console.Out.WriteLine(tw1.Equals(tw2));
            WordTag wt1 = ToWordTag(tw1);
            WordTag wt2 = ToWordTag(tw2);
            WordTag wt3 = new WordTag("w", "t2");

            System.Console.Out.WriteLine(wt1.Equals(wt2));
            System.Console.Out.WriteLine(wt2.Equals(wt3));
        }