Skip to content

Commit b4f2264

Browse files
committed
Change Example
1 parent b74b20d commit b4f2264

File tree

7 files changed

+220
-2
lines changed

7 files changed

+220
-2
lines changed
26.7 KB
Binary file not shown.

examples/example_Stemmer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from firstlanguage.firstlanguage_client import Client
2-
from firstlanguage.configuration import Environment
1+
from firstlanguage_python.firstlanguage_client import Client
2+
from firstlanguage_python.configuration import Environment
33
import jsonpickle
44

55

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
Metadata-Version: 2.1
2+
Name: firstlanguage-python
3+
Version: 1.0.0
4+
Summary: Python client library for FirstLanguage API
5+
Home-page: https://firstlanguage.in/contactus
6+
Author: FirstLanguage
7+
Author-email: info@firstlanguage.in
8+
License: UNKNOWN
9+
Download-URL: https://github.com/FirstLanguage/firstlanguage_python/archive/refs/tags/v_01.tar.gz
10+
Description:
11+
# Getting Started with FirstLanguage API
12+
13+
## Introduction
14+
15+
Collection of NLP APIs to help developers. We have grouped the APIs under Basic and Advanced. Basic APIs cover all basic text operations like POSTag, Stemmer etc and Advanced cover all the APIs like QA, translation etc.
16+
17+
### OpenAPI Specification
18+
19+
This API is documented in **OpenAPI v3.0 format**.
20+
In addition to standard
21+
OpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/master/docs/redoc-vendor-extensions.md).
22+
23+
## Building
24+
25+
Download the FirstLanguage Python SDK from <a href="FirstLanguage_PythonSDK.zip">here</a>
26+
27+
You must have Python `3 >=3.7, <= 3.9` installed on your system to install and run this SDK. This SDK package depends on other Python packages like nose, jsonpickle etc. These dependencies are defined in the `requirements.txt` file that comes with the SDK. To resolve these dependencies, you can use the PIP Dependency manager. Install it by following steps at [https://pip.pypa.io/en/stable/installing/](https://pip.pypa.io/en/stable/installing/).
28+
29+
Python and PIP executables should be defined in your PATH. Open command prompt and type `pip --version`. This should display the version of the PIP Dependency Manager installed if your installation was successful and the paths are properly defined.
30+
31+
* Using command line, navigate to the directory containing the generated files (including `requirements.txt`) for the SDK.
32+
* Run the command `pip install -r requirements.txt`. This should install all the required dependencies.
33+
34+
![Building SDK - Step 1](https://apidocs.io/illustration/python?workspaceFolder=Firstlanguageapi-Python&step=installDependencies)
35+
36+
## Installation
37+
38+
The following section explains how to use the firstlanguageapi library in a new project.
39+
40+
### 1. Open Project in an IDE
41+
42+
Open up a Python IDE like PyCharm. The basic workflow presented here is also applicable if you prefer using a different editor or IDE.
43+
44+
![Open project in PyCharm - Step 1](https://apidocs.io/illustration/python?workspaceFolder=Firstlanguageapi-Python&step=pyCharm)
45+
46+
Click on `Open` in PyCharm to browse to your generated SDK directory and then click `OK`.
47+
48+
![Open project in PyCharm - Step 2](https://apidocs.io/illustration/python?workspaceFolder=Firstlanguageapi-Python&step=openProject0)
49+
50+
The project files will be displayed in the side bar as follows:
51+
52+
![Open project in PyCharm - Step 3](https://apidocs.io/illustration/python?workspaceFolder=Firstlanguageapi-Python&projectName=firstlanguageapi&step=openProject1)
53+
54+
### 2. Add a new Test Project
55+
56+
Create a new directory by right clicking on the solution name as shown below:
57+
58+
![Add a new project in PyCharm - Step 1](https://apidocs.io/illustration/python?workspaceFolder=Firstlanguageapi-Python&projectName=firstlanguageapi&step=createDirectory)
59+
60+
Name the directory as "test".
61+
62+
![Add a new project in PyCharm - Step 2](https://apidocs.io/illustration/python?workspaceFolder=Firstlanguageapi-Python&step=nameDirectory)
63+
64+
Add a python file to this project.
65+
66+
![Add a new project in PyCharm - Step 3](https://apidocs.io/illustration/python?workspaceFolder=Firstlanguageapi-Python&projectName=firstlanguageapi&step=createFile)
67+
68+
Name it "testSDK".
69+
70+
![Add a new project in PyCharm - Step 4](https://apidocs.io/illustration/python?workspaceFolder=Firstlanguageapi-Python&projectName=firstlanguageapi&step=nameFile)
71+
72+
In your python file you will be required to import the generated python library using the following code lines
73+
74+
```python
75+
from firstlanguageapi.firstlanguageapi_client import FirstlanguageapiClient
76+
```
77+
78+
![Add a new project in PyCharm - Step 5](https://apidocs.io/illustration/python?workspaceFolder=Firstlanguageapi-Python&projectName=firstlanguageapi&libraryName=firstlanguageapi.firstlanguageapi_client&className=FirstlanguageapiClient&step=projectFiles)
79+
80+
After this you can write code to instantiate an API client object, get a controller object and make API calls. Sample code is given in the subsequent sections.
81+
82+
### 3. Run the Test Project
83+
84+
To run the file within your test project, right click on your Python file inside your Test project and click on `Run`
85+
86+
![Run Test Project - Step 1](https://apidocs.io/illustration/python?workspaceFolder=Firstlanguageapi-Python&projectName=firstlanguageapi&libraryName=firstlanguageapi.firstlanguageapi_client&className=FirstlanguageapiClient&step=runProject)
87+
88+
## Test the SDK
89+
90+
You can test the generated SDK and the server with test cases. `unittest` is used as the testing framework and `nose` is used as the test runner. You can run the tests as follows:
91+
92+
Navigate to the root directory of the SDK and run the following commands
93+
94+
```
95+
pip install -r test-requirements.txt
96+
nosetests
97+
```
98+
99+
## Initialize the API Client
100+
101+
**_Note:_** Documentation for the client can be found [here.](/doc/client.md)
102+
103+
The following parameters are configurable for the API Client:
104+
105+
| Parameter | Type | Description |
106+
| --- | --- | --- |
107+
| `apikey` | `string` | API Key can be copied from your dashboard |
108+
| `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 |
110+
| `timeout` | `float` | The value to use for connection timeout. <br> **Default: 60** |
111+
| `max_retries` | `int` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
112+
| `backoff_factor` | `float` | A backoff factor to apply between attempts after the second try. <br> **Default: 2** |
113+
| `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]** |
114+
| `retry_methods` | `Array of string` | The http methods on which retry is to be done. <br> **Default: ['GET', 'PUT']** |
115+
116+
The API client can be initialized as follows:
117+
118+
```python
119+
from firstlanguageapi.firstlanguageapi_client import FirstlanguageapiClient
120+
from firstlanguageapi.configuration import Environment
121+
122+
client = FirstlanguageapiClient(
123+
apikey='apikey',
124+
environment=Environment.PRODUCTION,)
125+
```
126+
127+
## Authorization
128+
129+
This API uses `Custom Header Signature`.
130+
131+
## List of APIs
132+
133+
* [Basic AP Is](/doc/controllers/basic-api.md)
134+
* [Advanced AP Is](/doc/controllers/advanced-api.md)
135+
136+
## Classes Documentation
137+
138+
* [Utility Classes](/doc/utility-classes.md)
139+
* [HttpResponse](/doc/http-response.md)
140+
* [HttpRequest](/doc/http-request.md)
141+
142+
143+
Keywords: FirstLanguage API,NLP,SDK,Python,Natural Language Processing
144+
Platform: UNKNOWN
145+
Description-Content-Type: text/markdown
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
LICENSE
2+
MANIFEST.in
3+
README.md
4+
setup.cfg
5+
setup.py
6+
firstlanguage_python/__init__.py
7+
firstlanguage_python/api_helper.py
8+
firstlanguage_python/configuration.py
9+
firstlanguage_python/decorators.py
10+
firstlanguage_python/firstlanguage_client.py
11+
firstlanguage_python.egg-info/PKG-INFO
12+
firstlanguage_python.egg-info/SOURCES.txt
13+
firstlanguage_python.egg-info/dependency_links.txt
14+
firstlanguage_python.egg-info/requires.txt
15+
firstlanguage_python.egg-info/top_level.txt
16+
firstlanguage_python/controllers/__init__.py
17+
firstlanguage_python/controllers/advanced_api_controller.py
18+
firstlanguage_python/controllers/base_controller.py
19+
firstlanguage_python/controllers/basic_api_controller.py
20+
firstlanguage_python/exceptions/__init__.py
21+
firstlanguage_python/exceptions/api_classify_426_error_exception.py
22+
firstlanguage_python/exceptions/api_exception.py
23+
firstlanguage_python/exceptions/api_lemmatize_426_error_exception.py
24+
firstlanguage_python/exceptions/api_morph_426_error_exception.py
25+
firstlanguage_python/exceptions/api_postag_426_error_exception.py
26+
firstlanguage_python/exceptions/api_stemmer_426_error_exception.py
27+
firstlanguage_python/exceptions/errors_exception.py
28+
firstlanguage_python/exceptions/m_426_error_exception.py
29+
firstlanguage_python/http/__init__.py
30+
firstlanguage_python/http/http_call_back.py
31+
firstlanguage_python/http/http_client.py
32+
firstlanguage_python/http/http_method_enum.py
33+
firstlanguage_python/http/http_request.py
34+
firstlanguage_python/http/http_response.py
35+
firstlanguage_python/http/requests_client.py
36+
firstlanguage_python/http/auth/__init__.py
37+
firstlanguage_python/http/auth/custom_header_auth.py
38+
firstlanguage_python/models/__init__.py
39+
firstlanguage_python/models/api_ner_response.py
40+
firstlanguage_python/models/api_qa_response.py
41+
firstlanguage_python/models/errors_1.py
42+
firstlanguage_python/models/input.py
43+
firstlanguage_python/models/input_1.py
44+
firstlanguage_python/models/input_2.py
45+
firstlanguage_python/models/input_3.py
46+
firstlanguage_python/models/input_4.py
47+
firstlanguage_python/models/orignal_string.py
48+
firstlanguage_python/models/responseclassify.py
49+
firstlanguage_python/models/responselemma.py
50+
firstlanguage_python/models/responsemorph.py
51+
firstlanguage_python/models/responsepo.py
52+
firstlanguage_python/models/responsestem.py
53+
firstlanguage_python/models/text_input.py
54+
firstlanguage_python/models/text_input_classify.py
55+
firstlanguage_python/models/text_input_tamil.py
56+
firstlanguage_python/models/url_input.py
57+
firstlanguage_python/models/url_input_classify.py
58+
firstlanguage_python/utilities/__init__.py
59+
firstlanguage_python/utilities/file_wrapper.py
60+
tests/__init__.py
61+
tests/http_response_catcher.py
62+
tests/test_helper.py
63+
tests/controllers/__init__.py
64+
tests/controllers/controller_test_base.py
65+
tests/controllers/test_advanced_ap_is_controller.py
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
cachecontrol~=0.12.6
2+
enum34>=1.1.10,~=1.1
3+
jsonpickle>=1.4.1,~=1.4
4+
python-dateutil~=2.8.1
5+
requests~=2.24
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
firstlanguage_python
2+
tests

0 commit comments

Comments
 (0)