61 lines
2.4 KiB
C#
61 lines
2.4 KiB
C#
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<string, string> bodyDict)
|
|
{
|
|
PythonCommand python = new PythonCommand(service);
|
|
try
|
|
{
|
|
Hanlp2 hanlp = new Hanlp2(python);
|
|
|
|
string text = @"金越大师,听说你前两日派人请这位韩道友聚一下,他却开始闭关了,可有此事的。";
|
|
//text = "艳美少妇打了韩立";
|
|
//text = "徐先生还具体帮助他确定了把画雄鹰、松鼠和麻雀作为主攻目标。";
|
|
|
|
text = "银发老者神色一肃的向金越禅师问道。";
|
|
//text = "鬼灵门门主一边吩咐着,一边冷冷打量着悬浮在身前的画轴,见其并没有任何异样发生,目光闪动几下。";
|
|
text = "这是一个小城,说是小城其实只是一个大点的镇子,名字也叫青牛镇,只有那些住在附近山沟里、没啥见识的土人,才“青牛城”“青牛城”的叫个不停。这是干了十几年门丁的张二心里话。";
|
|
//List<string> sentiments = hanlp.GetTokFine(text);
|
|
|
|
//sentiments = hanlp.GetTokCoarse(text);
|
|
|
|
//string depRoot = hanlp.GetDepRoot(text);
|
|
|
|
//List<NamedEntity> ners = hanlp.GetHanlpNer(text);
|
|
|
|
//List<List<MeaningRepresentationParsingEntity>> srls = hanlp.GetHanlpSrl(text);
|
|
|
|
//List<HanlpConstituencyNode> 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();
|
|
}
|
|
}
|
|
}
|
|
}
|