public XmlDocument Classify(ServiceKeys key, string sUrl, string sText) { Tools.HttpReturn ret = Tools.HttpRequest(sUrl + "/classify?text=" + sText, "GET", null, 0, "application/json", key.cred_username, key.cred_password, null); Load(ret._json); //Dictionary<string, double> d = new Dictionary<string, double>(); XmlDocument oXml = new XmlDocument(); XmlNode root = oXml.CreateNode(XmlNodeType.Element, "classes", null); XmlNode NodeC = null, NodeV = null, NodeT = null; NodeT = oXml.CreateNode(XmlNodeType.Attribute, "q", null); NodeT.Value = sText; root.Attributes.SetNamedItem(NodeT); //root.AppendChild(NodeT); var classe = (JArray)ret._json.classes; foreach (dynamic elem in classe) { NodeC = oXml.CreateNode(XmlNodeType.Element, "class", null); NodeV = oXml.CreateNode(XmlNodeType.Attribute, "name", null); NodeV.Value = elem.class_name.ToString(); NodeC.Attributes.SetNamedItem(NodeV); NodeV = oXml.CreateNode(XmlNodeType.Attribute, "value", null); NodeV.Value = elem.confidence.ToString(); NodeC.Attributes.SetNamedItem(NodeV); root.AppendChild(NodeC); //d[elem.class_name.ToString()] = elem.confidence; } oXml.AppendChild(root); return(oXml); }
static private List <ServiceKeys> GetList(string sUrlCloud, string sToken, string sParam) { Tools.HttpReturn ret = Tools.HttpRequest(sUrlCloud + sParam, "GET", null, 0, null, "", "", sToken); List <ServiceKeys> LstServices = new List <ServiceKeys>(); int nbpages = ret._json.total_pages; int nbresult = nbpages > 1 ? 50 : (int)ret._json.total_results.Value; for (int j = 0; j < nbpages; j++) { for (int i = 0; i < nbresult; i++) { ServiceKeys Tmp = new ServiceKeys(ret._json.resources[i], sUrlCloud, sToken); LstServices.Add(Tmp); } if (!String.IsNullOrEmpty((string)ret._json.next_url)) { ret = Tools.HttpRequest(sUrlCloud + ret._json.next_url, "GET", null, 0, null, "", "", sToken); if (nbpages - j == 2) { nbresult = ((int)ret._json.total_results.Value) - nbpages * 50; } } } return(LstServices); }
public List <ServiceKeys> GetListServiceKeys() { if (!String.IsNullOrEmpty(service_keys_url)) { return(ServiceKeys.GetList(this)); } else { return(null); } }
public WCSIntent(ServiceKeys key, dynamic json) : base(key) { Init(); Load(json); }
public WCSCounterExample(ServiceKeys key, string sVersion = null) : base(key) { }
public WCSEntity(ServiceKeys key, string sVersion = null) : base(key) { }
public RnRCluster(ServiceKeys SK) : base(SK) { }
public WCSDialogNodes(ServiceKeys key, string sVersion = null) : base(key) { }
public WCSExample(ServiceKeys key, dynamic json) : base(key) { Load(json); }
public Dialog(ServiceKeys key, dynamic json) : base(key) { //classes = new Dictionary<string, double>(); Load(json); }
public RnRCollection(ServiceKeys SK, string sClusterId, string sName) : base(SK) { solr_cluster_id = sClusterId; collection_name = sName; }
public WCSWorkspace(ServiceKeys key, string sVersion = null) : base(key) { Init(); }
public WCSWorkspace(ServiceKeys key, dynamic json) : base(key) { Init(); Load(json); }
public RnRConfig(ServiceKeys SK, string sClusterId, string sName = "") : base(SK) { solr_cluster_id = sClusterId; config_name = sName; }
public NLC(ServiceKeys key) : base(key) { classes = new Dictionary <string, double>(); }
public WCSIntent(ServiceKeys key, string sVersion = null) : base(key) { version = sVersion; Init(); }
public Dialog(ServiceKeys key) : base(key) { //classes = new Dictionary<string, double>(); }
public RnRRanker(ServiceKeys SK) : base(SK) { }
public WCSExample(ServiceKeys key, string sVersion = null) : base(key) { version = sVersion; }
public BaseRESTServices(ServiceKeys SK) { _SK = SK; }
public WCSDialogNodes(ServiceKeys key, dynamic json) : base(key) { Load(json); }
public RnR(dynamic json, ServiceKeys SK) : base(SK) { //Load(json); }
public RnRCluster(ServiceKeys SK, dynamic json) : base(SK) { Load(json); }
public RnR(ServiceKeys SK) : base(SK) { }
public RnRCluster(ServiceKeys SK, string name, string size) : base(SK) { cluster_name = name; cluster_size = size; }
public WCSEntity(ServiceKeys key, dynamic json) : base(key) { Load(json); }