Skip to content

Commit a38744c

Browse files
author
Julien Salinas
committed
Add translation method.
1 parent e69115f commit a38744c

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,16 @@ client.summarization("<Your text to summarize>")
136136

137137
The above command returns a JSON object.
138138

139+
### Translation Endpoint
140+
141+
Call the `translation()` method and pass the text you want to translate.
142+
143+
```python
144+
client.translation("<Your text to translate>")
145+
```
146+
147+
The above command returns a JSON object.
148+
139149
### Dependencies Endpoint
140150

141151
Call the `dependencies()` method and pass the text you want to perform part of speech tagging (POS) + arcs on.

nlpcloud/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,18 @@ def summarization(self, text):
7474

7575
return r.json()
7676

77+
def translation(self, text):
78+
payload = {
79+
"text": text
80+
}
81+
82+
r = requests.post(
83+
"{}/{}".format(self.root_url, "translation"), json=payload, headers=self.headers)
84+
85+
r.raise_for_status()
86+
87+
return r.json()
88+
7789
def dependencies(self, text):
7890
payload = {
7991
"text": text

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name='nlpcloud',
5-
version='1.0.8',
5+
version='1.0.9',
66
description='Python client for the NLP Cloud API',
77
long_description="NLP Cloud serves high performance pre-trained or custom models for NER, sentiment-analysis, classification, summarization, question answering, and POS tagging, ready for production, served through a REST API.\n\nThis is the Python client for the API.\n\nMore details here: https://nlpcloud.io\n\nDocumentation: https://docs.nlpcloud.io\n\nGithub: https://github.com/nlpcloud/nlpcloud-python",
88
packages=['nlpcloud'],

0 commit comments

Comments
 (0)