Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Beomi/pypapago
π§[Archived][Unofficial] Python wrapper for Papago translation service
https://github.com/Beomi/pypapago
papago pypi-package translate
Last synced: 3 months ago
JSON representation
π§[Archived][Unofficial] Python wrapper for Papago translation service
- Host: GitHub
- URL: https://github.com/Beomi/pypapago
- Owner: Beomi
- License: mit
- Archived: true
- Created: 2019-07-08T11:30:06.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-09-03T09:10:11.000Z (about 4 years ago)
- Last Synced: 2024-07-14T03:32:23.277Z (4 months ago)
- Topics: papago, pypi-package, translate
- Language: Python
- Homepage: https://beomi.github.io/2019/07/08/Papago-API-with-Python/
- Size: 13.7 KB
- Stars: 47
- Watchers: 3
- Forks: 8
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-nlp-note - pypapago nmt lib
README
# THIS PROJECT is ARCHIVED!
This project is no longer maintained by the author.
No additional support is provided.If you're still interested in the Papago's translation service, plz follow the direction below:
https://developers.naver.com/docs/papago/papago-nmt-overview.md
---
# pypapago [![codecov](https://codecov.io/gh/Beomi/pypapago/branch/master/graph/badge.svg)](https://codecov.io/gh/Beomi/pypapago)
Unofficial python wrapper for [papago translate service](https://papago.naver.com).
## Install
```bash
pip install -U pypapago
```## Usage
### Basic usage (English to Korean)
```python
from pypapago import Translatortranslator = Translator()
result = translator.translate('I am GROOT')
print(result) # λλ 그루νΈλ€
```### Set Source/Target Language
```python
from pypapago import Translatortranslator = Translator()
result = translator.translate(
'μΉ΄μΉ΄μ€λ ννκ³ λ₯Ό μ’μν΄',
source='ko',
target='en',
)
print(result) # Kakao likes papago.
```#### Supported Language Codes
Code | Desc
--|--
ko | Korean
en | English
ja | Japanese
zh-CN | Chinese
zh-TW | Chinese traditional
es | Spanish
fr | French
vi | Vietnamese
th | Thai
id | Indonesia### Bulk Translation
Parallel bulk translation with Multiprocessing.
```python
from pypapago import Translatortranslator = Translator()
result = translator.bulk_translate(['apple', 'banana'])
print(result) # ['μ¬κ³Ό', 'λ°λλ']
```You can also set how many workers to run manually.
(The more workers make your code faster but requires more system resources.)
Default to CPU Cores (HyperThreading = x2)
- ex) Run with 2cores
```python
from pypapago import Translatortranslator = Translator()
result = translator.bulk_translate(
['apple', 'banana'],
workers=2
)
print(result) # ['μ¬κ³Ό', 'λ°λλ']
```### Verbose output
If you need raw result from papago API, you can set `verbose` to `True`.
```python
from pypapago import Translatortranslator = Translator()
result = translator.translate('I am GROOT', verbose=True)
print(result) # RAW JSON Result
#{'delay': 400,
# 'delaySmt': 400,
# 'dict': {'items': [{'entry': 'I',
# ...
# 'translatedText': 'λλ 그루νΈλ€'}
#}
```Detail results may change.