theprogrammablemind 7.2.2 → 7.2.3-beta.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/demo.js +62 -0
- package/demo.test.json +2 -0
- package/package.json +37 -35
package/demo.js
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
const { Config, knowledgeModule, where } = require('entodicton')
|
2
|
+
|
3
|
+
/*
|
4
|
+
This demo does not use the knowledge modules and just shows the
|
5
|
+
basic API.
|
6
|
+
*/
|
7
|
+
|
8
|
+
let config = {
|
9
|
+
name: 'demo',
|
10
|
+
operators: [
|
11
|
+
'((i) [went] ([to] (<the> store)))',
|
12
|
+
],
|
13
|
+
bridges: [
|
14
|
+
{
|
15
|
+
id: "the",
|
16
|
+
level: 0,
|
17
|
+
bridge: "{ ...after, determiner: 'the' }"
|
18
|
+
},
|
19
|
+
{
|
20
|
+
id: "to",
|
21
|
+
level: 0,
|
22
|
+
bridge: "{ ...next(operator), after: after[0] }"
|
23
|
+
},
|
24
|
+
{
|
25
|
+
id: "went",
|
26
|
+
level: 0,
|
27
|
+
generatorp: ({context, gp}) => `${gp(context.actor)} went to ${gp(context.place)}`,
|
28
|
+
bridge: "{ action: 'go', marker: 'went', actor: before[0], place: after[0].after }"
|
29
|
+
},
|
30
|
+
],
|
31
|
+
generators: [
|
32
|
+
{
|
33
|
+
match: ({context}) => context.isResponse,
|
34
|
+
apply: ({context}) => context.evalue
|
35
|
+
},
|
36
|
+
{
|
37
|
+
match: ({context}) => context.marker == 'unknown',
|
38
|
+
apply: ({context}) => context.text
|
39
|
+
}
|
40
|
+
],
|
41
|
+
semantics: [
|
42
|
+
{
|
43
|
+
match: ({context}) => context.marker == 'went',
|
44
|
+
apply: ({context}) => {
|
45
|
+
// same way as kms that I wrote. you dont have to do this though
|
46
|
+
context.isResponse = true
|
47
|
+
context.evalue = 'okay, sounds good'
|
48
|
+
}
|
49
|
+
}
|
50
|
+
]
|
51
|
+
};
|
52
|
+
|
53
|
+
config = new Config(config, module)
|
54
|
+
knowledgeModule({
|
55
|
+
module,
|
56
|
+
config,
|
57
|
+
description: 'demo for readme',
|
58
|
+
test: {
|
59
|
+
name: './demo.test.json',
|
60
|
+
contents: require('./demo.test.json')
|
61
|
+
},
|
62
|
+
})
|
package/demo.test.json
ADDED
package/package.json
CHANGED
@@ -1,33 +1,39 @@
|
|
1
1
|
{
|
2
|
-
"
|
3
|
-
"name": "theprogrammablemind",
|
2
|
+
"main": "index.js",
|
4
3
|
"author": "dev@thinktelligence.com",
|
4
|
+
"dependencies": {
|
5
|
+
"readline": "^1.3.0",
|
6
|
+
"uuid": "^8.3.2",
|
7
|
+
"fs": "0.0.1-security",
|
8
|
+
"json-stable-stringify": "^1.0.1",
|
9
|
+
"node-fetch": "^2.6.1",
|
10
|
+
"base-64": "^1.0.0",
|
11
|
+
"lodash": "^4.17.20",
|
12
|
+
"sort-json": "^2.0.0",
|
13
|
+
"scriptjs": "^2.5.9",
|
14
|
+
"deep-equal": "^2.0.4",
|
15
|
+
"underscore": "^1.13.1",
|
16
|
+
"json-diff": "^1.0.3"
|
17
|
+
},
|
18
|
+
"name": "theprogrammablemind",
|
19
|
+
"license": "ISC",
|
5
20
|
"scripts": {
|
6
|
-
"test:watch": "npm run test -- --watch",
|
7
|
-
"to:debug": "node inspect node_modules/.bin/jest --runInBand -t NEO",
|
8
21
|
"test": "jest --config ./jest.config.json",
|
9
|
-
"tod": "node inspect node_modules/.bin/jest --runInBand -t NEO",
|
10
|
-
"lint:fix": "eslint \"**/*.js\" --fix",
|
11
|
-
"lint": "eslint \"**/*.js\"",
|
12
22
|
"to": "node node_modules/.bin/jest --runInBand -t NEO",
|
13
|
-
"
|
14
|
-
|
15
|
-
|
16
|
-
"
|
17
|
-
"
|
18
|
-
"
|
19
|
-
"jest": "^26.6.3",
|
20
|
-
"@typescript-eslint/parser": "^4.28.4",
|
21
|
-
"eslint-plugin-promise": "^5.1.0",
|
22
|
-
"eslint": "^7.31.0",
|
23
|
-
"eslint-plugin-node": "^11.1.0"
|
23
|
+
"to:debug": "node inspect node_modules/.bin/jest --runInBand -t NEO",
|
24
|
+
"lint": "eslint \"**/*.js\"",
|
25
|
+
"test:debug": "node inspect node_modules/.bin/jest --runInBand --config ./jest.config.json",
|
26
|
+
"tod": "node inspect node_modules/.bin/jest --runInBand -t NEO",
|
27
|
+
"test:watch": "npm run test -- --watch",
|
28
|
+
"lint:fix": "eslint \"**/*.js\" --fix"
|
24
29
|
},
|
25
|
-
"version": "7.2.
|
26
|
-
"main": "index.js",
|
30
|
+
"version": "7.2.3-beta.0",
|
27
31
|
"files": [
|
28
32
|
"client.js",
|
29
33
|
"index.js",
|
30
34
|
"lines.js",
|
35
|
+
"demo.js",
|
36
|
+
"demo.test.json",
|
31
37
|
"src/helpers.js",
|
32
38
|
"src/flatten.js",
|
33
39
|
"src/unflatten.js",
|
@@ -37,6 +43,16 @@
|
|
37
43
|
"src/generators.js",
|
38
44
|
"src/semantics.js"
|
39
45
|
],
|
46
|
+
"devDependencies": {
|
47
|
+
"eslint-plugin-import": "^2.23.4",
|
48
|
+
"eslint": "^7.31.0",
|
49
|
+
"jest": "^26.6.3",
|
50
|
+
"@typescript-eslint/eslint-plugin": "^4.28.4",
|
51
|
+
"@typescript-eslint/parser": "^4.28.4",
|
52
|
+
"eslint-plugin-node": "^11.1.0",
|
53
|
+
"eslint-plugin-promise": "^5.1.0",
|
54
|
+
"eslint-config-standard": "^16.0.3"
|
55
|
+
},
|
40
56
|
"keywords": [
|
41
57
|
"NLP",
|
42
58
|
"NLU",
|
@@ -45,19 +61,5 @@
|
|
45
61
|
"natural language generation",
|
46
62
|
"natural language understanding",
|
47
63
|
"chatbot"
|
48
|
-
]
|
49
|
-
"dependencies": {
|
50
|
-
"base-64": "^1.0.0",
|
51
|
-
"json-stable-stringify": "^1.0.1",
|
52
|
-
"json-diff": "^1.0.3",
|
53
|
-
"scriptjs": "^2.5.9",
|
54
|
-
"deep-equal": "^2.0.4",
|
55
|
-
"underscore": "^1.13.1",
|
56
|
-
"readline": "^1.3.0",
|
57
|
-
"sort-json": "^2.0.0",
|
58
|
-
"lodash": "^4.17.20",
|
59
|
-
"node-fetch": "^2.6.1",
|
60
|
-
"fs": "0.0.1-security",
|
61
|
-
"uuid": "^8.3.2"
|
62
|
-
}
|
64
|
+
]
|
63
65
|
}
|