internal Response call(string text, string title, string url, string mode, string sentencesNumber, string sentencesPercentage)
        {
            List<Dictionary<string, string>> parameters = new List<Dictionary<string, string>>();

            if (!String.IsNullOrWhiteSpace(text))
                parameters.Add(new Dictionary<string, string> { { "text", text } });

            if (!String.IsNullOrWhiteSpace(title))
                parameters.Add(new Dictionary<string, string> { { "title", title } });

            if (!String.IsNullOrWhiteSpace(url))
                parameters.Add(new Dictionary<string, string> { { "url", url } });

            if (!String.IsNullOrWhiteSpace(mode))
                parameters.Add(new Dictionary<string, string> { { "mode", mode } });

            if (!String.IsNullOrWhiteSpace(sentencesNumber) && sentencesNumber != "0")
                parameters.Add(new Dictionary<string, string> { { "sentences_number", sentencesNumber } });

            if (!String.IsNullOrWhiteSpace(sentencesPercentage) && sentencesPercentage != "0")
                parameters.Add(new Dictionary<string, string> { { "sentences_percentage", sentencesPercentage } });

            Connection connection = new Connection(Configuration.Endpoints["Summarize"], parameters, configuration);
            var response = connection.request();
            populateData(response.ResponseResult);

            return response;
        }
示例#2
0
        internal Response call(string url, string text, string language)
        {
            List <Dictionary <string, string> > parameters = new List <Dictionary <string, string> >();

            if (!String.IsNullOrWhiteSpace(url))
            {
                parameters.Add(new Dictionary <string, string> {
                    { "url", url }
                });
            }

            if (!String.IsNullOrWhiteSpace(text))
            {
                parameters.Add(new Dictionary <string, string> {
                    { "text", text }
                });
            }

            if (!String.IsNullOrWhiteSpace(language))
            {
                parameters.Add(new Dictionary <string, string> {
                    { "language", language }
                });
            }

            Connection connection = new Connection(Configuration.Endpoints["Hashtags"], parameters, configuration);
            var        response   = connection.request();

            populateData(response.ResponseResult);

            return(response);
        }
        internal Response call(string domain, string url, string text)
        {
            List <Dictionary <string, string> > parameters = new List <Dictionary <string, string> >();

            if (!String.IsNullOrWhiteSpace(url))
            {
                parameters.Add(new Dictionary <string, string> {
                    { "url", url }
                });
            }

            if (!String.IsNullOrWhiteSpace(text))
            {
                parameters.Add(new Dictionary <string, string> {
                    { "text", text }
                });
            }

            if (String.IsNullOrEmpty(domain))
            {
                throw new Error("Invalid Domain. Domain can't be blank.");
            }

            var        endpoint   = Configuration.Endpoints["AspectBasedSentiment"].Replace(":domain", domain);
            Connection connection = new Connection(endpoint, parameters, configuration);
            var        response   = connection.request();

            populateData(response.ResponseResult);

            return(response);
        }
示例#4
0
        internal Response call(string url, string text, string[] endpoints)
        {
            List <Dictionary <string, string> > parameters = new List <Dictionary <string, string> >();

            if (!String.IsNullOrWhiteSpace(url))
            {
                parameters.Add(new Dictionary <string, string> {
                    { "url", url }
                });
            }

            if (!String.IsNullOrWhiteSpace(text))
            {
                parameters.Add(new Dictionary <string, string> {
                    { "text", text }
                });
            }

            foreach (string endpoint in endpoints)
            {
                parameters.Add(new Dictionary <string, string> {
                    { "endpoint", endpoint }
                });
            }

            Connection connection = new Connection(Configuration.Endpoints["Combined"], parameters, configuration);
            var        response   = connection.request();

            populateData(response.ResponseResult);

            return(response);
        }
示例#5
0
        internal Response call(string text, string title, string url, string mode, string sentencesNumber, string sentencesPercentage)
        {
            List <Dictionary <string, string> > parameters = new List <Dictionary <string, string> >();

            if (!String.IsNullOrWhiteSpace(text))
            {
                parameters.Add(new Dictionary <string, string> {
                    { "text", text }
                });
            }

            if (!String.IsNullOrWhiteSpace(title))
            {
                parameters.Add(new Dictionary <string, string> {
                    { "title", title }
                });
            }

            if (!String.IsNullOrWhiteSpace(url))
            {
                parameters.Add(new Dictionary <string, string> {
                    { "url", url }
                });
            }

            if (!String.IsNullOrWhiteSpace(mode))
            {
                parameters.Add(new Dictionary <string, string> {
                    { "mode", mode }
                });
            }

            if (!String.IsNullOrWhiteSpace(sentencesNumber) && sentencesNumber != "0")
            {
                parameters.Add(new Dictionary <string, string> {
                    { "sentences_number", sentencesNumber }
                });
            }

            if (!String.IsNullOrWhiteSpace(sentencesPercentage) && sentencesPercentage != "0")
            {
                parameters.Add(new Dictionary <string, string> {
                    { "sentences_percentage", sentencesPercentage }
                });
            }

            Connection connection = new Connection(Configuration.Endpoints["Summarize"], parameters, configuration);
            var        response   = connection.request();

            populateData(response.ResponseResult);

            return(response);
        }
        internal Response call(string url)
        {
            List<Dictionary<string, string>> parameters = new List<Dictionary<string, string>>();

            if (!String.IsNullOrWhiteSpace(url))
                parameters.Add(new Dictionary<string, string> { { "url", url } });

            Connection connection = new Connection(Configuration.Endpoints["ImageTags"], parameters, configuration);
            var response = connection.request();
            populateData(response.ResponseResult);

            return response;
        }
        internal Response call(string phrase, string count)
        {
            List<Dictionary<string, string>> parameters = new List<Dictionary<string, string>>();

            if (!String.IsNullOrWhiteSpace(phrase))
                parameters.Add(new Dictionary<string, string> { { "phrase", phrase } });

            if (!String.IsNullOrWhiteSpace(count) && count != "0")
                parameters.Add(new Dictionary<string, string> { { "count", count } });

            Connection connection = new Connection(Configuration.Endpoints["Related"], parameters, configuration);
            var response = connection.request();
            populateData(response.ResponseResult);

            return response;
        }
        internal Response call(string url, string text, string mode)
        {
            List<Dictionary<string, string>> parameters = new List<Dictionary<string, string>>();

            if (!String.IsNullOrWhiteSpace(url))
                parameters.Add(new Dictionary<string, string> { { "url", url } });

            if (!String.IsNullOrWhiteSpace(text))
                parameters.Add(new Dictionary<string, string> { { "text", text } });

            if (!String.IsNullOrWhiteSpace(mode))
                parameters.Add(new Dictionary<string, string> { { "mode", mode } });

            Connection connection = new Connection(Configuration.Endpoints["Sentiment"], parameters, configuration);
            var response = connection.request();
            populateData(response.ResponseResult);

            return response;
        }
        internal Response call(string url, string html, string bestImage, string keepHtmlFormatting)
        {
            List <Dictionary <string, string> > parameters = new List <Dictionary <string, string> >();

            if (!String.IsNullOrWhiteSpace(url))
            {
                parameters.Add(new Dictionary <string, string> {
                    { "url", url }
                });
            }

            if (!String.IsNullOrWhiteSpace(html))
            {
                parameters.Add(new Dictionary <string, string> {
                    { "html", html }
                });
            }

            if (!String.IsNullOrWhiteSpace(bestImage))
            {
                parameters.Add(new Dictionary <string, string> {
                    { "best_image", bestImage }
                });
            }

            if (!String.IsNullOrWhiteSpace(keepHtmlFormatting))
            {
                parameters.Add(new Dictionary <string, string> {
                    { "keep_html_formatting", keepHtmlFormatting }
                });
            }

            Connection connection = new Connection(Configuration.Endpoints["Extract"], parameters, configuration);
            var        response   = connection.request();

            populateData(response.ResponseResult);

            return(response);
        }
        internal Response call(string taxonomy, string url, string text, string language)
        {
            List <Dictionary <string, string> > parameters = new List <Dictionary <string, string> >();

            if (!String.IsNullOrWhiteSpace(url))
            {
                parameters.Add(new Dictionary <string, string> {
                    { "url", url }
                });
            }

            if (!String.IsNullOrWhiteSpace(text))
            {
                parameters.Add(new Dictionary <string, string> {
                    { "text", text }
                });
            }

            if (!String.IsNullOrWhiteSpace(language))
            {
                parameters.Add(new Dictionary <string, string> {
                    { "language", language }
                });
            }

            if (String.IsNullOrEmpty(taxonomy))
            {
                throw new Error("Invalid taxonomy. Taxonomy can't be blank.");
            }

            var        endpoint   = Configuration.Endpoints["ClassifyByTaxonomy"].Replace(":taxonomy", taxonomy);
            Connection connection = new Connection(endpoint, parameters, configuration);
            var        response   = connection.request();

            populateData(response.ResponseResult);

            return(response);
        }
        internal Response call(string url, string text, string[] classes, string numberOfConcepts)
        {
            List<Dictionary<string, string>> parameters = new List<Dictionary<string, string>>();

            if (!String.IsNullOrWhiteSpace(url))
                parameters.Add(new Dictionary<string, string> { { "url", url } });

            if (!String.IsNullOrWhiteSpace(text))
                parameters.Add(new Dictionary<string, string> { { "text", text } });

            if (!String.IsNullOrWhiteSpace(numberOfConcepts) && numberOfConcepts != "0")
                parameters.Add(new Dictionary<string, string> { { "number_of_concepts", numberOfConcepts } });

            foreach (string klass in classes)
            {
                parameters.Add(new Dictionary<string, string> { { "class", klass } });
            }

            Connection connection = new Connection(Configuration.Endpoints["UnsupervisedClassify"], parameters, configuration);
            var response = connection.request();
            populateData(response.ResponseResult);

            return response;
        }
        internal Response call(string url, string html, string bestImage, string keepHtmlFormatting)
        {
            List<Dictionary<string, string>> parameters = new List<Dictionary<string, string>>();

            if (!String.IsNullOrWhiteSpace(url))
                parameters.Add(new Dictionary<string, string> { { "url", url } });

            if (!String.IsNullOrWhiteSpace(html))
                parameters.Add(new Dictionary<string, string> { { "html", html } });

            if (!String.IsNullOrWhiteSpace(bestImage))
                parameters.Add(new Dictionary<string, string> { { "best_image", bestImage } });

            if (!String.IsNullOrWhiteSpace(keepHtmlFormatting))
                parameters.Add(new Dictionary<string, string> { { "keep_html_formatting", keepHtmlFormatting } });

            Connection connection = new Connection(Configuration.Endpoints["Extract"], parameters, configuration);
            var response = connection.request();
            populateData(response.ResponseResult);

            return response;
        }
        internal Response call(string url, string text, string[] endpoints)
        {
            List<Dictionary<string, string>> parameters = new List<Dictionary<string, string>>();

            if (!String.IsNullOrWhiteSpace(url))
                parameters.Add(new Dictionary<string, string> { { "url", url } });

            if (!String.IsNullOrWhiteSpace(text))
                parameters.Add(new Dictionary<string, string> { { "text", text } });

            foreach (string endpoint in endpoints)
            {
                parameters.Add(new Dictionary<string, string> { { "endpoint", endpoint } });
            }

            Connection connection = new Connection(Configuration.Endpoints["Combined"], parameters, configuration);
            var response = connection.request();
            populateData(response.ResponseResult);

            return response;
        }