/// <summary>
        /// kind: POSTags
        /// specification: PennTreebank3
        /// implementation: cmm
        /// </summary>
        public virtual async Task <POSTagsTextAnalysisResponse> GetPOSTagsTextAnalysisAsync(TextAnalysisRequest request)
        {
            request.AnalyzerIds = new [] { AnalyzerIds[AnalyzerType.PartsOfSpeech] };
            var response = await RepositoryClient.SendJsonPostAsync(ApiKeys.LinguisticAnalysis, $"{ApiKeys.LinguisticAnalysisEndpoint}{textAnalysisUrl}", JsonConvert.SerializeObject(request));

            return(JsonConvert.DeserializeObject <List <POSTagsTextAnalysisResponse> >(response).First());
        }
        public virtual async Task <Emotion[]> RecognizeAsync(string imageUrl, Rectangle[] faceRectangles)
        {
            var qs = GetRectangleQS(faceRectangles);

            var response = await RepositoryClient.SendJsonPostAsync(ApiKeys.Emotion, $"{ApiKeys.EmotionEndpoint}recognize{qs}", JsonConvert.SerializeObject(new Asset {
                Url = imageUrl
            }));

            return(JsonConvert.DeserializeObject <Emotion[]>(response));
        }
Ejemplo n.º 3
0
        public virtual async Task <CreateProfileResponse> CreateProfileAsync(string locale)
        {
            var response = await RepositoryClient.SendJsonPostAsync(ApiKeys.SpeakerRecognition, $"{ApiKeys.SpeakerRecognition}identificationProfiles", JsonConvert.SerializeObject(new LocaleSetting {
                Locale = locale
            }));

            return(JsonConvert.DeserializeObject <CreateProfileResponse>(response));
        }
Ejemplo n.º 4
0
        public virtual async Task <AnalysisResult> AnalyzeImageAsync(string imageUrl, IEnumerable <VisualFeature> visualFeatures = null, IEnumerable <string> details = null)
        {
            var qs       = GetAnalyzeQuerystring(visualFeatures, details);
            var response = await RepositoryClient.SendJsonPostAsync(ApiKeys.ComputerVision, $"{ApiKeys.ComputerVisionEndpoint}analyze{qs}", GetImageUrlJson(imageUrl));

            return(JsonConvert.DeserializeObject <AnalysisResult>(response));
        }
        /// <param name="model">Which model to use, supported value: title/anchor/query/body</param>
        /// <param name="text">The line of text to break into words. If spaces are present, they will be interpreted as hard breaks and maintained, except for leading or trailing spaces, which will be trimmed.</param>
        /// <param name="order">The order of N-gram. If not specified, use default value 5 .Supported value: 1, 2, 3, 4, 5.</param>
        /// <param name="maxNumOfCandidatesReturned">Max number of candidates would be returned.If not specified, use default value 5.</param>
        /// <returns></returns>
        public virtual async Task <BreakIntoWordsResponse> BreakIntoWordsAsync(WebLMModelOptions model, string text, int order = 5, int maxNumOfCandidatesReturned = 5)
        {
            var response = await RepositoryClient.SendJsonPostAsync(ApiKeys.WebLM, $"{ApiKeys.WebLMEndpoint}breakIntoWords?model={model}&text={text}&order={order}&maxNumOfCandidatesReturned={maxNumOfCandidatesReturned}", "");

            return(JsonConvert.DeserializeObject <BreakIntoWordsResponse>(response));
        }
        public virtual async Task <LanguageResponse> GetLanguagesAsync(LanguageRequest request)
        {
            var response = await RepositoryClient.SendJsonPostAsync(ApiKeys.TextAnalytics, GetLanguageUrl(request), JsonConvert.SerializeObject(request));

            return(JsonConvert.DeserializeObject <LanguageResponse>(response));
        }
        public virtual async Task <KnowledgeBaseExtractionDetails> CreateKnowledgeBaseAsync(KnowledgeBaseDetails request)
        {
            var response = await RepositoryClient.SendJsonPostAsync(ApiKeys.QnA, $"{ApiKeys.QnAEndpoint}create", JsonConvert.SerializeObject(request));

            return(JsonConvert.DeserializeObject <KnowledgeBaseExtractionDetails>(response));
        }
Ejemplo n.º 8
0
        public virtual async Task <EvaluateResponse> EvaluateAsync(string imageUrl)
        {
            var response = await RepositoryClient.SendJsonPostAsync(ApiKeys.ContentModerator, $"{ApiKeys.ContentModeratorEndpoint}{moderatorUrl}/ProcessImage/Evaluate", GetImageUrlData(imageUrl));

            return(JsonConvert.DeserializeObject <EvaluateResponse>(response));
        }
Ejemplo n.º 9
0
        public virtual async Task <GraphSearchResponse> GraphSearchAsync(GraphSearchRequest request)
        {
            var response = await RepositoryClient.SendJsonPostAsync(ApiKeys.Academic, $"{ApiKeys.AcademicEndpoint}{graphUrl}?mode=json", JsonConvert.SerializeObject(request));

            return(JsonConvert.DeserializeObject <GraphSearchResponse>(response));
        }
Ejemplo n.º 10
0
        public virtual async Task <Face[]> DetectAsync(string imageUrl, bool returnFaceId = true, bool returnFaceLandmarks = false, IEnumerable <FaceAttributeType> returnFaceAttributes = null)
        {
            var qs = GetDetectQS(returnFaceId, returnFaceLandmarks, returnFaceAttributes);

            var response = await RepositoryClient.SendJsonPostAsync(ApiKeys.Face, $"{ApiKeys.FaceEndpoint}detect{qs}", JsonConvert.SerializeObject(new Image {
                Url = imageUrl
            }));

            return(JsonConvert.DeserializeObject <Face[]>(response));
        }
        public virtual async Task <CreateBusinessRuleResponse> CreateBusinessRuleAsync(string modelId, CreateBusinessRuleRequest request)
        {
            var response = await RepositoryClient.SendJsonPostAsync(ApiKeys.Recommendations, $"{ApiKeys.RecommendationsEndpoint}{modelsUrl}{modelId}/rules", JsonConvert.SerializeObject(request));

            return(JsonConvert.DeserializeObject <CreateBusinessRuleResponse>(response));
        }