This commit is contained in:
owenchen 2026-05-29 16:52:56 +08:00
parent 91feed7cbb
commit 8c8ab4ff5f
3 changed files with 17 additions and 6 deletions

View File

@ -2,7 +2,7 @@
"profiles": { "profiles": {
"CloudBuilder.Topshelf": { "CloudBuilder.Topshelf": {
"commandName": "Project", "commandName": "Project",
"commandLineArgs": "task:PythonRunTask book_id:B000008" "commandLineArgs": "task:ChineseNameExtractorTask book_id:B000008"
} }
} }
} }

View File

@ -32,6 +32,8 @@ namespace CloudBuilder.Topshelf.Task
IRepository<AiSentenceEntity> repositoryAiSentenceEntity = service.GetRepository<IRepository<AiSentenceEntity>>(); IRepository<AiSentenceEntity> repositoryAiSentenceEntity = service.GetRepository<IRepository<AiSentenceEntity>>();
IRepository<AiChapterPersonEntity> repositoryAiChapterPersonEntity = service.GetRepository<IRepository<AiChapterPersonEntity>>();
string depRoot; string depRoot;
List<NamedEntity> ners; List<NamedEntity> ners;
@ -51,7 +53,7 @@ namespace CloudBuilder.Topshelf.Task
int totalLines = ents.Length; int totalLines = ents.Length;
int processedLines = 0; // 已处理行数计数器 int processedLines = 0; // 已处理行数计数器
AiChapterPersonEntity aiChapterPerson;
foreach (var ent in ents) foreach (var ent in ents)
{ {
processedLines++; processedLines++;
@ -61,10 +63,19 @@ namespace CloudBuilder.Topshelf.Task
if (!string.IsNullOrEmpty(person)) if (!string.IsNullOrEmpty(person))
{ {
aiSentenceEntity = repositoryAiSentenceEntity.Entities.Where(x => x.SentenceId == ent.SentenceId).FirstOrDefault(); string[] ps = person.Split(',');
aiSentenceEntity.PersonName = person; 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); UpdateProgress(processedLines, totalLines);

View File

@ -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); //if (!string.IsNullOrEmpty(arg1) && !ps.Contains(arg1)) ps.Add(arg1);