コード例 #1
0
        private static void Match()
        {
            AddrSet addrset = AddrSet.GetInstance();

            //Match
            MatchMachine m = new MatchMachine(addrset);

            MatchResult result = m.Match(new string[] { "B" });

            MatchHelper.rwLockDashboard(addrset);
        }
コード例 #2
0
        private static void Train()
        {
            AddrSet addrset = AddrSet.GetInstance();

            TrainMachine t = new TrainMachine(addrset);

            List <InsertElement> list = new List <InsertElement>();

            Random rnd = new Random();

            list.Add(new InsertElement(rnd.Next().ToString("0.00"), LEVEL.City, InsertMode.AutoPlace | InsertMode.ExactlyLevel));

            t.Train(list, true);

            MatchHelper.rwLockDashboard(addrset);
        }
コード例 #3
0
        public void Match()
        {
            //start
            AddrSet addrset = AddrSet.GetInstance();

            //Match
            MatchMachine m = new MatchMachine(addrset);

            // Custom the MatchRule
            //m.SetMatchRule(rule);

            MatchResult result = m.Match(new string[] { "B" });


            MatchHelper.PrintResult(result);

            //close
            //addrset.Dump();
        }
コード例 #4
0
ファイル: InitTest.cs プロジェクト: whuttoken/AddressMatch
        public static void InitFromFile()
        {
            AddrSet set = AddrSet.GetInstance();

            //foreach(GraphNode gnode in AddrSet.AddrGraph.root.NextNodeList)
            //{
            //    TableNode tnode = new TableNode(gnode);
            //    AddrSet.AddrGraph.NodeTable.Add(tnode.Name,tnode);
            //}
            set.Dump();
            //AddrSet.AddrGraph = new Graph();
            //AddrSet.AddrGraph.root = new GraphNode("root", LEVEL.Root);
            //AddrSet.AddrGraph.NodeTable = new Hashtable();
            //AddrSet.AddrGraph.NodeCount = 0;
            //AddrSet.DumpDirectory = @"D:\";
            //AddrSet set = new AddrSet(1);
            //set.Dump();
            //TableNode tnode = new TableNode(gnode);
            //AddrSet.AddrGraph.NodeTable.Add(tnode.Name,tnode);
        }
コード例 #5
0
        public void Train()
        {
            //start
            AddrSet addrset = AddrSet.GetInstance();

            TrainMachine m = new TrainMachine(addrset);

            List <InsertElement> list = new List <InsertElement>();

            list.Add(new InsertElement("武汉", LEVEL.City, InsertMode.AutoPlace | InsertMode.ExactlyLevel));

            list.Add(new InsertElement("理工大", LEVEL.Other, InsertMode.AutoPlace | InsertMode.ExactlyLevel));

            list.Add(new InsertElement("屋檐下", LEVEL.Uncertainty, InsertMode.AutoPlace | InsertMode.ExactlyLevel));

            m.Train(list, true);

            //close
            //addrset.Dump();
        }
コード例 #6
0
        public static void Test()
        {
            Thread[] thread_match = new Thread[10];
            for (int i = 0; i < 10; i++)
            {
                thread_match[i] = new Thread(new ThreadStart(Match));
                thread_match[i].Start();
            }
            Thread[] thread_train = new Thread[10];
            for (int i = 0; i < 10; i++)
            {
                thread_train[i] = new Thread(new ThreadStart(Train));
                thread_train[i].Start();
            }
            for (int i = 0; i < 10; i++)
            {
                thread_match[i].Join();
                thread_train[i].Join();
            }
            AddrSet addrset = AddrSet.GetInstance();

            Console.WriteLine("end");
        }
コード例 #7
0
        public DemoTest()
        {
            //start
            AddrSet addrset = AddrSet.GetInstance();

            //Match
            MatchMachine m = new MatchMachine(addrset);

            MatchResult result = m.Match(new string[] { "B" });


            MatchHelper.PrintResult(result);

            //Train   ----------TODO


            //close
            //addrset.Dump();

            TableNode t    = AddrSet.AddrGraph.NodeTable["B"] as TableNode;
            bool      flag = result.Result.Equals(t.GNode);

            Console.WriteLine("XXX  " + flag);
        }