

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# 사용자 지정 개체 인식을 위한 실시간 분석(API)
<a name="detecting-cer-real-time-api"></a>

Amazon Comprehend API를 사용하여 사용자 지정 모델로 실시간 분석을 실행할 수 있습니다. 먼저, 실시간 분석을 실행할 엔드포인트를 생성합니다. 엔드포인트를 생성한 후 실시간 분석을 실행합니다.

프로비저닝 엔드포인트 처리량 및 관련 비용에 대한 자세한 내용은 [Amazon Comprehend 엔드포인트 사용](using-endpoints.md)을 참조하세요.

**Topics**
+ [사용자 지정 개체 감지를 위한 엔드포인트 생성](#detecting-cer-real-time-create-endpoint-api)
+ [실시간 사용자 지정 개체 감지 실행](#detecting-cer-real-time-run)

## 사용자 지정 개체 감지를 위한 엔드포인트 생성
<a name="detecting-cer-real-time-create-endpoint-api"></a>

엔드포인트과 관련한 비용에 대한 자세한 내용은 [Amazon Comprehend 엔드포인트 사용](using-endpoints.md)을 참조하세요.

### 를 사용하여 엔드포인트 생성 AWS CLI
<a name="detecting-cer-real-time-create-endpoint-examples"></a>

를 사용하여 엔드포인트를 생성하려면 `create-endpoint` 명령을 AWS CLI사용합니다.

```
$ aws comprehend create-endpoint \
> --desired-inference-units number of inference units \
> --endpoint-name endpoint name \
> --model-arn arn:aws:comprehend:region:account-id:model/example \
> --tags Key=Key,Value=Value
```

명령이 성공하면 Amazon Comprehend는 엔드포인트 ARN으로 응답합니다.

```
{
   "EndpointArn": "Arn"
}
```

이 명령, 파라미터 인수, 출력에 대한 자세한 내용은  AWS CLI  명령 참조의 [https://docs.aws.amazon.com/cli/latest/reference/comprehend/create-endpoint.html](https://docs.aws.amazon.com/cli/latest/reference/comprehend/create-endpoint.html)을 참조하세요.

## 실시간 사용자 지정 개체 감지 실행
<a name="detecting-cer-real-time-run"></a>

사용자 지정 개체 인식기 모델에 대한 엔드포인트를 생성한 후 해당 엔드포인트를 사용하여 [DetectEntities](https://docs.aws.amazon.com/comprehend/latest/APIReference/API_DetectEntities.html) API 작업을 실행합니다. `text` 또는 `bytes` 파라미터를 사용하여 텍스트 입력을 제공할 수 있습니다. `bytes` 파라미터를 사용하여 다른 입력 유형을 입력합니다.

이미지 파일 및 PDF 파일의 경우 `DocumentReaderConfig` 파라미터를 사용하여 기본 텍스트 추출 작업을 재정의할 수 있습니다. 자세한 내용은 [텍스트 추출 옵션을 설정하는](idp-set-textract-options.md)을 참조하세요.

### 를 사용하여 텍스트에서 개체 감지 AWS CLI
<a name="detecting-cer-real-time-run-cli1"></a>

텍스트의 사용자 지정 개체를 감지하려면 `text` 파라미터에서 입력 텍스트를 사용하여 `detect-entities` 명령을 실행합니다.

**Example : CLI를 사용하여 입력 텍스트의 개체를 감지합니다**  

```
$ aws comprehend detect-entities \
> --endpoint-arn arn \
> --language-code en \
> --text  "Andy Jassy is the CEO of Amazon."
```
명령이 성공하면 Amazon Comprehend는 분석으로 응답합니다. Amazon Comprehend가 감지한 각 개체에 대해 개체 유형, 텍스트, 위치 및 신뢰도 점수를 제공합니다.

### 를 사용하여 반정형 문서에서 개체 감지 AWS CLI
<a name="detecting-cer-real-time-run-cli2"></a>

PDF, Word, 또는 이미지 파일의 사용자 지정 개체를 감지하려면 `bytes` 파라미터에서 입력 텍스트를 사용하여 `detect-entities` 명령을 실행합니다.

**Example : CLI를 사용하여 이미지 파일의 개체를 감지합니다.**  
이 예제에서는 이미지 바이트를 base64로 인코딩하는 `fileb` 옵션을 사용하여 이미지 파일을 전달하는 방법을 보여줍니다. 자세한 내용은 AWS Command Line Interface 사용 설명서의 [이진 대용량 객체](https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters-types.html#parameter-type-blob)를 참조하세요.  
이 예제에서는 텍스트 추출 옵션을 설정하기 위해 `config.json`이라는 이름의 JSON 파일도 전달합니다.  

```
$ aws comprehend detect-entities \
> --endpoint-arn arn \
> --language-code en \
> --bytes fileb://image1.jpg   \
> --document-reader-config file://config.json
```
**config.json** 파일에는 다음 내용이 포함되어 있습니다.  

```
 {
    "DocumentReadMode": "FORCE_DOCUMENT_READ_ACTION",
    "DocumentReadAction": "TEXTRACT_DETECT_DOCUMENT_TEXT"    
 }
```

명령 구문에 대한 자세한 내용은 *Amazon Comprehend API 참조*의 [DetectEntities를](https://docs.aws.amazon.com/comprehend/latest/APIReference/API_DetectEntities.html) 참조하세요.