static string GetContractName(MyRootHtmlNode root) { var Extractor = new ExtractProperty(); var MarkFeature = new ExtractProperty.struMarkFeature(); MarkFeature.MarkStartWith = "《"; MarkFeature.MarkEndWith = "》"; MarkFeature.InnerEndWith = "合同"; var MarkFeatureConfirm = new ExtractProperty.struMarkFeature(); MarkFeatureConfirm.MarkStartWith = "《"; MarkFeatureConfirm.MarkEndWith = "》"; MarkFeatureConfirm.InnerEndWith = "确认书"; Extractor.MarkFeature = new ExtractProperty.struMarkFeature[] { MarkFeature, MarkFeatureConfirm }; Extractor.Extract(root); foreach (var item in Extractor.CandidateWord) { Program.Logger.WriteLine("合同名称候补词(《XXX》):[" + item + "]"); return(item); } Extractor = new ExtractProperty(); //这些关键字后面 Extractor.LeadingWordList = new string[] { "合同名称:" }; Extractor.Extract(root); foreach (var item in Extractor.CandidateWord) { Program.Logger.WriteLine("合同名称候补词(关键字):[" + item + "]"); return(item); } //合同 Extractor = new ExtractProperty(); var StartArray = new string[] { "签署了" }; var EndArray = new string[] { "合同" }; Extractor.StartEndFeature = Utility.GetStartEndStringArray(StartArray, EndArray); Extractor.Extract(root); foreach (var item in Extractor.CandidateWord) { Program.Logger.WriteLine("合同候补词(合同):[" + item + "]"); return(item.Replace(" ", "")); } return(""); }
static string GetProjectName(MyRootHtmlNode root) { var Extractor = new ExtractProperty(); //这些关键字后面 Extractor.LeadingWordList = new string[] { "项目名称:" }; Extractor.Extract(root); foreach (var item in Extractor.CandidateWord) { Program.Logger.WriteLine("项目名称候补词(关键字):[" + item + "]"); return(item.Replace(" ", "")); } var MarkFeature = new ExtractProperty.struMarkFeature(); MarkFeature.MarkStartWith = "“"; MarkFeature.MarkEndWith = "”"; MarkFeature.InnerEndWith = "标段"; var MarkFeatureConfirm = new ExtractProperty.struMarkFeature(); MarkFeatureConfirm.MarkStartWith = "“"; MarkFeatureConfirm.MarkEndWith = "”"; MarkFeatureConfirm.InnerEndWith = "标"; Extractor.MarkFeature = new ExtractProperty.struMarkFeature[] { MarkFeature, MarkFeatureConfirm }; Extractor.Extract(root); foreach (var item in Extractor.CandidateWord) { Program.Logger.WriteLine("工程名称候补词(《XXX》):[" + item + "]"); return(item); } var list = BussinessLogic.GetProjectName(root); if (list.Count > 0) { return(list[0]); } return(""); }