Ejemplo n.º 1
0
 private async Task <bool> SaveOrUpdateKeyPhrases(IFormFile file, KeyPhrasesResult result)
 {
     if (!result.Documents.Any() || !result.Documents[0].KeyPhrases.Any())
     {
         return(false);
     }
     return(await _keyPhraseRepository.AddOrUpdateAsync(new KeyPhrase
     {
         FileName = file.FileName,
         KeyPhrases = result.Documents[0].KeyPhrases.ToCommaSeparatedString()
     }));
 }
Ejemplo n.º 2
0
        private async Task GetKeyPhrasesAsync()
        {
            try
            {
                KeyPhrasesResult keyPhrasesResult = await TextAnalyticsHelper.GetKeyPhrasesAsync(this.CallerTextBox.Text);

                this.KeyPhrases.AddRange(keyPhrasesResult.KeyPhrases.OrderBy(i => i));
            }
            catch (Exception ex)
            {
                await Util.GenericApiCallExceptionHandler(ex, "Error during Text Analytics 'Key Phrases' call.");
            }
        }
Ejemplo n.º 3
0
        static KeyPhrasesResult GetPhrases(string _Azuretoken, KeyPhrasesData _Data)
        {
            String _JsonData = _Data.ToJson();
            var    client    = new RestClient("https://westus2.api.cognitive.microsoft.com/text/analytics/v2.0/keyPhrases");
            var    request   = new RestRequest(Method.POST);

            request.AddHeader("Ocp-Apim-Subscription-Key", _Azuretoken);
            request.AddHeader("Content-Type", "application/json");
            request.AddParameter("undefined", _JsonData, ParameterType.RequestBody);
            IRestResponse    response  = client.Execute(request);
            KeyPhrasesResult _Entities = KeyPhrasesResult.FromJson(response.Content);

            return(_Entities);
        }