Skip to content

Commit 4c65832

Browse files
committed
PDF and DOCX changes
1 parent 144b507 commit 4c65832

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+311
-294
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
*.pyc
2+
output.docx
3+
output.pdf

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ The following parameters are configurable for the API Client:
100100
| `backoff_factor` | `float` | A backoff factor to apply between attempts after the second try. <br> **Default: 2** |
101101
| `retry_statuses` | `Array of int` | The http statuses on which retry is to be done. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
102102
| `retry_methods` | `Array of string` | The http methods on which retry is to be done. <br> **Default: ['GET', 'PUT']** |
103+
| `apikey` | `string` | |
103104

104105
The API client can be initialized as follows:
105106

@@ -108,6 +109,7 @@ from firstlanguage_python.firstlanguage_python_client import FirstlanguageapiCli
108109
from firstlanguage_python.configuration import Environment
109110

110111
client = FirstlanguageapiClient(
112+
apikey='apikey',
111113
environment=Environment.PRODUCTION,)
112114
```
113115

dist/firstlanguage_python-2.1.tar.gz

40.2 KB
Binary file not shown.

doc/client.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@ The following parameters are configurable for the API Client:
55

66
| Parameter | Type | Description |
77
| --- | --- | --- |
8-
| `apikey` | `string` | API Key can be copied from your dashboard |
98
| `http_client_instance` | `HttpClient` | The Http Client passed from the sdk user for making requests |
109
| `override_http_client_configuration` | `bool` | The value which determines to override properties of the passed Http Client from the sdk user |
1110
| `timeout` | `float` | The value to use for connection timeout. <br> **Default: 60** |
1211
| `max_retries` | `int` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
1312
| `backoff_factor` | `float` | A backoff factor to apply between attempts after the second try. <br> **Default: 2** |
1413
| `retry_statuses` | `Array of int` | The http statuses on which retry is to be done. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
1514
| `retry_methods` | `Array of string` | The http methods on which retry is to be done. <br> **Default: ['GET', 'PUT']** |
15+
| `apikey` | `string` | |
1616

1717
The API client can be initialized as follows:
1818

1919
```python
2020
from firstlanguageapi.firstlanguageapi_client import FirstlanguageapiClient
2121
from firstlanguageapi.configuration import Environment
2222

23-
client = FirstlanguageapiClient(
24-
apikey='apikey',
23+
client = FirstlanguageapiClient(
24+
apikey='apikey',
2525
environment=Environment.PRODUCTION,)
2626
```
2727

@@ -33,7 +33,7 @@ The gateway for the SDK. This class acts as a factory for the Controllers and al
3333

3434
| Name | Description |
3535
| --- | --- |
36-
| basic_api | Gets BasicAPIsController |
37-
| advanced_api | Gets AdvancedAPIsController |
36+
| basic_ap_is | Gets BasicAPIsController |
37+
| advanced_ap_is | Gets AdvancedAPIsController |
3838
| enterprise_only | Gets EnterpriseOnlyController |
3939

doc/controllers/advanced-ap-is.md

+35-45
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,17 @@ advanced_ap_is_controller = client.advanced_ap_is
1010

1111
## Methods
1212

13-
* [Get Classification](/doc/controllers/advanced-ap-is.md#get-classification)
14-
* [Get QA](/doc/controllers/advanced-ap-is.md#get-qa)
15-
* [Get Table QA](/doc/controllers/advanced-ap-is.md#get-table-qa)
16-
* [Get Image Caption](/doc/controllers/advanced-ap-is.md#get-image-caption)
17-
* [Get NER](/doc/controllers/advanced-ap-is.md#get-ner)
18-
* [Get Summary](/doc/controllers/advanced-ap-is.md#get-summary)
19-
* [Get Translate](/doc/controllers/advanced-ap-is.md#get-translate)
13+
* [Get Classification](../../doc/controllers/advanced-ap-is.md#get-classification)
14+
* [Get QA](../../doc/controllers/advanced-ap-is.md#get-qa)
15+
* [Get Table QA](../../doc/controllers/advanced-ap-is.md#get-table-qa)
16+
* [Get Image Caption](../../doc/controllers/advanced-ap-is.md#get-image-caption)
17+
* [Get NER](../../doc/controllers/advanced-ap-is.md#get-ner)
18+
* [Get Summary](../../doc/controllers/advanced-ap-is.md#get-summary)
19+
* [Get Translate](../../doc/controllers/advanced-ap-is.md#get-translate)
2020

2121

2222
# Get Classification
2323

24-
# Text Classification : Defintion and it's usage
25-
2624
A text classifier identifies the categories of the text given as input. Classifying the texts is one of the powerful preprocessing technique in topic identification and sentiment classification (product reviews, movie reviews etc)and indexing the texts while building a search system.
2725

2826
# Languages covered:
@@ -54,11 +52,11 @@ def get_classification(self,
5452

5553
| Parameter | Type | Tags | Description |
5654
| --- | --- | --- | --- |
57-
| `body` | [`object`]($m/) | Body, Required | Add a JSON Input as per the schema defined below |
55+
| `body` | [`object`](../../$m/) | Body, Required | Add a JSON Input as per the schema defined below<br><br>**Size limit:**<br><br>1MB for both text and URL input<br><br>**URL Input:**<br><br>For URL, we now accept 4 contentTypes.<br><br>* html<br>* plaintext<br>* pdf<br>* docx<br><br>If you are providing Google drive or Google Spreadsheet url, ensure that you provide a link which can download the file directly and not the share link.<br><br>Example for Google Drive link:<br><br>https://drive.google.com/uc?id=idofthefile |
5856

5957
## Response Type
6058

61-
[`Responseclassify`](/doc/models/responseclassify.md)
59+
[`Responseclassify`](../../doc/models/responseclassify.md)
6260

6361
## Example Usage
6462

@@ -87,15 +85,13 @@ result = advanced_ap_is_controller.get_classification(body)
8785

8886
| HTTP Status Code | Error Description | Exception Class |
8987
| --- | --- | --- |
90-
| 400 | Error output | [`ErrorsException`](/doc/models/errors-exception.md) |
91-
| 426 | Please use HTTPS protocol | [`ApiClassify426ErrorException`](/doc/models/api-classify-426-error-exception.md) |
88+
| 400 | Error output | [`ErrorsException`](../../doc/models/errors-exception.md) |
89+
| 426 | Please use HTTPS protocol | [`ApiClassify426ErrorException`](../../doc/models/api-classify-426-error-exception.md) |
9290
| 429 | Too Many Requests | `APIException` |
9391

9492

9593
# Get QA
9694

97-
# QA : Defintion and it's usage
98-
9995
A Question Answering System retrieves the answer relevant to the question given by the user. A question answering system can be used for building a text based chatbots, search engines etc. Our question answering system is mutilingual and supports 100 + languages. Please use ISO 639-2 2 digit language code to get results. For example, use 'en' for English, 'ta' for Tamil, 'hi' for Hindi, 'fr' for French etc.
10096

10197
For ISO code reference, please check the link https://www.loc.gov/standards/iso639-2/php/code_list.php
@@ -109,11 +105,11 @@ def get_qa(self,
109105

110106
| Parameter | Type | Tags | Description |
111107
| --- | --- | --- | --- |
112-
| `body` | [`object`]($m/) | Body, Optional | Add a JSON Input as per the schema defined below |
108+
| `body` | [`object`](../../$m/) | Body, Optional | Add a JSON Input as per the schema defined below<br><br>**Size limit:**<br><br>1MB for both text and URL input<br><br>**URL Input:**<br><br>For URL, we now accept 4 contentTypes.<br><br>* html<br>* plaintext<br>* pdf<br>* docx<br><br>If you are providing Google drive or Google Spreadsheet url, ensure that you provide a link which can download the file directly and not the share link.<br><br>Example for Google Drive link:<br><br>https://drive.google.com/uc?id=idofthefile |
113109

114110
## Response Type
115111

116-
[`ApiQaResponse`](/doc/models/api-qa-response.md)
112+
[`ApiQaResponse`](../../doc/models/api-qa-response.md)
117113

118114
## Example Usage
119115

@@ -138,8 +134,8 @@ result = advanced_ap_is_controller.get_qa(body)
138134

139135
| HTTP Status Code | Error Description | Exception Class |
140136
| --- | --- | --- |
141-
| 400 | Bad Request | [`ErrorsException`](/doc/models/errors-exception.md) |
142-
| 426 | Please use HTTPS protocol | [`M426ErrorException`](/doc/models/m426-error-exception.md) |
137+
| 400 | Bad Request | [`ErrorsException`](../../doc/models/errors-exception.md) |
138+
| 426 | Please use HTTPS protocol | [`M426ErrorException`](../../doc/models/m426-error-exception.md) |
143139
| 429 | Too Many Requests | `APIException` |
144140

145141

@@ -165,11 +161,11 @@ def get_table_qa(self,
165161

166162
| Parameter | Type | Tags | Description |
167163
| --- | --- | --- | --- |
168-
| `body` | [`object`]($m/) | Body, Optional | Add a JSON Input as per the schema defined below. For URL input, if you are providing Google drive or Google Spreadsheet url ensure that you provide a link which can download the file directly and not the share link.<br><br>Example: For Google Spreadsheet, the url format will be like below:<br>https://docs.google.com/spreadsheets/d/1TtzPAHqpaTB7Ltdq0zwZ8FamF7O9aC4KH4EpmwI/export?format=csv&gid=151344200<br><br>Or for Google Drive, it will be like below:<br>https://drive.google.com/uc?id=idofthefile<br><br>For Flat table input check the example out. |
164+
| `body` | [`object`](../../$m/) | Body, Optional | Add a JSON Input as per the schema defined below. For URL input, if you are providing Google drive or Google Spreadsheet url ensure that you provide a link which can download the file directly and not the share link.<br><br>Example for Google Spreadsheet link:<br><br>https://docs.google.com/spreadsheets/d/1TtzPAHqpaTB7Ltdq0zwZ8FamF7O9aC4KH4EpmwI/export?format=csv&gid=151344200<br><br>Example for Google Drive link:<br><br>https://drive.google.com/uc?id=idofthefile<br><br>For Flat table input check the example. |
169165

170166
## Response Type
171167

172-
[`List of ApiTableqaResponse`](/doc/models/api-tableqa-response.md)
168+
[`List of ApiTableqaResponse`](../../doc/models/api-tableqa-response.md)
173169

174170
## Example Usage
175171

@@ -209,8 +205,8 @@ result = advanced_ap_is_controller.get_table_qa(body)
209205

210206
| HTTP Status Code | Error Description | Exception Class |
211207
| --- | --- | --- |
212-
| 400 | Bad Request | [`ErrorsException`](/doc/models/errors-exception.md) |
213-
| 426 | Please use HTTPS protocol | [`M426ErrorException`](/doc/models/m426-error-exception.md) |
208+
| 400 | Bad Request | [`ErrorsException`](../../doc/models/errors-exception.md) |
209+
| 426 | Please use HTTPS protocol | [`M426ErrorException`](../../doc/models/m426-error-exception.md) |
214210
| 429 | Too Many Requests | `APIException` |
215211

216212

@@ -233,11 +229,11 @@ def get_image_caption(self,
233229

234230
| Parameter | Type | Tags | Description |
235231
| --- | --- | --- | --- |
236-
| `body` | [`ApiImagecaptionRequest`](/doc/models/api-imagecaption-request.md) | Body, Optional | Add a JSON Input as per the schema defined below.<br><br>For URL, if you are providing Google drive or Google Spreadsheet url ensure that you provide a link which can download the file directly and not the share link.<br><br>Example: For Google Spreadsheet, the url format will be like below:<br>https://docs.google.com/spreadsheets/d/1TtzPAHqpaTB7Ltdq0zwZ8FamF7OwI/export?format=csv&gid=151344200<br><br>Or for Google Drive, it will be like below:<br>https://drive.google.com/uc?id=idofthefile |
232+
| `body` | [`ApiImagecaptionRequest`](../../doc/models/api-imagecaption-request.md) | Body, Optional | Add a JSON Input as per the schema defined below.<br><br>For URL, if you are providing Google drive or Google Spreadsheet url ensure that you provide a link which can download the file directly and not the share link.<br><br>Example for Google Drive:<br><br>https://drive.google.com/uc?id=idofthefile |
237233

238234
## Response Type
239235

240-
[`ApiImagecaptionResponse`](/doc/models/api-imagecaption-response.md)
236+
[`ApiImagecaptionResponse`](../../doc/models/api-imagecaption-response.md)
241237

242238
## Example Usage
243239

@@ -261,15 +257,13 @@ result = advanced_ap_is_controller.get_image_caption(body)
261257

262258
| HTTP Status Code | Error Description | Exception Class |
263259
| --- | --- | --- |
264-
| 400 | Bad Request | [`ErrorsException`](/doc/models/errors-exception.md) |
265-
| 426 | Please use HTTPS protocol | [`M426ErrorException`](/doc/models/m426-error-exception.md) |
260+
| 400 | Bad Request | [`ErrorsException`](../../doc/models/errors-exception.md) |
261+
| 426 | Please use HTTPS protocol | [`M426ErrorException`](../../doc/models/m426-error-exception.md) |
266262
| 429 | Too Many Requests | `APIException` |
267263

268264

269265
# Get NER
270266

271-
# Named Entity Recognition : Defintion and it's usage
272-
273267
Named Entity Recognitiion (NER) is extracting the specific Nouns such as, Person Names, Location names, Organization Names, Currency , Dates. It is a classification task. NER can be used as a sub-task in applications such as Search Systems, Chatbots, Question Answering systems, Text Summarization etc.
274268

275269
# Languages covered:
@@ -299,11 +293,11 @@ def get_ner(self,
299293

300294
| Parameter | Type | Tags | Description |
301295
| --- | --- | --- | --- |
302-
| `body` | [`object`]($m/) | Body, Optional | Add a JSON Input as per the schema defined below |
296+
| `body` | [`object`](../../$m/) | Body, Optional | Add a JSON Input as per the schema defined below<br><br>**Size limit:**<br><br>1MB for both text and URL input<br><br>**URL Input:**<br><br>For URL, we now accept 4 contentTypes.<br><br>* html<br>* plaintext<br>* pdf<br>* docx<br><br>If you are providing Google drive or Google Spreadsheet url, ensure that you provide a link which can download the file directly and not the share link.<br><br>Example for Google Drive link:<br><br>https://drive.google.com/uc?id=idofthefile |
303297

304298
## Response Type
305299

306-
[`List of ApiNerResponse`](/doc/models/api-ner-response.md)
300+
[`List of ApiNerResponse`](../../doc/models/api-ner-response.md)
307301

308302
## Example Usage
309303

@@ -336,15 +330,13 @@ result = advanced_ap_is_controller.get_ner(body)
336330

337331
| HTTP Status Code | Error Description | Exception Class |
338332
| --- | --- | --- |
339-
| 400 | Bad Request | [`ErrorsException`](/doc/models/errors-exception.md) |
340-
| 426 | Please use HTTPS protocol | [`M426ErrorException`](/doc/models/m426-error-exception.md) |
333+
| 400 | Bad Request | [`ErrorsException`](../../doc/models/errors-exception.md) |
334+
| 426 | Please use HTTPS protocol | [`M426ErrorException`](../../doc/models/m426-error-exception.md) |
341335
| 429 | Too Many Requests | `APIException` |
342336

343337

344338
# Get Summary
345339

346-
# Summarization : Defintion and it's usage
347-
348340
Summarization generates a crisp content of the large input text which is highly coherent.
349341

350342
| Languages | ISO Code |
@@ -401,11 +393,11 @@ def get_summary(self,
401393

402394
| Parameter | Type | Tags | Description |
403395
| --- | --- | --- | --- |
404-
| `body` | [`object`]($m/) | Body, Optional | Add a JSON Input as per the schema defined below |
396+
| `body` | [`object`](../../$m/) | Body, Optional | Add a JSON Input as per the schema defined below<br><br>**Size limit:**<br><br>1MB for both text and URL input<br><br>**URL Input:**<br><br>For URL, we now accept 4 contentTypes.<br><br>* html<br>* plaintext<br>* pdf<br>* docx<br><br>If you are providing Google drive or Google Spreadsheet url, ensure that you provide a link which can download the file directly and not the share link.<br><br>Example for Google Drive link:<br><br>https://drive.google.com/uc?id=idofthefile |
405397

406398
## Response Type
407399

408-
[`ApiSummaryResponse`](/doc/models/api-summary-response.md)
400+
[`ApiSummaryResponse`](../../doc/models/api-summary-response.md)
409401

410402
## Example Usage
411403

@@ -427,15 +419,13 @@ result = advanced_ap_is_controller.get_summary(body)
427419

428420
| HTTP Status Code | Error Description | Exception Class |
429421
| --- | --- | --- |
430-
| 400 | Bad Request | [`ErrorsException`](/doc/models/errors-exception.md) |
431-
| 426 | Please use HTTPS protocol | [`M426ErrorException`](/doc/models/m426-error-exception.md) |
422+
| 400 | Bad Request | [`ErrorsException`](../../doc/models/errors-exception.md) |
423+
| 426 | Please use HTTPS protocol | [`M426ErrorException`](../../doc/models/m426-error-exception.md) |
432424
| 429 | Too Many Requests | `APIException` |
433425

434426

435427
# Get Translate
436428

437-
# Translation : Defintion and it's usage
438-
439429
Machine Translation is translating the text automatically from one language to another langauge.
440430

441431
# Languages covered:
@@ -508,11 +498,11 @@ def get_translate(self,
508498

509499
| Parameter | Type | Tags | Description |
510500
| --- | --- | --- | --- |
511-
| `body` | [`object`]($m/) | Body, Optional | Add a JSON Input as per the schema defined below |
501+
| `body` | [`object`](../../$m/) | Body, Optional | Add a JSON Input as per the schema defined below<br><br>**Size limit:**<br><br>1MB for both text and URL input<br><br>**URL Input:**<br><br>For URL, we now accept 4 contentTypes.<br><br>* html<br>* plaintext<br>* pdf<br>* docx<br><br>If you are providing Google drive or Google Spreadsheet url, ensure that you provide a link which can download the file directly and not the share link.<br><br>Example for Google Drive link:<br><br>https://drive.google.com/uc?id=idofthefile<br><br>**preserveFormat Flag:**<br><br>When true:<br><br>This applies only for PDF and DOCX content types. The API will try to maintain the source file formatting. DOCX files will mostly work without any issues. But for PDF files, the API will try to maintain the format but it is not guaranteed. Scanned documents will also not work. For PDF files, if the target language font is not renderred properly, please report the issue at [email protected]<br><br>When false:<br><br>If the flag is false, then the API will simply read all text in the PDF and docx files and translate and send the response back as plaintext. |
512502

513503
## Response Type
514504

515-
[`ApiTranslateResponse`](/doc/models/api-translate-response.md)
505+
[`ApiTranslateResponse`](../../doc/models/api-translate-response.md)
516506

517507
## Example Usage
518508

@@ -534,7 +524,7 @@ result = advanced_ap_is_controller.get_translate(body)
534524

535525
| HTTP Status Code | Error Description | Exception Class |
536526
| --- | --- | --- |
537-
| 400 | Bad Request | [`ErrorsException`](/doc/models/errors-exception.md) |
538-
| 426 | Please use HTTPS protocol | [`M426ErrorException`](/doc/models/m426-error-exception.md) |
527+
| 400 | Bad Request | [`ErrorsException`](../../doc/models/errors-exception.md) |
528+
| 426 | Please use HTTPS protocol | [`M426ErrorException`](../../doc/models/m426-error-exception.md) |
539529
| 429 | Too Many Requests | `APIException` |
540530

0 commit comments

Comments
 (0)