示例#1
0
        private static void Extract()
        {
            if (IsRunContract)
            {
                //合同处理
                Console.WriteLine("Start To Extract Info Contract TRAIN");
                StreamWriter ResultCSV       = new StreamWriter("Result" + Path.DirectorySeparatorChar + "hetong_train.txt", false, utf8WithoutBom);
                var          Contract_Result = Run <Contract>(ContractPath_TRAIN, ResultCSV);
                Evaluate.EvaluateContract(Contract_Result.Select((x) => (ContractRec)x).ToList());
                Console.WriteLine("Complete Extract Info Contract");
            }
            if (IsRunContract_TEST)
            {
                Console.WriteLine("Start To Extract Info Contract TEST");
                StreamWriter ResultCSV       = new StreamWriter("Result" + Path.DirectorySeparatorChar + "hetong.txt", false, utf8WithoutBom);
                var          Contract_Result = Run <Contract>(ContractPath_TEST, ResultCSV);
                Console.WriteLine("Complete Extract Info Contract");
            }

            if (IsRunStockChange || IsRunStockChange_TEST)
            {
                //增减持公告日期的读入
                StockChange.ImportPublishTime();
            }

            //增减持
            if (IsRunStockChange)
            {
                Console.WriteLine("Start To Extract Info StockChange TRAIN");
                StreamWriter ResultCSV          = new StreamWriter("Result" + Path.DirectorySeparatorChar + "zengjianchi_train.txt", false, utf8WithoutBom);
                var          StockChange_Result = Run <StockChange>(StockChangePath_TRAIN, ResultCSV);
                Evaluate.EvaluateStockChange(StockChange_Result.Select((x) => (StockChangeRec)x).ToList());
                Console.WriteLine("Complete Extract Info StockChange");
            }
            if (IsRunStockChange_TEST)
            {
                Console.WriteLine("Start To Extract Info StockChange TEST");
                StreamWriter ResultCSV          = new StreamWriter("Result" + Path.DirectorySeparatorChar + "zengjianchi.txt", false, utf8WithoutBom);
                var          StockChange_Result = Run <StockChange>(StockChangePath_TEST, ResultCSV);
                Console.WriteLine("Complete Extract Info StockChange");
            }

            //资产重组
            if (IsRunReorganization)
            {
                Console.WriteLine("Start To Extract Info Reorganization TRAIN");
                StreamWriter ResultCSV             = new StreamWriter("Result" + Path.DirectorySeparatorChar + "chongzu_train.txt", false, utf8WithoutBom);
                var          Reorganization_Result = Run <Reorganization>(ReorganizationPath_TRAIN, ResultCSV);
                Evaluate.EvaluateReorganization(Reorganization_Result.Select((x) => (ReorganizationRec)x).ToList());
                Console.WriteLine("Complete Extract Info Reorganization");
            }
            if (IsRunReorganization_TEST)
            {
                Console.WriteLine("Start To Extract Info Reorganization TEST");
                StreamWriter ResultCSV             = new StreamWriter("Result" + Path.DirectorySeparatorChar + "chongzu.txt", false, utf8WithoutBom);
                var          Reorganization_Result = Run <Reorganization>(ReorganizationPath_TEST, ResultCSV);
                Console.WriteLine("Complete Extract Info Reorganization");
            }
        }
示例#2
0
        private static void Extract()
        {
            var IsRunContract      = true;
            var IsRunContract_TEST = true;
            var ContractPath_TRAIN = DocBase + Path.DirectorySeparatorChar + "FDDC_announcements_round1_train_20180518" + Path.DirectorySeparatorChar + "重大合同";
            var ContractPath_TEST  = DocBase + Path.DirectorySeparatorChar + "FDDC_announcements_round1_test_b_20180708" + Path.DirectorySeparatorChar + "重大合同";

            var IsRunStockChange      = true;
            var IsRunStockChange_TEST = true;
            var StockChangePath_TRAIN = DocBase + Path.DirectorySeparatorChar + "FDDC_announcements_round1_train_20180518" + Path.DirectorySeparatorChar + "增减持";
            var StockChangePath_TEST  = DocBase + Path.DirectorySeparatorChar + "FDDC_announcements_round1_test_b_20180708" + Path.DirectorySeparatorChar + "增减持";

            var IsRunIncreaseStock      = true;
            var IsRunIncreaseStock_TEST = true;
            var IncreaseStockPath_TRAIN = DocBase + Path.DirectorySeparatorChar + @"FDDC_announcements_round1_train_20180518" + Path.DirectorySeparatorChar + "定增";
            var IncreaseStockPath_TEST  = DocBase + Path.DirectorySeparatorChar + @"FDDC_announcements_round1_test_b_20180708" + Path.DirectorySeparatorChar + "定增";

            if (IsRunContract)
            {
                //合同处理
                Console.WriteLine("Start To Extract Info Contract TRAIN");
                StreamWriter ResultCSV = new StreamWriter("Result" + Path.DirectorySeparatorChar + "hetong_train.txt", false, utf8WithoutBom);
                ResultCSV.WriteLine("公告id\t甲方\t乙方\t项目名称\t合同名称\t合同金额上限\t合同金额下限\t联合体成员");
                var Contract_Result = new List <struContract>();
                if (IsMultiThreadMode)
                {
                    var Bag = new ConcurrentBag <struContract>();    //线程安全版本
                    Parallel.ForEach(System.IO.Directory.GetFiles(ContractPath_TRAIN + Path.DirectorySeparatorChar + "html" + Path.DirectorySeparatorChar), (filename) =>
                    {
                        var contract = new Contract(filename);
                        foreach (var item in contract.Extract())
                        {
                            Bag.Add(item);
                        }
                    });
                    Contract_Result = Bag.ToList();
                    Contract_Result.Sort((x, y) => { return(x.id.CompareTo(y.id)); });
                    foreach (var item in Contract_Result)
                    {
                        ResultCSV.WriteLine(item.ConvertToString(item));
                    }
                }
                else
                {
                    foreach (var filename in System.IO.Directory.GetFiles(ContractPath_TRAIN + Path.DirectorySeparatorChar + "html" + Path.DirectorySeparatorChar))
                    {
                        var contract = new Contract(filename);
                        foreach (var item in contract.Extract())
                        {
                            Contract_Result.Add(item);
                            ResultCSV.WriteLine(item.ConvertToString(item));
                        }
                    }
                }

                ResultCSV.Close();
                Evaluate.EvaluateContract(Contract_Result);
                Console.WriteLine("Complete Extract Info Contract");
            }
            if (IsRunContract_TEST)
            {
                StreamWriter ResultCSV = new StreamWriter("Result" + Path.DirectorySeparatorChar + "hetong.txt", false, utf8WithoutBom);
                ResultCSV.WriteLine("公告id\t甲方\t乙方\t项目名称\t合同名称\t合同金额上限\t合同金额下限\t联合体成员");
                var Contract_Result = new List <struContract>();
                Console.WriteLine("Start To Extract Info Contract TEST");
                if (IsMultiThreadMode)
                {
                    Parallel.ForEach(System.IO.Directory.GetFiles(ContractPath_TEST + Path.DirectorySeparatorChar + "html" + Path.DirectorySeparatorChar), (filename) =>
                    {
                        var contract = new Contract(filename);
                        foreach (var item in contract.Extract())
                        {
                            Contract_Result.Add(item);
                        }
                    });
                    Contract_Result.Sort((x, y) => { return(x.id.CompareTo(y.id)); });
                    foreach (var item in Contract_Result)
                    {
                        ResultCSV.WriteLine(item.ConvertToString(item));
                    }
                }
                else
                {
                    foreach (var filename in System.IO.Directory.GetFiles(ContractPath_TEST + Path.DirectorySeparatorChar + "html" + Path.DirectorySeparatorChar))
                    {
                        var contract = new Contract(filename);
                        foreach (var item in contract.Extract())
                        {
                            Contract_Result.Add(item);
                            ResultCSV.WriteLine(item.ConvertToString(item));
                        }
                    }
                }
                ResultCSV.Close();
                Console.WriteLine("Complete Extract Info Contract");
            }


            if (IsRunStockChange)
            {
                //增减持
                Console.WriteLine("Start To Extract Info StockChange TRAIN");
                StreamWriter ResultCSV = new StreamWriter("Result" + Path.DirectorySeparatorChar + "zengjianchi_train.txt", false, utf8WithoutBom);
                ResultCSV.WriteLine("公告id\t股东全称\t股东简称\t变动截止日期\t变动价格\t变动数量\t变动后持股数\t变动后持股比例");
                var StockChange_Result = new List <struStockChange>();
                foreach (var filename in System.IO.Directory.GetFiles(StockChangePath_TRAIN + Path.DirectorySeparatorChar + "html" + Path.DirectorySeparatorChar))
                {
                    var stockchange = new StockChange(filename);
                    foreach (var item in stockchange.Extract())
                    {
                        StockChange_Result.Add(item);
                        ResultCSV.WriteLine(item.ConvertToString(item));
                    }
                }
                ResultCSV.Close();
                Evaluate.EvaluateStockChange(StockChange_Result);
                Console.WriteLine("Complete Extract Info StockChange");
            }
            if (IsRunStockChange_TEST)
            {
                StreamWriter ResultCSV = new StreamWriter("Result" + Path.DirectorySeparatorChar + "zengjianchi.txt", false, utf8WithoutBom);
                ResultCSV.WriteLine("公告id\t股东全称\t股东简称\t变动截止日期\t变动价格\t变动数量\t变动后持股数\t变动后持股比例");
                Console.WriteLine("Start To Extract Info StockChange TEST");
                foreach (var filename in System.IO.Directory.GetFiles(StockChangePath_TEST + Path.DirectorySeparatorChar + "html" + Path.DirectorySeparatorChar))
                {
                    var stockchange = new StockChange(filename);
                    foreach (var item in stockchange.Extract())
                    {
                        ResultCSV.WriteLine(item.ConvertToString(item));
                    }
                }
                ResultCSV.Close();
                Console.WriteLine("Complete Extract Info StockChange");
            }

            if (IsRunIncreaseStock)
            {
                //定增
                StreamWriter ResultCSV = new StreamWriter("Result" + Path.DirectorySeparatorChar + "dingzeng_train.txt", false, utf8WithoutBom);
                ResultCSV.WriteLine("公告id\t增发对象\t增发数量\t增发金额\t锁定期\t认购方式");
                Console.WriteLine("Start To Extract Info IncreaseStock TRAIN");
                var Increase_Result = new List <struIncreaseStock>();

                if (IsMultiThreadMode)
                {
                    Parallel.ForEach(System.IO.Directory.GetFiles(IncreaseStockPath_TRAIN + Path.DirectorySeparatorChar + "html" + Path.DirectorySeparatorChar), (filename) =>
                    {
                        var increasestock = new IncreaseStock(filename);
                        foreach (var item in increasestock.Extract())
                        {
                            Increase_Result.Add(item);
                        }
                    });
                    Increase_Result.Sort((x, y) => { return(x.id.CompareTo(y.id)); });
                    foreach (var item in Increase_Result)
                    {
                        ResultCSV.WriteLine(item.ConvertToString(item));
                    }
                }
                else
                {
                    foreach (var filename in System.IO.Directory.GetFiles(IncreaseStockPath_TRAIN + Path.DirectorySeparatorChar + "html" + Path.DirectorySeparatorChar))
                    {
                        var increasestock = new IncreaseStock(filename);
                        foreach (var item in increasestock.Extract())
                        {
                            Increase_Result.Add(item);
                            ResultCSV.WriteLine(item.ConvertToString(item));
                        }
                    }
                }
                ResultCSV.Close();
                Evaluate.EvaluateIncreaseStock(Increase_Result);
                Console.WriteLine("Complete Extract Info IncreaseStock");
            }

            if (IsRunIncreaseStock_TEST)
            {
                StreamWriter ResultCSV = new StreamWriter("Result" + Path.DirectorySeparatorChar + "dingzeng.txt", false, utf8WithoutBom);
                ResultCSV.WriteLine("公告id\t增发对象\t增发数量\t增发金额\t锁定期\t认购方式");
                Console.WriteLine("Start To Extract Info IncreaseStock TEST");
                foreach (var filename in System.IO.Directory.GetFiles(IncreaseStockPath_TEST + Path.DirectorySeparatorChar + "html" + Path.DirectorySeparatorChar))
                {
                    var increasestock = new IncreaseStock(filename);
                    foreach (var item in increasestock.Extract())
                    {
                        ResultCSV.WriteLine(item.ConvertToString(item));
                    }
                }
                ResultCSV.Close();
                Console.WriteLine("Complete Extract Info IncreaseStock");
            }
        }
示例#3
0
        private static void Extract()
        {
            var IsRunContract      = true;
            var IsRunContract_TEST = true;
            var ContractPath_TRAIN = DocBase + @"\FDDC_announcements_round1_train_20180518\round1_train_20180518\重大合同";
            var ContractPath_TEST  = DocBase + @"\FDDC_announcements_round1_test_a_20180605\重大合同";

            var IsRunStockChange      = false;
            var IsRunStockChange_TEST = false;
            var StockChangePath_TRAIN = DocBase + @"\FDDC_announcements_round1_train_20180518\round1_train_20180518\增减持";
            var StockChangePath_TEST  = DocBase + @"\FDDC_announcements_round1_test_a_20180605\增减持";

            var IsRunIncreaseStock      = false;
            var IsRunIncreaseStock_TEST = false;
            var IncreaseStockPath_TRAIN = DocBase + @"\FDDC_announcements_round1_train_20180518\round1_train_20180518\定增";
            var IncreaseStockPath_TEST  = DocBase + @"\FDDC_announcements_round1_test_a_20180605\定增";

            if (IsRunContract)
            {
                //合同处理
                //通过训练获得各种字段的最大长度,便于抽取的时候做置信度检查
                Console.WriteLine("Start To Extract Info Contract TRAIN");
                StreamWriter ResultCSV = new StreamWriter("Result\\hetong_train.csv", false, Encoding.GetEncoding("gb2312"));
                ResultCSV.WriteLine("公告id,甲方,乙方,项目名称,合同名称,合同金额上限,合同金额下限,联合体成员");
                var StockChange_Result = new List <struContract>();
                foreach (var filename in System.IO.Directory.GetFiles(ContractPath_TRAIN + @"\html\"))
                {
                    foreach (var item in Contract.Extract(filename))
                    {
                        StockChange_Result.Add(item);
                        ResultCSV.WriteLine(Contract.ConvertToString(item));
                    }
                }
                ResultCSV.Close();
                Evaluate.EvaluateContract(StockChange_Result);
                Console.WriteLine("Complete Extract Info Contract");
            }
            if (IsRunContract_TEST)
            {
                StreamWriter ResultCSV = new StreamWriter("Result\\hetong.csv", false, Encoding.GetEncoding("gb2312"));
                ResultCSV.WriteLine("公告id,甲方,乙方,项目名称,合同名称,合同金额上限,合同金额下限,联合体成员");
                Console.WriteLine("Start To Extract Info Contract TEST");
                foreach (var filename in System.IO.Directory.GetFiles(ContractPath_TEST + @"\html\"))
                {
                    foreach (var item in Contract.Extract(filename))
                    {
                        ResultCSV.WriteLine(Contract.ConvertToString(item));
                    }
                }
                ResultCSV.Close();
                Console.WriteLine("Complete Extract Info Contract");
            }


            if (IsRunStockChange)
            {
                //增减持
                Console.WriteLine("Start To Extract Info StockChange TRAIN");
                StreamWriter ResultCSV = new StreamWriter("Result\\zengjianchi_train.csv", false, Encoding.GetEncoding("gb2312"));
                ResultCSV.WriteLine("公告id,股东全称,股东简称,变动截止日期,变动价格,变动数量,变动后持股数,变动后持股比例");
                var StockChange_Result = new List <struStockChange>();
                foreach (var filename in System.IO.Directory.GetFiles(StockChangePath_TRAIN + @"\html\"))
                {
                    foreach (var item in StockChange.Extract(filename))
                    {
                        StockChange_Result.Add(item);
                        ResultCSV.WriteLine(StockChange.ConvertToString(item));
                    }
                }
                ResultCSV.Close();
                Evaluate.EvaluateStockChange(StockChange_Result);
                Console.WriteLine("Complete Extract Info StockChange");
            }
            if (IsRunStockChange_TEST)
            {
                StreamWriter ResultCSV = new StreamWriter("Result\\zengjianchi.csv", false, Encoding.GetEncoding("gb2312"));
                ResultCSV.WriteLine("公告id,股东全称,股东简称,变动截止日期,变动价格,变动数量,变动后持股数,变动后持股比例");
                Console.WriteLine("Start To Extract Info StockChange TEST");
                foreach (var filename in System.IO.Directory.GetFiles(StockChangePath_TEST + @"\html\"))
                {
                    foreach (var item in StockChange.Extract(filename))
                    {
                        ResultCSV.WriteLine(StockChange.ConvertToString(item));
                    }
                }
                ResultCSV.Close();
                Console.WriteLine("Complete Extract Info StockChange");
            }

            if (IsRunIncreaseStock)
            {
                //定增
                StreamWriter ResultCSV = new StreamWriter("Result\\dingzeng_train.csv", false, Encoding.GetEncoding("gb2312"));
                ResultCSV.WriteLine("公告id,增发对象,增发数量,增发金额,锁定期,认购方式");
                Console.WriteLine("Start To Extract Info IncreaseStock TRAIN");
                var Increase_Result = new List <struIncreaseStock>();
                foreach (var filename in System.IO.Directory.GetFiles(IncreaseStockPath_TRAIN + @"\html\"))
                {
                    foreach (var item in IncreaseStock.Extract(filename))
                    {
                        Increase_Result.Add(item);
                        ResultCSV.WriteLine(IncreaseStock.ConvertToString(item));
                    }
                }
                ResultCSV.Close();
                Evaluate.EvaluateIncreaseStock(Increase_Result);
                Console.WriteLine("Complete Extract Info IncreaseStock");
            }

            if (IsRunIncreaseStock_TEST)
            {
                StreamWriter ResultCSV = new StreamWriter("Result\\dingzeng.csv", false, Encoding.GetEncoding("gb2312"));
                ResultCSV.WriteLine("公告id,增发对象,增发数量,增发金额,锁定期,认购方式");
                Console.WriteLine("Start To Extract Info IncreaseStock TEST");
                foreach (var filename in System.IO.Directory.GetFiles(IncreaseStockPath_TEST + @"\html\"))
                {
                    foreach (var item in IncreaseStock.Extract(filename))
                    {
                        ResultCSV.WriteLine(IncreaseStock.ConvertToString(item));
                    }
                }
                ResultCSV.Close();
                Console.WriteLine("Complete Extract Info IncreaseStock");
            }
        }
示例#4
0
        private static void Extract()
        {
            if (IsRunContract)
            {
                //合同处理
                Console.WriteLine("Start To Extract Info Contract TRAIN");
                StreamWriter ResultCSV       = new StreamWriter("Result" + Path.DirectorySeparatorChar + "hetong_train.txt", false, utf8WithoutBom);
                var          Contract_Result = Run <Contract>(ContractPath_TRAIN, ContractPath_TRAIN, ResultCSV);
                Evaluate.EvaluateContract(Contract_Result.Select((x) => (ContractRec)x).ToList());
                Console.WriteLine("Complete Extract Info Contract");
            }
            if (IsRunContract_TEST)
            {
                Console.WriteLine("Start To Extract Info Contract TEST");
                StreamWriter ResultCSV       = new StreamWriter("Result" + Path.DirectorySeparatorChar + "hetong.txt", false, utf8WithoutBom);
                var          Contract_Result = Run <Contract>(ContractPath_TEST, ContractPath_TEST, ResultCSV);
                Console.WriteLine("Complete Extract Info Contract");
            }

            if (IsRunStockChange || IsRunStockChange_TEST)
            {
                //增减持公告日期的读入(这里读入的是CSV,本番使用XLSX文件)
                StockChange.ImportPublishTime();
            }

            //增减持
            if (IsRunStockChange)
            {
                Console.WriteLine("Start To Extract Info StockChange TRAIN");
                StreamWriter ResultCSV          = new StreamWriter("Result" + Path.DirectorySeparatorChar + "zengjianchi_train.txt", false, utf8WithoutBom);
                var          StockChange_Result = Run <StockChange>(StockChangePath_TRAIN, StockChangePath_TRAIN, ResultCSV);
                Evaluate.EvaluateStockChange(StockChange_Result.Select((x) => (StockChangeRec)x).ToList());
                Console.WriteLine("Complete Extract Info StockChange");
            }
            if (IsRunStockChange_TEST)
            {
                Console.WriteLine("Start To Extract Info StockChange TEST");
                StreamWriter ResultCSV          = new StreamWriter("Result" + Path.DirectorySeparatorChar + "zengjianchi.txt", false, utf8WithoutBom);
                var          StockChange_Result = Run <StockChange>(StockChangePath_TEST, StockChangePath_TEST, ResultCSV);
                Console.WriteLine("Complete Extract Info StockChange");
            }

            if (IsRunReorganization || IsRunReorganization_TEST)
            {
                //替代训练结果
                Console.WriteLine("加载替代训练结果");
                ReOrganizationTraning.EvaluateMethodList = new string[] {
                    "收益法", "资产基础法", "市场法", "市场比较法", "估值法", "成本法", "现金流折现法", "现金流折现法",
                    "内含价值调整法", "可比公司市净率法", "重置成本法", "收益现值法", "基础资产法", "假设清偿法",
                    "成本逼近法", "单项资产加和法", "成本加和法", "基准地价修正法", "收益还原法", "现金流量法", "单项资产加总法", "折现现金流量法"
                }.ToList();
                Console.WriteLine("加载替代训练结果:" + ReOrganizationTraning.EvaluateMethodList.Count);
            }

            //资产重组
            if (IsRunReorganization)
            {
                Console.WriteLine("Start To Extract Info Reorganization TRAIN");
                StreamWriter ResultCSV             = new StreamWriter("Result" + Path.DirectorySeparatorChar + "chongzu_train.txt", false, utf8WithoutBom);
                var          Reorganization_Result = Run <Reorganization>(ReorganizationPath_TRAIN, "", ResultCSV);
                Evaluate.EvaluateReorganization(Reorganization_Result.Select((x) => (ReorganizationRec)x).ToList());
                Console.WriteLine("Complete Extract Info Reorganization");
            }
            if (IsRunReorganization_TEST)
            {
                Console.WriteLine("Start To Extract Info Reorganization TEST");
                StreamWriter ResultCSV             = new StreamWriter("Result" + Path.DirectorySeparatorChar + "chongzu.txt", false, utf8WithoutBom);
                var          Reorganization_Result = Run <Reorganization>(ReorganizationPath_TEST, "", ResultCSV);
                Console.WriteLine("Complete Extract Info Reorganization");
            }
        }
示例#5
0
        static void Main(string[] args)
        {
            //初始化
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
            BussinessLogic.LoadCompanyName(@"Resources\FDDC_announcements_company_name_20180531.json");

            //测试区
            //生成PDF的TXT文件的批处理命令
            //PDFToTXT.GetBatchFile();
            //分词系统
            //WordAnlayze.CompanyAnlayze();
            //UT.RunWordAnlayze();
            //UT.StockChangeTest();
            //UT.IncreaseStockTest();
            //UT.ContractTest();
            //UT.RegularExpress();
            //UT.JianchengTest();
            //Logger.Close();
            //Traning.InitIncreaseStock();
            //StockChange.Extract(Program.DocBase + @"\FDDC_announcements_round1_train_20180518\round1_train_20180518\增减持\html\314146.html");
            //WordAnlayze.segmenter.LoadUserDict(@"Resources\dictAdjust.txt");
            //return;

            var IsRunContract      = true;
            var IsRunContract_TEST = false;

            var IsRunStockChange      = false;
            var IsRunStockChange_TEST = false;

            var IsRunIncreaseStock      = false;
            var IsRunIncreaseStock_TEST = false;

            var IncreaseStockPath_TEST = DocBase + @"\FDDC_announcements_round1_test_a_20180605\定增";
            var ContractPath_TEST      = DocBase + @"\FDDC_announcements_round1_test_a_20180605\重大合同";
            var StockChangePath_TEST   = DocBase + @"\FDDC_announcements_round1_test_a_20180605\增减持";

            if (IsRunContract)
            {
                //合同处理
                var ContractPath_TRAIN = DocBase + @"\FDDC_announcements_round1_train_20180518\round1_train_20180518\重大合同";
                Console.WriteLine("Start To Extract Info Contract TRAIN");
                StreamWriter ResultCSV          = new StreamWriter("Result\\hetong_train.csv", false, Encoding.GetEncoding("gb2312"));
                var          StockChange_Result = new List <struContract>();
                foreach (var filename in System.IO.Directory.GetFiles(ContractPath_TRAIN + @"\html\"))
                {
                    foreach (var item in Contract.Extract(filename))
                    {
                        StockChange_Result.Add(item);
                        ResultCSV.WriteLine(Contract.ConvertToString(item));
                    }
                }
                ResultCSV.Close();
                Traning.InitContract();
                Evaluate.EvaluateContract(StockChange_Result);
                Console.WriteLine("Complete Extract Info Contract");
            }
            if (IsRunContract_TEST)
            {
                StreamWriter ResultCSV = new StreamWriter("Result\\hetong.csv", false, Encoding.GetEncoding("gb2312"));
                Console.WriteLine("Start To Extract Info Contract TEST");
                foreach (var filename in System.IO.Directory.GetFiles(ContractPath_TEST + @"\html\"))
                {
                    foreach (var item in Contract.Extract(filename))
                    {
                        ResultCSV.WriteLine(Contract.ConvertToString(item));
                    }
                }
                ResultCSV.Close();
                Console.WriteLine("Complete Extract Info Contract");
            }


            if (IsRunStockChange)
            {
                //增减持
                Console.WriteLine("Start To Extract Info StockChange TRAIN");
                StreamWriter ResultCSV             = new StreamWriter("Result\\zengjianchi_Train.csv", false, Encoding.GetEncoding("gb2312"));
                var          StockChangePath_TRAIN = DocBase + @"\FDDC_announcements_round1_train_20180518\round1_train_20180518\增减持";
                var          StockChange_Result    = new List <struStockChange>();
                foreach (var filename in System.IO.Directory.GetFiles(StockChangePath_TRAIN + @"\html\"))
                {
                    foreach (var item in StockChange.Extract(filename))
                    {
                        StockChange_Result.Add(item);
                        ResultCSV.WriteLine(StockChange.ConvertToString(item));
                    }
                }
                ResultCSV.Close();
                Traning.InitStockChange();
                Evaluate.EvaluateStockChange(StockChange_Result);
                Console.WriteLine("Complete Extract Info StockChange");
            }
            if (IsRunStockChange_TEST)
            {
                StreamWriter ResultCSV = new StreamWriter("Result\\zengjianchi.csv", false, Encoding.GetEncoding("gb2312"));
                Console.WriteLine("Start To Extract Info StockChange TEST");
                foreach (var filename in System.IO.Directory.GetFiles(StockChangePath_TEST + @"\html\"))
                {
                    foreach (var item in StockChange.Extract(filename))
                    {
                        ResultCSV.WriteLine(StockChange.ConvertToString(item));
                    }
                }
                ResultCSV.Close();
                Console.WriteLine("Complete Extract Info StockChange");
            }

            if (IsRunIncreaseStock)
            {
                //定增
                StreamWriter ResultCSV = new StreamWriter("Result\\dingzeng_train.csv", false, Encoding.GetEncoding("gb2312"));
                var          IncreaseStockPath_TRAIN = DocBase + @"\FDDC_announcements_round1_train_20180518\round1_train_20180518\定增";
                Console.WriteLine("Start To Extract Info IncreaseStock TRAIN");
                var Increase_Result = new List <struIncreaseStock>();
                foreach (var filename in System.IO.Directory.GetFiles(IncreaseStockPath_TRAIN + @"\html\"))
                {
                    foreach (var item in IncreaseStock.Extract(filename))
                    {
                        Increase_Result.Add(item);
                        ResultCSV.WriteLine(IncreaseStock.ConvertToString(item));
                    }
                }
                ResultCSV.Close();
                Traning.InitIncreaseStock();
                Evaluate.EvaluateIncreaseStock(Increase_Result);
                Console.WriteLine("Complete Extract Info IncreaseStock");
            }

            if (IsRunIncreaseStock_TEST)
            {
                StreamWriter ResultCSV = new StreamWriter("Result\\dingzeng.csv", false, Encoding.GetEncoding("gb2312"));
                Console.WriteLine("Start To Extract Info IncreaseStock TEST");
                foreach (var filename in System.IO.Directory.GetFiles(IncreaseStockPath_TEST + @"\html\"))
                {
                    foreach (var item in IncreaseStock.Extract(filename))
                    {
                        ResultCSV.WriteLine(IncreaseStock.ConvertToString(item));
                    }
                }
                ResultCSV.Close();
                Console.WriteLine("Complete Extract Info IncreaseStock");
            }
            Logger.Close();
        }