public virtual TokensTextAnalysisResponse GetTokensTextAnalysis(TextAnalysisRequest request) { request.AnalyzerIds = new[] { AnalyzerIds[AnalyzerType.Token] }; var response = RepositoryClient.SendJsonPost(ApiKeys.LinguisticAnalysis, $"{ApiKeys.LinguisticAnalysisEndpoint}{textAnalysisUrl}", JsonConvert.SerializeObject(request)); return(JsonConvert.DeserializeObject <List <TokensTextAnalysisResponse> >(response).First()); }
public virtual TokensTextAnalysisResponse GetTokensTextAnalysis(TextAnalysisRequest request) { return(PolicyService.ExecuteRetryAndCapture400Errors( "LinguisticService.GetTokensTextAnalysis", ApiKeys.LinguisticAnalysisRetryInSeconds, () => { var result = LinguisticRepository.GetTokensTextAnalysis(request); return result; }, null)); }
public virtual TokensTextAnalysisResponse GetTokensTextAnalysis(TextAnalysisRequest request) { try { var result = LinguisticRepository.GetTokensTextAnalysis(request); return(result); } catch (Exception ex) { Logger.Error("LinguisticService.GetTokensTextAnalysis failed", this, ex); } return(null); }
public virtual TokensTextAnalysisResponse GetTokensTextAnalysis(TextAnalysisRequest request) { try { var result = Task.Run(async() => await LinguisticRepository.GetTokensTextAnalysisAsync(request)).Result; return(result); } catch (Exception ex) { Logger.Error("SentimentService.GetSentiment failed", this, ex); } return(null); }
public ActionResult Linguistic(string text) { TextAnalysisRequest tar = new TextAnalysisRequest() { Language = "en", Text = text }; var result = LinguisticService.GetConstituencyTreeTextAnalysis(tar); var value = new LinguisticAnalysisResult() { FieldName = "Sample Text", FieldValue = text, POSTagsAnalysis = null, ConstituencyTreeAnalysis = result, TokensAnalysis = null }; return(View("Linguistic", value)); }
private void SetLinguisticInfo(Item item) { var linguisticService = DependencyResolver.Current.GetService <ILinguisticService>(); if (linguisticService == null) { return; } List <LinguisticAnalysisResult> fieldResults = new List <LinguisticAnalysisResult>(); IEnumerable <Field> fields = GetTextualFields(item); foreach (Field f in fields) { string value = RemoveHtmlMarkup(f.Value); TextAnalysisRequest tar = new TextAnalysisRequest() { Language = item.Language.Name, Text = value }; var result1 = linguisticService.GetPOSTagsTextAnalysis(tar) ?? new POSTagsTextAnalysisResponse(); var result2 = linguisticService.GetConstituencyTreeTextAnalysis(tar) ?? new ConstituencyTreeTextAnalysisResponse(); fieldResults.Add(new LinguisticAnalysisResult() { FieldName = f.DisplayName, FieldValue = value, POSTagsAnalysis = result1, ConstituencyTreeAnalysis = result2, TokensAnalysis = null }); } Linguistics = fieldResults; }
/// <summary> /// kind: POSTags /// specification: PennTreebank3 /// implementation: cmm /// </summary> public async Task <POSTagsTextAnalysisResponse> GetPOSTagsTextAnalysisAsync(TextAnalysisRequest request) { request.AnalyzerIds = new string[] { "4fa79af1-f22c-408d-98bb-b7d7aeef7f04" }; return(JsonConvert.DeserializeObject <List <POSTagsTextAnalysisResponse> >(await this.SendPostAsync(textAnalysisUrl, JsonConvert.SerializeObject((object)request))).First()); }
/// <summary> /// kind: ConstituencyTree /// specification: PennTreebank3 /// implementation: SplitMerge /// </summary> public virtual async Task <ConstituencyTreeTextAnalysisResponse> GetConstituencyTreeTextAnalysisAsync(TextAnalysisRequest request) { request.AnalyzerIds = new [] { AnalyzerIds[AnalyzerType.ConstituencyTree] }; var response = await RepositoryClient.SendJsonPostAsync(ApiKeys.LinguisticAnalysis, $"{ApiKeys.LinguisticAnalysisEndpoint}{textAnalysisUrl}", JsonConvert.SerializeObject(request)); return(JsonConvert.DeserializeObject <List <ConstituencyTreeTextAnalysisResponse> >(response).First()); }
/// <summary> /// /// </summary> /// <exception cref="ProWritingAid.SDK.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="requestp"></param> /// <returns>Task of AsyncResponseTextAnalysisResponse</returns> public async System.Threading.Tasks.Task <AsyncResponseTextAnalysisResponse> PostAsync(TextAnalysisRequest requestp) { ApiResponse <AsyncResponseTextAnalysisResponse> localVarResponse = await PostAsyncWithHttpInfo(requestp); return(localVarResponse.Data); }
public TokensTextAnalysisResponse GetTokensTextAnalysis(TextAnalysisRequest request) { return(Task.Run(async() => await GetTokensTextAnalysisAsync(request)).Result); }
/// <summary> /// kind: ConstituencyTree /// specification: PennTreebank3 /// implementation: SplitMerge /// </summary> public virtual async Task<ConstituencyTreeTextAnalysisResponse> GetConstituencyTreeTextAnalysisAsync(TextAnalysisRequest request) { request.AnalyzerIds = new string[] { "22a6b758-420f-4745-8a3c-46835a67c0d2" }; var response = await SendPostAsync(textAnalysisUrl, JsonConvert.SerializeObject(request)); return JsonConvert.DeserializeObject<List<ConstituencyTreeTextAnalysisResponse>>(response).First(); }
/// <summary> /// kind: POSTags /// specification: PennTreebank3 /// implementation: cmm /// </summary> public virtual async Task<POSTagsTextAnalysisResponse> GetPOSTagsTextAnalysisAsync(TextAnalysisRequest request) { request.AnalyzerIds = new string[] { "4fa79af1-f22c-408d-98bb-b7d7aeef7f04" }; var response = await SendPostAsync(textAnalysisUrl, JsonConvert.SerializeObject(request)); return JsonConvert.DeserializeObject<List<POSTagsTextAnalysisResponse>>(response).First(); }
public virtual POSTagsTextAnalysisResponse GetPOSTagsTextAnalysis(TextAnalysisRequest request) { return Task.Run(async () => await GetPOSTagsTextAnalysisAsync(request)).Result; }
/// <summary> /// /// </summary> /// <exception cref="ProWritingAid.SDK.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="requestp"></param> /// <returns>Task of ApiResponse (AsyncResponseTextAnalysisResponse)</returns> public async System.Threading.Tasks.Task <ApiResponse <AsyncResponseTextAnalysisResponse> > PostAsyncWithHttpInfo(TextAnalysisRequest requestp) { // verify the required parameter 'requestp' is set if (requestp == null) { throw new ApiException(400, "Missing required parameter 'requestp' when calling TextApi->Post"); } var localVarPath = "/api/async/text"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new Dictionary <String, String>(); var localVarHeaderParams = new Dictionary <String, String>(Configuration.DefaultHeader); var localVarFormParams = new Dictionary <String, String>(); var localVarFileParams = new Dictionary <String, FileParameter>(); Object localVarPostBody = null; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { "application/json", "text/json", "application/x-www-form-urlencoded" }; String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json", "text/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } if (requestp != null && requestp.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(requestp); // http body (model) parameter } else { localVarPostBody = requestp; // byte array } // authentication (licenseCode) required if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("licenseCode"))) { localVarHeaderParams["licenseCode"] = Configuration.GetApiKeyWithPrefix("licenseCode"); } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("Post", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <AsyncResponseTextAnalysisResponse>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (AsyncResponseTextAnalysisResponse)Configuration.ApiClient.Deserialize(localVarResponse, typeof(AsyncResponseTextAnalysisResponse)))); }
public ConstituencyTreeTextAnalysisResponse GetConstituencyTreeTextAnalysis(TextAnalysisRequest request) { return(Task.Run(async() => await GetConstituencyTreeTextAnalysisAsync(request)).Result); }
/// <summary> /// kind: ConstituencyTree /// specification: PennTreebank3 /// implementation: SplitMerge /// </summary> public async Task <ConstituencyTreeTextAnalysisResponse> GetConstituencyTreeTextAnalysisAsync(TextAnalysisRequest request) { request.AnalyzerIds = new string[] { "22a6b758-420f-4745-8a3c-46835a67c0d2" }; return(JsonConvert.DeserializeObject <List <ConstituencyTreeTextAnalysisResponse> >(await this.SendPostAsync(textAnalysisUrl, JsonConvert.SerializeObject((object)request))).First()); }
/// <summary> /// specification: PennTreebank3 /// implementation: regexes /// </summary> public virtual async Task<TokensTextAnalysisResponse> GetTokensTextAnalysisAsync(TextAnalysisRequest request) { request.AnalyzerIds = new string[] { "08ea174b-bfdb-4e64-987e-602f85da7f72" }; var response = await SendPostAsync(textAnalysisUrl, JsonConvert.SerializeObject(request)); return JsonConvert.DeserializeObject<List<TokensTextAnalysisResponse>>(response).First(); }
/// <summary> /// specification: PennTreebank3 /// implementation: regexes /// </summary> public async Task <TokensTextAnalysisResponse> GetTokensTextAnalysisAsync(TextAnalysisRequest request) { request.AnalyzerIds = new string[] { "08ea174b-bfdb-4e64-987e-602f85da7f72" }; return(JsonConvert.DeserializeObject <List <TokensTextAnalysisResponse> >(await this.SendPostAsync(textAnalysisUrl, JsonConvert.SerializeObject((object)request))).First()); }
/// <summary> /// /// </summary> /// <exception cref="ProWritingAid.SDK.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="requestp"></param> /// <returns>AsyncResponseTextAnalysisResponse</returns> public AsyncResponseTextAnalysisResponse Post(TextAnalysisRequest requestp) { ApiResponse <AsyncResponseTextAnalysisResponse> localVarResponse = PostWithHttpInfo(requestp); return(localVarResponse.Data); }