From 8c8ab4ff5ff89332f0ebcf052606cf448648c3c2 Mon Sep 17 00:00:00 2001 From: owenchen Date: Fri, 29 May 2026 16:52:56 +0800 Subject: [PATCH] ow --- Properties/launchSettings.json | 2 +- Task/AI/ChineseNameExtractorTask.cs | 19 +++++++++++++++---- Utility/SpeakerAnalysisHelper.cs | 2 +- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Properties/launchSettings.json b/Properties/launchSettings.json index b04a110..ea2989a 100644 --- a/Properties/launchSettings.json +++ b/Properties/launchSettings.json @@ -2,7 +2,7 @@ "profiles": { "CloudBuilder.Topshelf": { "commandName": "Project", - "commandLineArgs": "task:PythonRunTask book_id:B000008" + "commandLineArgs": "task:ChineseNameExtractorTask book_id:B000008" } } } \ No newline at end of file diff --git a/Task/AI/ChineseNameExtractorTask.cs b/Task/AI/ChineseNameExtractorTask.cs index 16b613e..acc3861 100644 --- a/Task/AI/ChineseNameExtractorTask.cs +++ b/Task/AI/ChineseNameExtractorTask.cs @@ -32,6 +32,8 @@ namespace CloudBuilder.Topshelf.Task IRepository repositoryAiSentenceEntity = service.GetRepository>(); + IRepository repositoryAiChapterPersonEntity = service.GetRepository>(); + string depRoot; List ners; @@ -51,7 +53,7 @@ namespace CloudBuilder.Topshelf.Task int totalLines = ents.Length; int processedLines = 0; // 已处理行数计数器 - + AiChapterPersonEntity aiChapterPerson; foreach (var ent in ents) { processedLines++; @@ -61,10 +63,19 @@ namespace CloudBuilder.Topshelf.Task if (!string.IsNullOrEmpty(person)) { - aiSentenceEntity = repositoryAiSentenceEntity.Entities.Where(x => x.SentenceId == ent.SentenceId).FirstOrDefault(); - aiSentenceEntity.PersonName = person; + string[] ps = person.Split(','); + int orderIndex = 1; + foreach (var p in ps) + { + if (p.Length == 1) continue; + aiChapterPerson = new AiChapterPersonEntity(); + aiChapterPerson.PersonName = p; + aiChapterPerson.ChapterId = ent.ChapterId; + aiChapterPerson.ParagraphIndex = ent.ParagraphId; + aiChapterPerson.OrderIndex = orderIndex++; - repositoryAiSentenceEntity.UpdateNow(aiSentenceEntity); + repositoryAiChapterPersonEntity.InsertNow(aiChapterPerson); + } } UpdateProgress(processedLines, totalLines); diff --git a/Utility/SpeakerAnalysisHelper.cs b/Utility/SpeakerAnalysisHelper.cs index e1bb354..e84b445 100644 --- a/Utility/SpeakerAnalysisHelper.cs +++ b/Utility/SpeakerAnalysisHelper.cs @@ -103,7 +103,7 @@ namespace CloudBuilder.Topshelf.Utility } //如果主语==动作发出者 - if (!string.IsNullOrEmpty(person) && !ps.Contains(person) && !ps.Contains(string.Format("[{0}]", person))) ps.Add(string.Format("[{0}]", person)); + //if (!string.IsNullOrEmpty(person) && !ps.Contains(person) && !ps.Contains(string.Format("[{0}]", person))) ps.Add(string.Format("[{0}]", person)); //动作接受者 //if (!string.IsNullOrEmpty(arg1) && !ps.Contains(arg1)) ps.Add(arg1);