감정분석
    • PDF

    감정분석

    • PDF

    Article Summary

    감정분석 API

    텍스트 데이터를 분석해서 해당 단어/문장/문구 내용의 감정을 분석하는 서비스로 그 결과를 반환하는 HTTP 기반의 REST API입니다.

    요청

    POST https://naveropenapi.apigw-pub.fin-ntruss.com/sentiment-analysis/v1/analyze
    

    요청 헤더

    헤더명설명
    X-NCP-APIGW-API-KEY-ID앱 등록 시 발급받은 Client ID
    X-NCP-APIGW-API-KEY-ID:{Client ID}
    X-NCP-APIGW-API-KEY앱 등록 시 발급 받은 Client Secret
    X-NCP-APIGW-API-KEY:{Client Secret}
    Content-Type바이너리 전송 형식
    Content-Type: application/json

    요청 바디

    필드명필수 여부타입설명
    contentYesString감정분석 Text

    응답

    응답 바디

    필드 이름데이터 타입설명
    documentObject전체 문장 관련 object
    document.sentimentString전체 문장에 대한 감정
    document.confidenceObject전체 문장에 대한 감정 confidence
    document.confidence.neutralFloat중립 confidence (%)
    document.confidence.positiveFloat긍정 confidence (%)
    document.confidence.negativeFloat부정 confidence (%)
    sentencesList of Object분류 문장 관련 list object
    sentences.contentString분류 문장
    sentences.offsetIntdocument.content 에서 문장 시작 위치
    sentences.lengthInt분류 문장 글자 수
    sentences.sentimentString분류 문장 감정
    sentences.confidenceObject분류 문장에 대한 감정 confidence
    sentences.confidence.neutralFloat중립 confidence (%)
    sentences.confidence.positiveFloat긍정 confidence (%)
    sentences.confidence.negativeFloat부정 confidence (%)
    sentences.highlightsList of Objectsentences.content 에서 감정분석 구간
    sentences.highlights.offsetInt주요 감정 구간 시작 위치
    sentences.highlights.lengthInt주요 감정 구간 글자 수
    sentences.negativeSentiment.sentimentString부정 감정일 경우, 세부 감정
    sentences.negativeSentiment.confidenceFloat부정 감정일 경우, 세부 감정에 대한 confidence

    예시

    요청 예시

    {
      "content": "싸늘하다. 가슴에 비수가 날아와 꽂힌다."
    }
    

    응답 예시

    {
        "document": {
            "sentiment": "negative",
            "confidence": {
                "neutral": 0.14525136640572725,
                "positive": 0.00186876227013191,
                "negative": 0.8528798713241407
            }
        },
        "sentences": [
            {
                "content": "싸늘하다.",
                "offset": 0,
                "length": 5,
                "sentiment": "negative",
                "confidence": {
                    "negative": 0.9961358904838562,
                    "positive": 0.0036366574931889772,
                    "neutral": 0.0002274021098855883
                },
                "highlights": [
                    {
                        "offset": 0,
                        "length": 4
                    }
                ]
            },
            {
                "content": " 가슴에 비수가 날아와 꽂힌다.",
                "offset": 5,
                "length": 17,
                "sentiment": "negative",
                "confidence": {
                    "negative": 0.927976131439209,
                    "positive": 0.07131962478160858,
                    "neutral": 0.0007042606011964381
                },
                "highlights": [
                    {
                        "offset": 1,
                        "length": 15
                    }
                ]
            }
        ]
    }
    
    

    오류

    오류 예시

    {
      "status": 400,
      "error": {
        "errorCode": "E001",
        "message": "Unsupported empty or blank text"
      }
    }
    

    오류 코드

    HttpStatusCodeErrorCodeErrorMessageDescription
    400E001Unsupported empty or blank text빈 문자열 or blank 문자
    400E002Utf-8 encoding errorUTF-8 인코딩 에러
    400E003Text quota Exceeded문장이 기준치보다 초과 했을 경우
    400E103Invalid request bodyrequest body의 json format이 유효하지 않거나 필수 파라미터가 누락된 경우
    400E415Unsupported media typecontent-type 에러
    400E900Unexpected error예외처리가 안된 경우(Bad Request)
    500E501Endpoint connection failed엔드포인트 연결 실패
    500E900Unexpected error예외처리가 안된 오류(Server Error)

    이 문서가 도움이 되었습니까?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.