public ActionResult WebLanguageModelCalculateConditionalProbability(string phrase, string word) { ConditionalProbabilityRequest c = new ConditionalProbabilityRequest() { Queries = new List <ConditionalProbabilityQuery>() { new ConditionalProbabilityQuery() { Words = phrase, Word = word } } }; var result = WebLanguageModelService.CalculateConditionalProbability(WebLMModelOptions.title, c); return(View("WebLanguageModel", new WebLanguageModelResult() { ConditionalProbability = result })); }
/// <param name="model">Which model to use, supported value: title/anchor/query/body</param> /// <param name="request">Request object that specifies the queries</param> /// <param name="order">The order of N-gram. If not specified, use default value 5 .Supported value: 1, 2, 3, 4, 5.</param> /// <returns></returns> public virtual async Task <ConditionalProbabilityResponse> CalculateConditionalProbabilityAsync(WebLMModelOptions model, ConditionalProbabilityRequest request, int order = 5) { var response = await RepositoryClient.SendJsonPostAsync(ApiKeys.WebLM, $"{ApiKeys.WebLMEndpoint}calculateConditionalProbability?model={model}&order={order}", JsonConvert.SerializeObject(request)); return(JsonConvert.DeserializeObject <ConditionalProbabilityResponse>(response)); }
public virtual ConditionalProbabilityResponse CalculateConditionalProbability(WebLMModelOptions model, ConditionalProbabilityRequest request, int order = 5) { return(PolicyService.ExecuteRetryAndCapture400Errors( "WebLanguageModelService.CalculateConditionalProbability", ApiKeys.WebLMRetryInSeconds, () => { var result = WebLanguageModelRepository.CalculateConditionalProbability(model, request, order); return result; }, null)); }
public virtual ConditionalProbabilityResponse CalculateConditionalProbability(WebLMModelOptions model, ConditionalProbabilityRequest request, int order = 5) { try { var result = Task.Run(async() => await WebLanguageModelRepository.CalculateConditionalProbabilityAsync(model, request, order)).Result; return(result); } catch (Exception ex) { Logger.Error("WebLanguageModelService.CalculateConditionalProbability failed", this, ex); } return(null); }