natural 6.11.1 → 6.12.0
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/.env +7 -6
- package/.github/workflows/node.js.yml +60 -19
- package/lib/natural/classifiers/bayes_classifier.js +5 -0
- package/lib/natural/classifiers/classifier.js +10 -0
- package/lib/natural/classifiers/logistic_regression_classifier.js +7 -2
- package/lib/natural/util/storage/File.js +22 -0
- package/lib/natural/util/storage/Memcached.js +22 -0
- package/lib/natural/util/storage/MongoDB.js +31 -3
- package/lib/natural/util/storage/Postgres.js +49 -32
- package/lib/natural/util/storage/Redis.js +22 -0
- package/lib/natural/util/storage/StorageBackend.js +23 -0
- package/package.json +3 -3
- package/tsconfig.json +1 -1
- package/f2f5d4bc-daa0-4392-8981-9614cd0c802e.json +0 -1
package/.env
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Storage backend you want to use
|
|
2
2
|
NATURAL_STORAGE=PG
|
|
3
3
|
# Settings for Postgres
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
POSTGRES_USER=user
|
|
5
|
+
POSTGRES_PASSWORD=password
|
|
6
|
+
POSTGRES_DB=naturaldb
|
|
7
|
+
POSTGRES_HOST=localhost
|
|
8
|
+
POSTGRES_PORT=5432
|
|
9
|
+
POSTGRES_TABLE=naturaltable
|
|
10
10
|
# Settings for Redis
|
|
11
11
|
REDIS_HOST=localhost
|
|
12
12
|
REDIS_PORT=6379
|
|
@@ -18,5 +18,6 @@ MEM_EXPIRES = 3600
|
|
|
18
18
|
MONGO_HOST=localhost
|
|
19
19
|
MONGO_PORT=27017
|
|
20
20
|
MONGO_DATABASE=naturaldb
|
|
21
|
+
MONGO_OBJECTMODEL=NaturalObjectModel
|
|
21
22
|
# Path to the folder writing files
|
|
22
23
|
FS_PATH=.
|
|
@@ -1,35 +1,76 @@
|
|
|
1
|
-
# This workflow will do a clean install of node dependencies,
|
|
2
|
-
#
|
|
3
|
-
|
|
1
|
+
# This workflow will do a clean install of node dependencies,
|
|
2
|
+
# build the source code and run tests across different versions of node
|
|
3
|
+
# For more information see:
|
|
4
|
+
# https://help.github.com/actions/language-and-framework-guides/
|
|
5
|
+
# using-nodejs-with-github-actions
|
|
6
|
+
---
|
|
4
7
|
name: Node.js CI
|
|
5
8
|
|
|
6
9
|
on:
|
|
7
10
|
push:
|
|
8
|
-
branches: [
|
|
11
|
+
branches: [master]
|
|
9
12
|
pull_request:
|
|
10
|
-
branches: [
|
|
13
|
+
branches: [master]
|
|
11
14
|
|
|
12
15
|
jobs:
|
|
13
16
|
build:
|
|
14
17
|
|
|
15
18
|
runs-on: ubuntu-latest
|
|
16
19
|
|
|
20
|
+
services:
|
|
21
|
+
redis:
|
|
22
|
+
image: redis:latest
|
|
23
|
+
ports:
|
|
24
|
+
- 6379:6379
|
|
25
|
+
postgres:
|
|
26
|
+
image: postgres:latest
|
|
27
|
+
env:
|
|
28
|
+
POSTGRES_USER: user
|
|
29
|
+
POSTGRES_PASSWORD: password
|
|
30
|
+
POSTGRES_DB: naturaldb
|
|
31
|
+
POSTGRES_HOST: localhost
|
|
32
|
+
POSTGRES_PORT: 5432
|
|
33
|
+
POSTGRES_TABLE: naturaltable
|
|
34
|
+
ports:
|
|
35
|
+
- 5432:5432
|
|
36
|
+
memcached:
|
|
37
|
+
image: memcached:latest
|
|
38
|
+
ports:
|
|
39
|
+
- 11211:11211
|
|
40
|
+
mongodb:
|
|
41
|
+
image: mongo:latest
|
|
42
|
+
ports:
|
|
43
|
+
- 27017:27017
|
|
44
|
+
|
|
17
45
|
strategy:
|
|
18
46
|
matrix:
|
|
19
47
|
node-version: [16.x, 18.x, 20.x]
|
|
20
|
-
# See supported Node.js release schedule at
|
|
48
|
+
# See supported Node.js release schedule at
|
|
49
|
+
#https://nodejs.org/en/about/releases/
|
|
21
50
|
|
|
22
51
|
steps:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
52
|
+
- name: Checkout code
|
|
53
|
+
uses: actions/checkout@v2
|
|
54
|
+
|
|
55
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
56
|
+
uses: actions/setup-node@v4
|
|
57
|
+
with:
|
|
58
|
+
node-version: ${{ matrix.node-version }}
|
|
59
|
+
|
|
60
|
+
- name: Clean install
|
|
61
|
+
run: npm ci
|
|
62
|
+
|
|
63
|
+
- name: Run tests
|
|
64
|
+
run: npm run test
|
|
65
|
+
|
|
66
|
+
- name: Run IO tests
|
|
67
|
+
run: npm run test_io
|
|
68
|
+
|
|
69
|
+
- name: Run Istanbul coverage
|
|
70
|
+
run: npm run coverage
|
|
71
|
+
|
|
72
|
+
# Save coverage report in Coveralls
|
|
73
|
+
- name: Coveralls
|
|
74
|
+
uses: coverallsapp/github-action@master
|
|
75
|
+
with:
|
|
76
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -52,6 +52,11 @@ class BayesClassifier extends Classifier {
|
|
|
52
52
|
}
|
|
53
53
|
})
|
|
54
54
|
}
|
|
55
|
+
|
|
56
|
+
static async loadFrom (key, stemmer, storageBackend) {
|
|
57
|
+
const classifier = await Classifier.loadFrom(key, storageBackend)
|
|
58
|
+
return BayesClassifier.restore(classifier, stemmer)
|
|
59
|
+
}
|
|
55
60
|
}
|
|
56
61
|
|
|
57
62
|
module.exports = BayesClassifier
|
|
@@ -164,6 +164,16 @@ class Classifier extends EventEmitter {
|
|
|
164
164
|
})
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
+
async saveTo (storageBackend) {
|
|
168
|
+
return await storageBackend.store(this)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
static async loadFrom (key, storageBackend) {
|
|
172
|
+
const obj = await storageBackend.retrieve(key)
|
|
173
|
+
Object.setPrototypeOf(obj, Classifier.prototype)
|
|
174
|
+
return obj
|
|
175
|
+
}
|
|
176
|
+
|
|
167
177
|
setOptions (options) {
|
|
168
178
|
this.keepStops = !!(options.keepStops)
|
|
169
179
|
}
|
|
@@ -42,15 +42,20 @@ class LogisticRegressionClassifier extends Classifier {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
static load (filename, stemmer, callback) {
|
|
45
|
-
Classifier.load(filename,
|
|
45
|
+
Classifier.load(filename, (err, classifier) => {
|
|
46
46
|
if (err) {
|
|
47
47
|
callback(err)
|
|
48
48
|
} else {
|
|
49
|
-
callback(err,
|
|
49
|
+
callback(err, LogisticRegressionClassifier.restore(classifier, stemmer))
|
|
50
50
|
}
|
|
51
51
|
})
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
static async loadFrom (key, stemmer, storageBackend) {
|
|
55
|
+
const classifier = await Classifier.loadFrom(key, storageBackend)
|
|
56
|
+
return LogisticRegressionClassifier.restore(classifier, stemmer)
|
|
57
|
+
}
|
|
58
|
+
|
|
54
59
|
train () {
|
|
55
60
|
// we need to reset the training state because logistic regression
|
|
56
61
|
// needs its matricies to have their widths synced, etc.
|
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2024, Hugo W.L. ter Doest
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in
|
|
12
|
+
all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
20
|
+
THE SOFTWARE.
|
|
21
|
+
*/
|
|
22
|
+
|
|
1
23
|
require('dotenv').config()
|
|
2
24
|
const { v4: uuidv4 } = require('uuid')
|
|
3
25
|
const fs = require('fs').promises
|
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2024, Hugo W.L. ter Doest
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in
|
|
12
|
+
all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
20
|
+
THE SOFTWARE.
|
|
21
|
+
*/
|
|
22
|
+
|
|
1
23
|
const { v4: uuidv4 } = require('uuid')
|
|
2
24
|
require('dotenv').config()
|
|
3
25
|
const memjs = require('memjs')
|
|
@@ -1,14 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2024, Hugo W.L. ter Doest
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in
|
|
12
|
+
all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
20
|
+
THE SOFTWARE.
|
|
21
|
+
*/
|
|
22
|
+
|
|
1
23
|
require('dotenv').config()
|
|
2
24
|
const mongoose = require('mongoose')
|
|
3
25
|
const mongoDBConnectionString = 'mongodb://' + process.env.MONGO_HOST + ':' +
|
|
4
26
|
process.env.MONGO_PORT + '/' + process.env.MONGO_DATABASE
|
|
27
|
+
const objectModelName = process.env.MONGO_OBJECTMODEL
|
|
5
28
|
|
|
6
29
|
class MongoDBPlugin {
|
|
7
30
|
constructor () {
|
|
8
31
|
mongoose.connect(mongoDBConnectionString, {})
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
32
|
+
|
|
33
|
+
if (!mongoose.models[objectModelName]) {
|
|
34
|
+
// We do not enforce a schema with MongoDB
|
|
35
|
+
this.ObjectModel = mongoose.model(objectModelName, new mongoose.Schema({},
|
|
36
|
+
{ strict: false, versionKey: false }))
|
|
37
|
+
} else {
|
|
38
|
+
this.ObjectModel = mongoose.models[objectModelName]
|
|
39
|
+
}
|
|
12
40
|
}
|
|
13
41
|
|
|
14
42
|
async store (object, options) {
|
|
@@ -1,54 +1,71 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2024, Hugo W.L. ter Doest
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in
|
|
12
|
+
all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
20
|
+
THE SOFTWARE.
|
|
21
|
+
*/
|
|
22
|
+
|
|
1
23
|
const postgres = require('pg')
|
|
2
24
|
require('dotenv').config()
|
|
3
25
|
|
|
4
26
|
class PostgresPlugin {
|
|
5
27
|
constructor () {
|
|
6
|
-
this.
|
|
28
|
+
this.postgresClient = null
|
|
7
29
|
}
|
|
8
30
|
|
|
9
31
|
async configPostgres () {
|
|
10
32
|
// Initialize connection to Postgres
|
|
11
33
|
const client = new postgres.Client({
|
|
12
|
-
user: process.env.
|
|
13
|
-
host: process.env.
|
|
14
|
-
database: process.env.
|
|
15
|
-
password: process.env.
|
|
16
|
-
port: process.env.
|
|
34
|
+
user: process.env.POSTGRES_USER,
|
|
35
|
+
host: process.env.POSTGRES_HOST,
|
|
36
|
+
database: process.env.POSTGRES_DB,
|
|
37
|
+
password: process.env.POSTGRES_PASSWORD,
|
|
38
|
+
port: process.env.POSTGRES_PORT
|
|
17
39
|
})
|
|
18
40
|
this.postgresClient = client
|
|
19
|
-
this.postgresTableName = process.env.
|
|
41
|
+
this.postgresTableName = process.env.POSTGRES_TABLE
|
|
42
|
+
|
|
20
43
|
// Connect to the database
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
44
|
+
await client.connect()
|
|
45
|
+
|
|
46
|
+
// Call the function to create the table
|
|
47
|
+
await this.createTableIfNotExists(client, this.postgresTableName)
|
|
48
|
+
|
|
49
|
+
// Don't forget to close the connection when done
|
|
50
|
+
// await client.end()
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Function to create the table
|
|
54
|
+
async createTableIfNotExists (client, tableName) {
|
|
55
|
+
// Check if the table exists
|
|
56
|
+
const query = `SELECT to_regclass('${tableName}')`
|
|
57
|
+
const result = await client.query(query)
|
|
33
58
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
// We use JSONB (binary JSON format of Postgres) to store objects
|
|
59
|
+
if (result.rows[0].to_regclass === null) {
|
|
60
|
+
// Table does not exist, create it
|
|
37
61
|
const createTableQuery = `
|
|
38
|
-
CREATE TABLE
|
|
62
|
+
CREATE TABLE ${tableName} (
|
|
39
63
|
id SERIAL PRIMARY KEY,
|
|
40
64
|
data JSONB
|
|
41
65
|
);
|
|
42
66
|
`
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
.then(() => {
|
|
46
|
-
resolve()
|
|
47
|
-
})
|
|
48
|
-
.catch(error => {
|
|
49
|
-
reject(error)
|
|
50
|
-
})
|
|
51
|
-
})
|
|
67
|
+
await client.query(createTableQuery)
|
|
68
|
+
console.log('table created')
|
|
52
69
|
}
|
|
53
70
|
}
|
|
54
71
|
|
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2024, Hugo W.L. ter Doest
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in
|
|
12
|
+
all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
20
|
+
THE SOFTWARE.
|
|
21
|
+
*/
|
|
22
|
+
|
|
1
23
|
const { v4: uuidv4 } = require('uuid')
|
|
2
24
|
require('dotenv').config()
|
|
3
25
|
const redis = require('redis')
|
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2024, Hugo W.L. ter Doest
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in
|
|
12
|
+
all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
20
|
+
THE SOFTWARE.
|
|
21
|
+
*/
|
|
22
|
+
|
|
1
23
|
const PostgresPlugin = require('./Postgres')
|
|
2
24
|
const MongoDBPlugin = require('./MongoDB')
|
|
3
25
|
const RedisPlugin = require('./Redis')
|
|
@@ -38,6 +60,7 @@ class StorageBackend {
|
|
|
38
60
|
switch (storageType) {
|
|
39
61
|
case STORAGE_TYPES.POSTGRES:
|
|
40
62
|
this.client = new PostgresPlugin()
|
|
63
|
+
await this.client.configPostgres()
|
|
41
64
|
break
|
|
42
65
|
case STORAGE_TYPES.REDIS:
|
|
43
66
|
this.client = new RedisPlugin()
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "natural",
|
|
3
3
|
"description": "General natural language (tokenizing, stemming (English, Russian, Spanish), part-of-speech tagging, sentiment analysis, classification, inflection, phonetics, tfidf, WordNet, jaro-winkler, Levenshtein distance, Dice's Coefficient) facilities for node.",
|
|
4
|
-
"version": "6.
|
|
4
|
+
"version": "6.12.0",
|
|
5
5
|
"homepage": "https://github.com/NaturalNode/natural",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"scripts": {
|
|
65
65
|
"benchmark": "node benchmarks",
|
|
66
66
|
"clean": "rimraf *~ #* *classifier.json",
|
|
67
|
-
"test": "NODE_PATH=. node ./node_modules/jasmine/bin/jasmine.js
|
|
68
|
-
"coverage": "nyc --reporter=lcov npm test",
|
|
67
|
+
"test": "NODE_PATH=. node ./node_modules/jasmine/bin/jasmine.js --random=false spec/*_spec.js",
|
|
68
|
+
"coverage": "nyc --reporter=lcov npm run test && nyc npm run test_io",
|
|
69
69
|
"test_io": "NODE_PATH=. node ./node_modules/jasmine/bin/jasmine.js --random=false io_spec/*_spec.js",
|
|
70
70
|
"test_browser": "NODE_PATH=. node ./node_modules/gulp/bin/gulp.js",
|
|
71
71
|
"lint": "eslint . --ext .ts",
|
package/tsconfig.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"attr1":"val1","attr2":"val2"}
|