/// <summary> /// 为所有词语进行置信度评价 /// </summary> public string EvaluateCI() { var Result = ""; var MaxScore = -1; if (Confidence != null) { foreach (var candidate in LeadingColonKeyWordCandidate) { //项目名称:这样的候选词置信度最高,趋向于无条件置信 var score = 1000; Program.CIRecord.WriteLine(candidate + ":" + score); if (score > MaxScore) { Result = candidate; MaxScore = score; } } foreach (var candidate in QuotationTrailingCandidate) { var score = Confidence.Predict(candidate) * 2; Program.CIRecord.WriteLine(candidate + ":" + score); if (score > MaxScore) { Result = candidate; MaxScore = score; } } foreach (var candidate in DpKeyWordCandidate) { var score = Confidence.Predict(candidate); Program.CIRecord.WriteLine(candidate + ":" + score); if (score > MaxScore) { Result = candidate; MaxScore = score; } } foreach (var candidate in ExternalStartEndStringFeatureCandidate) { var score = Confidence.Predict(candidate); Program.CIRecord.WriteLine(candidate + ":" + score); if (score > MaxScore) { Result = candidate; MaxScore = score; } } } return(Result); }
/// <summary> /// 为所有词语进行置信度评价 /// </summary> public string EvaluateCI() { var Result = ""; var MaxScore = -1; if (Confidence != null) { foreach (var candidate in LeadingColonKeyWordCandidate) { //项目名称:这样的候选词置信度最高,趋向于无条件置信 var score = 1000; if (!Program.IsMultiThreadMode) { Logger.WriteLine(candidate + ":" + score); } if (score > MaxScore) { Result = candidate; MaxScore = score; } } foreach (var candidate in QuotationTrailingCandidate) { var score = Confidence.Predict(candidate) * 2; if (!Program.IsMultiThreadMode) { Logger.WriteLine(candidate + ":" + score); } if (score > MaxScore) { Result = candidate; MaxScore = score; } } foreach (var candidate in DpKeyWordCandidate) { var score = Confidence.Predict(candidate); if (!Program.IsMultiThreadMode) { Logger.WriteLine(candidate + ":" + score); } if (score > MaxScore) { Result = candidate; MaxScore = score; } } foreach (var candidate in ExternalStartEndStringFeatureCandidate) { var score = Confidence.Predict(candidate); if (!Program.IsMultiThreadMode) { Logger.WriteLine(candidate + ":" + score); } if (score > MaxScore) { Result = candidate; MaxScore = score; } } } else { if (LeadingColonKeyWordCandidate != null && LeadingColonKeyWordCandidate.Count > 0) { return(LeadingColonKeyWordCandidate.First()); } if (QuotationTrailingCandidate != null && QuotationTrailingCandidate.Count > 0) { return(QuotationTrailingCandidate.First()); } if (DpKeyWordCandidate != null && DpKeyWordCandidate.Count > 0) { return(DpKeyWordCandidate.First()); } if (ExternalStartEndStringFeatureCandidate != null && ExternalStartEndStringFeatureCandidate.Count > 0) { return(ExternalStartEndStringFeatureCandidate.First()); } } return(Result); }