Papago Document Translation Overview
    • PDF

    Papago Document Translation Overview

    • PDF

    Article Summary

    Overview

    • API to translate text written in the source language into a target language
    • This is an asynchronous API consisting of 3 APIs, namely translate, status and download
    • Supported language pairs: Korean↔English, Korean↔Japanese, Korean↔Chinese (simplified)
    • For a single document, file size and number of characters are limited to 100 MB and 300,000, respectively
    • Supported file formats: MS Office (docx, pptx, xlsx), PDF, HWP
      • As for HWP, only HWP 5.0 and higher (Hancom Office 2002 and later) are supported

    Cautions in use

    • Texts on images are not translated.
    • Some of the styles applied to text may not match or be missing.
    • Some of the links or actions applied to text may not work or be missing.
    • Password-protected files are not supported.
    • Read-only files are not supported.
    • HWP
      • Only HWP 5.0 and higher versions, namely those used for Hancom Office 2002 and later, are supported.
      • Deployment files are not supported.
      • HWP files not created on Hancom Office are not supported. (e.g. files with only the extension changed)
      • If translated sentences are long, there may be text overlap. This can be resolved by enlarging the text area.
    • PDF
      • Layout, paragraphing, design template, custom font, image size, etc. of the PDF file may affect the quality. It is better not to include to many visual elements in a document file.
      • For the optimal result, it is recommended to use a basic PDF file. If a scanned document is translated, the scan quality may affect the translation. Also, the original and scanned documents must have the same direction.
      • The file size may increase after translation.
      • Document layout and styles are maintained better in docx and pptx files than in PDF files. For a better result, it is recommended to use file formats before conversion to PDF.
      • If the document contains 2 or more languages, the translation result may differ depending on the source language setting.

    Common settings

    You can get a client ID issued by registering the application on NAVER Cloud Platform's console .

    1. On the console, select AI Services > Papago Translation > APIs and register the application.

    2. Select the registered application from AI Services > Papago Translation > APIs and check Client ID and Client Secret.

    3. On the Edit screen from AI Services > Papago Translation > APIs, check if Papago Doc Translation is selected. Note that 429 (Quota Exceed) will occur if it is not selected.

    Error codes

    {
      "error": {
        "errorCode": "300",
        "message": "Not Found Exception"
      }
    }
    

    Common errors

    HTTP Status CodeError CodeError MessageDescription
    400100Bad Request ExceptionRequest errors such as protocol(https) and endocing(UTF-8)
    401200Authentication FailedAuthentication failed
    401210Permission DeniedNo permission
    404300Not Found ExceptionNo permission
    429400Quota ExceededQuota exceeded
    429410Throttle LimitedRate exceeded
    429420Rate LimitedRate exceeded
    413430Request Entity Too Largecontent-length exceeded (100 MB)
    503500Endpoint ErrorEndpoint connection error
    504510Endpoint TimeoutEndpoint connection time limit exceeded
    500900Unexpected ErrorUnexpected error
    {
      "error": {
        "errorCode": "00001",
        "message": "Request is invalid."
      }
    }
    

    API errors

    HTTP Status CodeError CodeError MessageDescription
    50000000API call failedSystem internal error
    40000001Request is invalidWrong parameter exists
    • Papago Doc Translation API was developed by referring to an official HWP document published by Hancom.

    Python example code

    Python example (Status API)

    import requests
    
    headers = {
      "X-NCP-APIGW-API-KEY-ID": user_client_ID,
      "X-NCP-APIGW-API-KEY": user_client_secret
    }
    
    url = "https://naveropenapi.apigw.ntruss.com/doc-trans/v1/status?requestId=" + RequestId
    res = requests.get(url, headers=headers)
    print(res.text)
    

    Python example (Translate API)

    import requests
    from requests_toolbelt import MultipartEncoder
    import uuid
    
    data = {
      'source': 'ko',
      'target': 'en',
      'file': ('a.docx', open('a.docx', 'rb'), 'application/octet-stream', {'Content-Transfer-Encoding': 'binary'})
    }
    m = MultipartEncoder(data, boundary=uuid.uuid4())
    
    headers = {
      "Content-Type": m.content_type,
      "X-NCP-APIGW-API-KEY-ID": user_client_ID,
      "X-NCP-APIGW-API-KEY": user_client_secret
    }
    
    url = "https://naveropenapi.apigw.ntruss.com/doc-trans/v1/translate"
    res = requests.post(url, headers=headers, data=m.to_string())
    print(res.text)
    

    Python example (Download API)

    import urllib.request
    
    url = "https://naveropenapi.apigw.ntruss.com/doc-trans/v1/download?requestId=" + RequestId
    
    opener = urllib.request.build_opener()
    opener.addheaders = [('X-NCP-APIGW-API-KEY-ID', user_client_ID), ('X-NCP-APIGW-API-KEY', user_client_secret)]
    urllib.request.install_opener(opener)
    
    urllib.request.urlretrieve(url, "b.docx")
    

    Was this article helpful?

    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.