You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+27-84Lines changed: 27 additions & 84 deletions
Original file line number
Diff line number
Diff line change
@@ -7,80 +7,24 @@ Collection of NLP APIs to help developers. We have grouped the APIs under Basic
7
7
8
8
### OpenAPI Specification
9
9
10
-
This API is documented in **OpenAPI v3.0 format**.
11
-
In addition to standard
12
-
OpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/master/docs/redoc-vendor-extensions.html).
10
+
This API is documented in **OpenAPI v3.0 format**.
11
+
In addition to standard
12
+
OpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/master/docs/redoc-vendor-extensions.md).
13
13
14
14
## Building
15
15
16
-
You can use the SDK either from source by cloning from GitHub using our [repo](https://github.com/FirstLanguage/firstlanguage_python.git)
17
-
18
-
Or you can use PIP to install our package directly by using the command.
19
-
20
-
```
21
-
pip install firstlanguage-python
22
-
```
23
-
24
-
## Follow below steps if you want to use SDK from our PIP published package
25
-
26
-
Once the package is installed you can directly use our package in your code. Below is a working example. Replace <Your_API_KEY> with your API Key from the dashboard.
27
-
28
-
```
29
-
from firstlanguage_python.firstlanguage_client import Client
30
-
from firstlanguage_python.configuration import Environment
31
-
import jsonpickle
32
-
33
-
34
-
client = Client(
35
-
apikey='<Your_API_KEY>',
36
-
environment=Environment.PRODUCTION,)
37
-
38
-
reqbody='{"input":{"text":"அவள் வேகமாக ஓடினாள்","lang":"ta"} }'
39
-
40
-
body = jsonpickle.decode(reqbody)
41
-
basic_api_controller = client.basic_api
42
-
43
-
result = basic_api_controller.get_stemmer(body)
44
-
45
-
for res in result:
46
-
print("Original Text passed: "+res.orginal_text)
47
-
print("Stemmed result: "+res.stem)
48
-
49
-
50
-
```
51
-
52
-
Save the above file as test.py and run it using the below command
53
-
54
-
```
55
-
python3 test.py
56
-
```
57
-
58
-
You will get an output like below
59
-
60
-
```
61
-
200
62
-
Original Text passed: அவள்
63
-
Stemmed result: அவள்
64
-
Original Text passed: வேகமாக
65
-
Stemmed result: வேகம்
66
-
Original Text passed: ஓடினாள்
67
-
Stemmed result: ஓடி
68
-
```
69
-
70
-
## Follow below steps if you want to use SDK from source
71
-
72
16
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/).
73
17
74
18
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.
75
19
76
-
* Using command line, navigate to the directory containing the generated files (including `requirements.txt`) for the SDK.
20
+
* Using command line, navigate to the directory containing the generated files (including `requirements.txt`) for the SDK.
77
21
* Run the command `pip install -r requirements.txt`. This should install all the required dependencies.
The following section explains how to use the firstlanguageapi library in a new project.
27
+
The following section explains how to use the firstlanguage_python library in a new project.
84
28
85
29
### 1. Open Project in an IDE
86
30
@@ -94,62 +38,61 @@ Click on `Open` in PyCharm to browse to your generated SDK directory and then cl
94
38
95
39
The project files will be displayed in the side bar as follows:
96
40
97
-

41
+

98
42
99
43
### 2. Add a new Test Project
100
44
101
45
Create a new directory by right clicking on the solution name as shown below:
102
46
103
-

47
+

104
48
105
49
Name the directory as "test".
106
50
107
51

108
52
109
53
Add a python file to this project.
110
54
111
-

55
+

112
56
113
57
Name it "testSDK".
114
58
115
-

59
+

116
60
117
61
In your python file you will be required to import the generated python library using the following code lines

67
+

124
68
125
69
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.
126
70
127
71
### 3. Run the Test Project
128
72
129
73
To run the file within your test project, right click on your Python file inside your Test project and click on `Run`
130
74
131
-

75
+

132
76
133
77
## Test the SDK
134
78
135
79
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:
136
80
137
-
Navigate to the root directory of the SDK and run the following commands
138
-
139
-
```
140
-
pip install -r test-requirements.txt
141
-
nosetests
81
+
Navigate to the root directory of the SDK and run the following commands
82
+
83
+
```
84
+
pip install -r test-requirements.txt
85
+
nosetests
142
86
```
143
87
144
88
## Initialize the API Client
145
89
146
-
**_Note:_** Documentation for the client can be found [here.](/doc/client.html)
90
+
**_Note:_** Documentation for the client can be found [here.](/doc/client.md)
147
91
148
92
The following parameters are configurable for the API Client:
149
93
150
94
| Parameter | Type | Description |
151
95
| --- | --- | --- |
152
-
|`apikey`|`string`| API Key can be copied from your dashboard |
153
96
|`http_client_instance`|`HttpClient`| The Http Client passed from the sdk user for making requests |
154
97
|`override_http_client_configuration`|`bool`| The value which determines to override properties of the passed Http Client from the sdk user |
155
98
|`timeout`|`float`| The value to use for connection timeout. <br> **Default: 60**|
@@ -161,11 +104,10 @@ The following parameters are configurable for the API Client:
0 commit comments