/// <summary>
        /// Gets the key phrases asynchronous.
        /// </summary>
        /// <param name="request">The request.</param>
        /// <returns></returns>

        public async Task <KeyPhrasesResponse> GetKeyPhrasesAsync(KeyPhrasesRequest request)
        {
            request.Validate();

            var url = this.Url;

            var json         = JsonConvert.SerializeObject(request);
            var responseJson = await this.SendPostAsync(url, json);

            var response = JsonConvert.DeserializeObject <KeyPhrasesResponse>(responseJson);

            return(response);
        }
Beispiel #2
0
        public static async Task <List <string> > ExtractPhraseAsync(string sentence)
        {
            var request = new KeyPhrasesRequest();

            request.Documents.Add(new KeyPhraseDocument()
            {
                Id       = Guid.NewGuid().ToString(),
                Text     = sentence,
                Language = "en"
            });

            var result = await _client.GetKeyPhrasesAsync(request);

            return(result.Documents.First().KeyPhrases);
        }