using CloudBuilder.Core.DatabaseAccessor.Entity; using CloudBuilder.Core.DependencyInjection.Task; using CloudBuilder.Topshelf.Python; using CloudBuilder.Topshelf.Task.Novel.Process; using CloudBuilder.Topshelf.Utility; namespace CloudBuilder.Topshelf.Task { //task:PythonRunTask param_name:param_value public class PythonRunTask : IScheduleTask { private readonly IApplicationService service; public PythonRunTask(IApplicationService service) { this.service = service; } public void Run(Dictionary bodyDict) { PythonCommand python = new PythonCommand(service); try { Hanlp2 hanlp = new Hanlp2(python); string text = @"金越大师,听说你前两日派人请这位韩道友聚一下,他却开始闭关了,可有此事的。"; //text = "艳美少妇打了韩立"; //text = "徐先生还具体帮助他确定了把画雄鹰、松鼠和麻雀作为主攻目标。"; text = "银发老者神色一肃的向金越禅师问道。"; //text = "鬼灵门门主一边吩咐着,一边冷冷打量着悬浮在身前的画轴,见其并没有任何异样发生,目光闪动几下。"; text = "韩立闻言,眉头不经意的一皱,想了想后,还是摇摇头说道:"; List sentiments = hanlp.GetTokFine(text); sentiments = hanlp.GetTokCoarse(text); string depRoot = hanlp.GetDepRoot(text); List ners = hanlp.GetHanlpNer(text); List> srls = hanlp.GetHanlpSrl(text); List cons = hanlp.GetHanlpCon(text); SpeakerAnalysisHelper speakerFeatureLearner = new SpeakerAnalysisHelper(); speakerFeatureLearner.GetPerson(depRoot, ners, srls, cons); } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { python.Dispose(); } } } }