using CloudBuilder.Core.DatabaseAccessor.Entity; using CloudBuilder.Core.DependencyInjection.Task; using CloudBuilder.Topshelf.Python; 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) { Python39Command python39Command = new Python39Command(service); try { SoVITS soVITS = new SoVITS(python39Command); soVITS.Generate("三更时分,青龙城毫无征兆地被血色浓雾笼罩,雾气带着诡异的幻术气息,城中低阶修士尽数陷入昏睡."); } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { python39Command.Dispose(); } return; 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(); var person = speakerFeatureLearner.GetPerson(hanlp, text); text = "韩立闻言,眉头不经意的一皱,想了想后,还是摇摇头说道:"; } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { python.Dispose(); } } } }