Example #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);
        }
Example #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);
     }
 }
Example #4
0
 public WCSIntent(ServiceKeys key, dynamic json) : base(key)
 {
     Init();
     Load(json);
 }
 public WCSCounterExample(ServiceKeys key, string sVersion = null) : base(key)
 {
 }
Example #6
0
 public WCSEntity(ServiceKeys key, string sVersion = null) : base(key)
 {
 }
Example #7
0
 public RnRCluster(ServiceKeys SK) : base(SK)
 {
 }
Example #8
0
 public WCSDialogNodes(ServiceKeys key, string sVersion = null) : base(key)
 {
 }
Example #9
0
 public WCSExample(ServiceKeys key, dynamic json) : base(key)
 {
     Load(json);
 }
Example #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;
 }
Example #12
0
 public WCSWorkspace(ServiceKeys key, string sVersion = null) : base(key)
 {
     Init();
 }
Example #13
0
 public WCSWorkspace(ServiceKeys key, dynamic json) : base(key)
 {
     Init();
     Load(json);
 }
Example #14
0
 public RnRConfig(ServiceKeys SK, string sClusterId, string sName = "") : base(SK)
 {
     solr_cluster_id = sClusterId;
     config_name     = sName;
 }
Example #15
0
 public NLC(ServiceKeys key) : base(key)
 {
     classes = new Dictionary <string, double>();
 }
Example #16
0
 public WCSIntent(ServiceKeys key, string sVersion = null) : base(key)
 {
     version = sVersion;
     Init();
 }
Example #17
0
 public Dialog(ServiceKeys key) : base(key)
 {
     //classes = new Dictionary<string, double>();
 }
Example #18
0
 public RnRRanker(ServiceKeys SK) : base(SK)
 {
 }
Example #19
0
 public WCSExample(ServiceKeys key, string sVersion = null) : base(key)
 {
     version = sVersion;
 }
 public BaseRESTServices(ServiceKeys SK)
 {
     _SK = SK;
 }
Example #21
0
 public WCSDialogNodes(ServiceKeys key, dynamic json) : base(key)
 {
     Load(json);
 }
Example #22
0
 public RnR(dynamic json, ServiceKeys SK) : base(SK)
 {
     //Load(json);
 }
Example #23
0
 public RnRCluster(ServiceKeys SK, dynamic json) : base(SK)
 {
     Load(json);
 }
Example #24
0
 public RnR(ServiceKeys SK) : base(SK)
 {
 }
Example #25
0
 public RnRCluster(ServiceKeys SK, string name, string size) : base(SK)
 {
     cluster_name = name;
     cluster_size = size;
 }
Example #26
0
 public WCSEntity(ServiceKeys key, dynamic json) : base(key)
 {
     Load(json);
 }