@apiverve/lemmatizer 1.0.2 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -14
- package/index.js +16 -7
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Text
|
|
1
|
+
Text Lemmatizer API
|
|
2
2
|
============
|
|
3
3
|
|
|
4
4
|
Lemmatizer is a simple tool for lemmatizing text. It returns the lemmatized text.
|
|
@@ -7,7 +7,7 @@ Lemmatizer is a simple tool for lemmatizing text. It returns the lemmatized text
|
|
|
7
7
|

|
|
8
8
|

|
|
9
9
|
|
|
10
|
-
This is a Javascript Wrapper for the [Text
|
|
10
|
+
This is a Javascript Wrapper for the [Text Lemmatizer API](https://apiverve.com/marketplace/api/lemmatizer)
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
@@ -25,7 +25,7 @@ You can get it by signing up at [https://apiverve.com](https://apiverve.com)
|
|
|
25
25
|
|
|
26
26
|
## Usage
|
|
27
27
|
|
|
28
|
-
The Text
|
|
28
|
+
The Text Lemmatizer API documentation is found here: [https://docs.apiverve.com/api/lemmatizer](https://docs.apiverve.com/api/lemmatizer).
|
|
29
29
|
You can find parameters, example responses, and status codes documented here.
|
|
30
30
|
|
|
31
31
|
### Setup
|
|
@@ -48,7 +48,7 @@ Using the API client, you can perform requests to the API.
|
|
|
48
48
|
|
|
49
49
|
```
|
|
50
50
|
var query = {
|
|
51
|
-
"text": "The
|
|
51
|
+
"text": "The cats ran from door to door"
|
|
52
52
|
};
|
|
53
53
|
```
|
|
54
54
|
|
|
@@ -71,17 +71,11 @@ api.execute(query, function (error, data) {
|
|
|
71
71
|
"status": "ok",
|
|
72
72
|
"error": null,
|
|
73
73
|
"data": {
|
|
74
|
-
"found":
|
|
74
|
+
"found": 3,
|
|
75
75
|
"lemmas": {
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"jump": 1,
|
|
80
|
-
"over": 1,
|
|
81
|
-
"lazi": 1,
|
|
82
|
-
"dog": 1,
|
|
83
|
-
"and": 1,
|
|
84
|
-
"other": 1
|
|
76
|
+
"cat": 1,
|
|
77
|
+
"ran": 1,
|
|
78
|
+
"door": 2
|
|
85
79
|
}
|
|
86
80
|
}
|
|
87
81
|
}
|
package/index.js
CHANGED
|
@@ -24,8 +24,13 @@ class lemmatizerWrapper {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
async execute(query, callback) {
|
|
27
|
-
if
|
|
28
|
-
|
|
27
|
+
if(arguments.length > 1) {
|
|
28
|
+
if (!query || typeof query !== 'object') {
|
|
29
|
+
throw new Error('Query parameters must be provided as an object.');
|
|
30
|
+
}
|
|
31
|
+
} else {
|
|
32
|
+
callback = query;
|
|
33
|
+
query = {};
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
var requiredParams = ["text"];
|
|
@@ -68,11 +73,15 @@ class lemmatizerWrapper {
|
|
|
68
73
|
|
|
69
74
|
constructURL(query) {
|
|
70
75
|
let url = this.baseURL;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
|
|
77
|
+
if(query && typeof query === 'object')
|
|
78
|
+
{
|
|
79
|
+
if (Object.keys(query).length > 0) {
|
|
80
|
+
const queryString = Object.keys(query)
|
|
81
|
+
.map(key => `${encodeURIComponent(key)}=${encodeURIComponent(query[key])}`)
|
|
82
|
+
.join('&');
|
|
83
|
+
url += `?${queryString}`;
|
|
84
|
+
}
|
|
76
85
|
}
|
|
77
86
|
return url;
|
|
78
87
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apiverve/lemmatizer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Lemmatizer is a simple tool for lemmatizing text. It returns the lemmatized text.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
},
|
|
21
21
|
"homepage": "https://github.com/apiverve/lemmatizer-API",
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"mocha": "^
|
|
24
|
-
"chai": "^
|
|
25
|
-
"dotenv": "^
|
|
23
|
+
"mocha": "^10.4.0",
|
|
24
|
+
"chai": "^5.1.1",
|
|
25
|
+
"dotenv": "^16.4.5"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"node-fetch": "3.3.2",
|
|
29
|
-
"promise": "^
|
|
30
|
-
"axios": "
|
|
29
|
+
"promise": "^8.3.0",
|
|
30
|
+
"axios": "1.6.8"
|
|
31
31
|
}
|
|
32
32
|
}
|