Exemple #1
0
        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);
        }
Exemple #2
0
        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)
 {
 }
Exemple #7
0
 public RnRCluster(ServiceKeys SK) : base(SK)
 {
 }
Exemple #8
0
 public WCSDialogNodes(ServiceKeys key, string sVersion = null) : base(key)
 {
 }
 public WCSExample(ServiceKeys key, dynamic json) : base(key)
 {
     Load(json);
 }
Exemple #10
0
 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;
 }
Exemple #12
0
 public WCSWorkspace(ServiceKeys key, string sVersion = null) : base(key)
 {
     Init();
 }
Exemple #13
0
 public WCSWorkspace(ServiceKeys key, dynamic json) : base(key)
 {
     Init();
     Load(json);
 }
Exemple #14
0
 public RnRConfig(ServiceKeys SK, string sClusterId, string sName = "") : base(SK)
 {
     solr_cluster_id = sClusterId;
     config_name     = sName;
 }
Exemple #15
0
 public NLC(ServiceKeys key) : base(key)
 {
     classes = new Dictionary <string, double>();
 }
 public WCSIntent(ServiceKeys key, string sVersion = null) : base(key)
 {
     version = sVersion;
     Init();
 }
Exemple #17
0
 public Dialog(ServiceKeys key) : base(key)
 {
     //classes = new Dictionary<string, double>();
 }
Exemple #18
0
 public RnRRanker(ServiceKeys SK) : base(SK)
 {
 }
 public WCSExample(ServiceKeys key, string sVersion = null) : base(key)
 {
     version = sVersion;
 }
 public BaseRESTServices(ServiceKeys SK)
 {
     _SK = SK;
 }
Exemple #21
0
 public WCSDialogNodes(ServiceKeys key, dynamic json) : base(key)
 {
     Load(json);
 }
Exemple #22
0
 public RnR(dynamic json, ServiceKeys SK) : base(SK)
 {
     //Load(json);
 }
Exemple #23
0
 public RnRCluster(ServiceKeys SK, dynamic json) : base(SK)
 {
     Load(json);
 }
Exemple #24
0
 public RnR(ServiceKeys SK) : base(SK)
 {
 }
Exemple #25
0
 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);
 }