internal virtual DetectEntitiesResponse DetectEntities(DetectEntitiesRequest request) { var marshaller = new DetectEntitiesRequestMarshaller(); var unmarshaller = DetectEntitiesResponseUnmarshaller.Instance; return(Invoke <DetectEntitiesRequest, DetectEntitiesResponse>(request, marshaller, unmarshaller)); }
private static string DetectEntities(string text, AmazonComprehendClient comprehendClient) { var stringBuilder = new StringBuilder(); var detectEntitiesRequest = new DetectEntitiesRequest() { Text = text, LanguageCode = "en" }; var detectEntitiesResponse = comprehendClient.DetectEntities(detectEntitiesRequest); stringBuilder.AppendLine("Detect Entities:"); stringBuilder.AppendLine("=========================="); foreach (var entity in detectEntitiesResponse.Entities) { stringBuilder.AppendLine(string.Format("Text: {0}, Type: {1}, Score: {2}, BeginOffset: {3}, EndOffset: {4}", entity.Text, entity.Type, entity.Score, entity.BeginOffset, entity.EndOffset)); } Console.WriteLine("DetectEntities => Done\n"); return(stringBuilder.ToString()); }
/// <summary> /// Initiates the asynchronous execution of the DetectEntities operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DetectEntities operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/comprehend-2017-11-27/DetectEntities">REST API Reference for DetectEntities Operation</seealso> public virtual Task <DetectEntitiesResponse> DetectEntitiesAsync(DetectEntitiesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DetectEntitiesRequestMarshaller(); var unmarshaller = DetectEntitiesResponseUnmarshaller.Instance; return(InvokeAsync <DetectEntitiesRequest, DetectEntitiesResponse>(request, marshaller, unmarshaller, cancellationToken)); }
/// <summary> /// Initiates the asynchronous execution of the DetectEntities operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DetectEntities operation on AmazonComprehendMedicalClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDetectEntities /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/comprehendmedical-2018-10-30/DetectEntities">REST API Reference for DetectEntities Operation</seealso> public virtual IAsyncResult BeginDetectEntities(DetectEntitiesRequest request, AsyncCallback callback, object state) { var marshaller = DetectEntitiesRequestMarshaller.Instance; var unmarshaller = DetectEntitiesResponseUnmarshaller.Instance; return(BeginInvoke <DetectEntitiesRequest>(request, marshaller, unmarshaller, callback, state)); }
/// <summary> /// Initiates the asynchronous execution of the DetectEntities operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DetectEntities operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/comprehendmedical-2018-10-30/DetectEntities">REST API Reference for DetectEntities Operation</seealso> public virtual Task <DetectEntitiesResponse> DetectEntitiesAsync(DetectEntitiesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = DetectEntitiesRequestMarshaller.Instance; options.ResponseUnmarshaller = DetectEntitiesResponseUnmarshaller.Instance; return(InvokeAsync <DetectEntitiesResponse>(request, options, cancellationToken)); }
internal virtual DetectEntitiesResponse DetectEntities(DetectEntitiesRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = DetectEntitiesRequestMarshaller.Instance; options.ResponseUnmarshaller = DetectEntitiesResponseUnmarshaller.Instance; return(Invoke <DetectEntitiesResponse>(request, options)); }
/// <summary> /// Initiates the asynchronous execution of the DetectEntities operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DetectEntities operation on AmazonComprehendMedicalClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDetectEntities /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/comprehendmedical-2018-10-30/DetectEntities">REST API Reference for DetectEntities Operation</seealso> public virtual IAsyncResult BeginDetectEntities(DetectEntitiesRequest request, AsyncCallback callback, object state) { var options = new InvokeOptions(); options.RequestMarshaller = DetectEntitiesRequestMarshaller.Instance; options.ResponseUnmarshaller = DetectEntitiesResponseUnmarshaller.Instance; return(BeginInvoke(request, options, callback, state)); }
public async Task <DetectEntitiesResponse> GetEntities(string text, DominantLanguage language) { var request = new DetectEntitiesRequest() { Text = text, LanguageCode = language.LanguageCode }; var response = await _Client.DetectEntitiesAsync(request); return(response); }
public List <Entity> Get(string inputText) { DetectEntitiesRequest detectEntitiesRequest = new DetectEntitiesRequest { Text = inputText, LanguageCode = "en" }; var response = client.DetectEntitiesAsync(detectEntitiesRequest).Result; return(response.Entities.ToList()); }
public DataTable Entities(string Text, string Encoding = "en") { DataTable DT = null; DetectEntitiesRequest request = new DetectEntitiesRequest(); request.LanguageCode = Encoding; request.Text = Text; AmazonComprehendClient client = new AmazonComprehendClient(AccessKeyId, SecretAccessKey, Amazon.RegionEndpoint.USWest2); var RES = client.DetectEntities(request); DT = FromEntity(RES.Entities); DT.TableName = "Entities"; return(DT); }
private async Task <string> GetComprehendData(string transcriptText, string key) { JObject transcriptJSON = JObject.Parse(transcriptText); string test = (string)transcriptJSON["Text"]; AmazonComprehendClient client = new AmazonComprehendClient(); DetectEntitiesRequest entitiesRequest = new DetectEntitiesRequest(); entitiesRequest.LanguageCode = LanguageCode.En; entitiesRequest.Text = test; DetectSentimentRequest sentimentRequest = new DetectSentimentRequest(); sentimentRequest.LanguageCode = LanguageCode.En; sentimentRequest.Text = test; DetectKeyPhrasesRequest keyPhrasesRequest = new DetectKeyPhrasesRequest(); keyPhrasesRequest.LanguageCode = LanguageCode.En; keyPhrasesRequest.Text = test; DetectEntitiesResponse entitiesResponse = await client.DetectEntitiesAsync(entitiesRequest); DetectSentimentResponse setimentResponse = await client.DetectSentimentAsync(sentimentRequest); DetectKeyPhrasesResponse keyPhrasesResponse = await client.DetectKeyPhrasesAsync(keyPhrasesRequest); CreateKeyPhraseCSV(key, keyPhrasesResponse); CreateSetimentJSON(key, setimentResponse); //now send the file to s3 //we need to write two different files, one for setiment and one for Key Phrases. return(string.Empty); }
/// <summary> /// The main method calls the DetectEntitiesAsync method to find any /// entities in the sample code. /// </summary> public static async Task Main() { string text = "It is raining today in Seattle"; var comprehendClient = new AmazonComprehendClient(); Console.WriteLine("Calling DetectEntities\n"); var detectEntitiesRequest = new DetectEntitiesRequest() { Text = text, LanguageCode = "en", }; var detectEntitiesResponse = await comprehendClient.DetectEntitiesAsync(detectEntitiesRequest); foreach (var e in detectEntitiesResponse.Entities) { Console.WriteLine($"Text: {e.Text}, Type: {e.Type}, Score: {e.Score}, BeginOffset: {e.BeginOffset}, EndOffset: {e.EndOffset}"); } Console.WriteLine("Done"); }
public static void Sample() { String text = "It is raining today in Seattle"; var comprehendClient = new AmazonComprehendClient(Amazon.RegionEndpoint.USWest2); // Call DetectEntities API Console.WriteLine("Calling DetectEntities\n"); var detectEntitiesRequest = new DetectEntitiesRequest() { Text = text, LanguageCode = "en" }; var detectEntitiesResponse = comprehendClient.DetectEntities(detectEntitiesRequest); foreach (var e in detectEntitiesResponse.Entities) { Console.WriteLine("Text: {1}, Type: {1}, Score: {2}, BeginOffset: {3}, EndOffset: {4}", e.Text, e.Type, e.Score, e.BeginOffset, e.EndOffset); } Console.WriteLine("Done"); }