2018-06-14 15:03:01 +00:00
|
|
|
|
using BotSharp.Core.Abstractions;
|
2018-06-15 17:39:24 +00:00
|
|
|
|
using BotSharp.Core.Agents;
|
2018-06-14 15:03:01 +00:00
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
2018-06-13 22:17:35 +00:00
|
|
|
|
using RestSharp;
|
2018-06-13 12:23:03 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Net.Http;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
|
|
namespace BotSharp.Core.Engines.SpaCy
|
|
|
|
|
|
{
|
2018-06-14 15:03:01 +00:00
|
|
|
|
public class SpaCyProvider : INlpPipeline
|
2018-06-13 12:23:03 +00:00
|
|
|
|
{
|
2018-06-13 22:17:35 +00:00
|
|
|
|
public IConfiguration Configuration { get; set; }
|
2018-06-13 12:23:03 +00:00
|
|
|
|
|
2018-08-07 22:13:55 +00:00
|
|
|
|
public bool ProcessAsync(Agent agent, JObject data)
|
2018-06-13 12:23:03 +00:00
|
|
|
|
{
|
2018-06-13 22:17:35 +00:00
|
|
|
|
var client = new RestClient(Configuration.GetSection("SpaCyProvider:Url").Value);
|
|
|
|
|
|
var request = new RestRequest("load", Method.GET);
|
|
|
|
|
|
var response = client.Execute(request);
|
|
|
|
|
|
|
|
|
|
|
|
return response.IsSuccessful;
|
2018-06-13 12:23:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|