- AWS Code Sample demonstrates getting medical entities from text.

/** * COPYRIGHT: * * Copyright 2018-2019, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ import com.amazonaws.auth.AWSCredentials; import com.amazonaws.auth.AWSCredentialsProvider; import com.amazonaws.auth.AWSStaticCredentialsProvider; import com.amazonaws.auth.BasicAWSCredentials; import com.amazonaws.client.builder.AwsClientBuilder; import; import; import; import; public class SampleAPICall { public static void main() { AWSCredentialsProvider credentials = new AWSStaticCredentialsProvider(new BasicAWSCredentials("YOUR AWS ACCESS KEY", "YOUR AWS SECRET")); AWSComprehendMedical client = AWSComprehendMedicalClient.builder() .withCredentials(credentials) .withRegion("YOUR REGION") .build(); DetectEntitiesRequest request = new DetectEntitiesRequest(); request.setText("cerealx 84 mg daily"); DetectEntitiesResult result = client.detectEntities(request); result.getEntities().forEach(System.out::println); } }

Sample Details

Service: comprehend

Last tested: 2019-01-10

Author: AWS

Type: snippet