Papago Document Translation Overview
- Print
- PDF
Papago Document Translation Overview
- Print
- PDF
Article Summary
Share feedback
Thanks for sharing your feedback!
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 .
On the console, select AI Services > Papago Translation > APIs and register the application.
Select the registered application from AI Services > Papago Translation > APIs and check Client ID and Client Secret.
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 Code | Error Code | Error Message | Description |
---|---|---|---|
400 | 100 | Bad Request Exception | Request errors such as protocol(https) and endocing(UTF-8) |
401 | 200 | Authentication Failed | Authentication failed |
401 | 210 | Permission Denied | No permission |
404 | 300 | Not Found Exception | No permission |
429 | 400 | Quota Exceeded | Quota exceeded |
429 | 410 | Throttle Limited | Rate exceeded |
429 | 420 | Rate Limited | Rate exceeded |
413 | 430 | Request Entity Too Large | content-length exceeded (100 MB) |
503 | 500 | Endpoint Error | Endpoint connection error |
504 | 510 | Endpoint Timeout | Endpoint connection time limit exceeded |
500 | 900 | Unexpected Error | Unexpected error |
{
"error": {
"errorCode": "00001",
"message": "Request is invalid."
}
}
API errors
HTTP Status Code | Error Code | Error Message | Description |
---|---|---|---|
500 | 00000 | API call failed | System internal error |
400 | 00001 | Request is invalid | Wrong 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?