This commit is contained in:
owenchen committed 2026-06-02 11:01:00 +08:00
1 parent bcd8ebab67
commit 5f222a23b3
6 files changed
+207 -44

No files matched your search

+8 -3
View File
@@ -42,7 +42,7 @@ namespace CloudBuilder.Topshelf.Task
List<HanlpConstituencyNode> cons = null;
SpeakerAnalysisHelper speakerFeatureLearner = new SpeakerAnalysisHelper();
SpeakerAnalysisHelper speakerAnalysisHelper = new SpeakerAnalysisHelper();
AiSentenceViewEntity[] ents = repository.DetachedEntities.Where(x => x.BookId == guid).OrderBy(x => x.ChapterId).ThenBy(x => x.ParagraphId).ThenBy(x => x.SentenceIndex).ToArray();
if (ents == null || ents.Length == 0) return;
@@ -54,11 +54,12 @@ namespace CloudBuilder.Topshelf.Task
int totalLines = ents.Length;
int processedLines = 0; // 已处理行数计数器
AiChapterPersonEntity aiChapterPerson;
List<AiChapterPersonEntity> cps = new List<AiChapterPersonEntity>();
foreach (var ent in ents)
{
processedLines++;
person = speakerFeatureLearner.GetPerson(hanlp, ent.Content);
person = speakerAnalysisHelper.GetPerson(hanlp, ent.Content);
paragraphIndex = ent.ParagraphId;
if (!string.IsNullOrEmpty(person))
@@ -72,8 +73,9 @@ namespace CloudBuilder.Topshelf.Task
aiChapterPerson.PersonName = p;
aiChapterPerson.ChapterId = ent.ChapterId;
aiChapterPerson.ParagraphIndex = ent.ParagraphId;
aiChapterPerson.SentenceIndex= ent.SentenceIndex;
aiChapterPerson.OrderIndex = orderIndex++;
cps.Add(aiChapterPerson);
repositoryAiChapterPersonEntity.InsertNow(aiChapterPerson);
}
}
@@ -81,6 +83,9 @@ namespace CloudBuilder.Topshelf.Task
UpdateProgress(processedLines, totalLines);
}
speakerAnalysisHelper.AiChapterPersons = cps.ToArray();
speakerAnalysisHelper.MatchPerson(ents, repositoryAiSentenceEntity);
}
catch (Exception ex)
{