theprogrammablemind 7.2.3-beta.1 → 7.2.3-beta.3
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/package.json +43 -43
- package/readme +37 -25
package/package.json
CHANGED
@@ -1,39 +1,4 @@
|
|
1
1
|
{
|
2
|
-
"dependencies": {
|
3
|
-
"uuid": "^8.3.2",
|
4
|
-
"deep-equal": "^2.0.4",
|
5
|
-
"scriptjs": "^2.5.9",
|
6
|
-
"fs": "0.0.1-security",
|
7
|
-
"lodash": "^4.17.20",
|
8
|
-
"readline": "^1.3.0",
|
9
|
-
"underscore": "^1.13.1",
|
10
|
-
"json-stable-stringify": "^1.0.1",
|
11
|
-
"node-fetch": "^2.6.1",
|
12
|
-
"base-64": "^1.0.0",
|
13
|
-
"sort-json": "^2.0.0",
|
14
|
-
"json-diff": "^1.0.3"
|
15
|
-
},
|
16
|
-
"license": "ISC",
|
17
|
-
"scripts": {
|
18
|
-
"test:watch": "npm run test -- --watch",
|
19
|
-
"to": "node node_modules/.bin/jest --runInBand -t NEO",
|
20
|
-
"test": "jest --config ./jest.config.json",
|
21
|
-
"test:debug": "node inspect node_modules/.bin/jest --runInBand --config ./jest.config.json",
|
22
|
-
"to:debug": "node inspect node_modules/.bin/jest --runInBand -t NEO",
|
23
|
-
"lint": "eslint \"**/*.js\"",
|
24
|
-
"tod": "node inspect node_modules/.bin/jest --runInBand -t NEO",
|
25
|
-
"lint:fix": "eslint \"**/*.js\" --fix"
|
26
|
-
},
|
27
|
-
"version": "7.2.3-beta.1",
|
28
|
-
"keywords": [
|
29
|
-
"NLP",
|
30
|
-
"NLU",
|
31
|
-
"NLC",
|
32
|
-
"natural language processing",
|
33
|
-
"natural language generation",
|
34
|
-
"natural language understanding",
|
35
|
-
"chatbot"
|
36
|
-
],
|
37
2
|
"files": [
|
38
3
|
"client.js",
|
39
4
|
"index.js",
|
@@ -49,17 +14,52 @@
|
|
49
14
|
"src/generators.js",
|
50
15
|
"src/semantics.js"
|
51
16
|
],
|
52
|
-
"
|
53
|
-
|
17
|
+
"scripts": {
|
18
|
+
"test": "jest --config ./jest.config.json",
|
19
|
+
"lint": "eslint \"**/*.js\"",
|
20
|
+
"lint:fix": "eslint \"**/*.js\" --fix",
|
21
|
+
"to:debug": "node inspect node_modules/.bin/jest --runInBand -t NEO",
|
22
|
+
"test:debug": "node inspect node_modules/.bin/jest --runInBand --config ./jest.config.json",
|
23
|
+
"tod": "node inspect node_modules/.bin/jest --runInBand -t NEO",
|
24
|
+
"to": "node node_modules/.bin/jest --runInBand -t NEO",
|
25
|
+
"test:watch": "npm run test -- --watch"
|
26
|
+
},
|
54
27
|
"name": "theprogrammablemind",
|
28
|
+
"license": "ISC",
|
29
|
+
"keywords": [
|
30
|
+
"NLP",
|
31
|
+
"NLU",
|
32
|
+
"NLC",
|
33
|
+
"natural language processing",
|
34
|
+
"natural language generation",
|
35
|
+
"natural language understanding",
|
36
|
+
"chatbot"
|
37
|
+
],
|
38
|
+
"main": "index.js",
|
39
|
+
"version": "7.2.3-beta.3",
|
55
40
|
"devDependencies": {
|
56
|
-
"eslint-plugin-import": "^2.23.4",
|
57
|
-
"eslint-plugin-promise": "^5.1.0",
|
58
|
-
"eslint-config-standard": "^16.0.3",
|
59
|
-
"jest": "^26.6.3",
|
60
41
|
"@typescript-eslint/eslint-plugin": "^4.28.4",
|
61
42
|
"eslint": "^7.31.0",
|
62
43
|
"eslint-plugin-node": "^11.1.0",
|
63
|
-
"@typescript-eslint/parser": "^4.28.4"
|
64
|
-
|
44
|
+
"@typescript-eslint/parser": "^4.28.4",
|
45
|
+
"eslint-plugin-import": "^2.23.4",
|
46
|
+
"eslint-plugin-promise": "^5.1.0",
|
47
|
+
"eslint-config-standard": "^16.0.3",
|
48
|
+
"jest": "^26.6.3"
|
49
|
+
},
|
50
|
+
"dependencies": {
|
51
|
+
"json-diff": "^1.0.3",
|
52
|
+
"underscore": "^1.13.1",
|
53
|
+
"deep-equal": "^2.0.4",
|
54
|
+
"uuid": "^8.3.2",
|
55
|
+
"fs": "0.0.1-security",
|
56
|
+
"sort-json": "^2.0.0",
|
57
|
+
"lodash": "^4.17.20",
|
58
|
+
"node-fetch": "^2.6.1",
|
59
|
+
"json-stable-stringify": "^1.0.1",
|
60
|
+
"scriptjs": "^2.5.9",
|
61
|
+
"readline": "^1.3.0",
|
62
|
+
"base-64": "^1.0.0"
|
63
|
+
},
|
64
|
+
"author": "dev@thinktelligence.com"
|
65
65
|
}
|
package/readme
CHANGED
@@ -6,57 +6,69 @@ generalized operator precedence parser and neural nets.
|
|
6
6
|
|
7
7
|
## Demo Walkthough
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
This is the input
|
9
|
+
A simple demo program can be run by installing theprogrammablemind
|
10
|
+
package and the running this command.
|
13
11
|
|
14
12
|
```
|
15
|
-
|
13
|
+
dev@devlaptop:~/temp/myProject$ node node_modules/theprogrammablemind/demo -q 'i went to the store' -d
|
14
|
+
```
|
16
15
|
|
17
|
-
|
18
|
-
{ "id": "the", "level": 0, "bridge": "{ ...after, determiner: 'the' }" },
|
19
|
-
{ "id": "to", "level": 0, "bridge": "{ ...next(operator), after: after[0] }" },
|
20
|
-
{ "id": "went", "level": 0, "bridge": "{ ...squish(after[0]), ...next(operator) }" },
|
21
|
-
{ "id": "went", "level": 1, "bridge": "{ ...next(operator), who: before[0] }" },
|
22
|
-
{ "id": "went", "level": 2, "bridge": "{ action: 'go', marker: 'go', actor: operator.who, place: operator.to }" },
|
23
|
-
]
|
16
|
+
This is the input
|
24
17
|
|
25
|
-
|
18
|
+
```
|
19
|
+
operators: [
|
20
|
+
'((i) [went] ([to] (<the> store)))',
|
21
|
+
],
|
22
|
+
bridges: [
|
23
|
+
{
|
24
|
+
id: "the",
|
25
|
+
level: 0,
|
26
|
+
bridge: "{ ...after, determiner: 'the' }"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
id: "to",
|
30
|
+
level: 0,
|
31
|
+
bridge: "{ ...next(operator), after: after[0] }"
|
32
|
+
},
|
33
|
+
{
|
34
|
+
id: "went",
|
35
|
+
level: 0,
|
36
|
+
generatorp: ({context, gp}) => `${gp(context.actor)} went to ${gp(context.place)}`,
|
37
|
+
bridge: "{ action: 'go', marker: 'went', actor: before[0], place: after[0].after }"
|
38
|
+
},
|
39
|
+
],
|
26
40
|
```
|
27
41
|
|
28
42
|
## Operators
|
29
43
|
|
30
|
-
Operators is used to do two things: specify the priority of operators and the argument structure.
|
31
|
-
|
32
|
-
of priorities can be made
|
44
|
+
Operators is used to do two things: specify the priority of operators and the argument structure.
|
45
|
+
The idea here is to give sample sentences that are marked up so a graph
|
46
|
+
of priorities can be made. The '[]' or '<>' is used to mark operators. In a generalized
|
33
47
|
operator precedence parser, the result of a apply an operator can be another operator. The '[]' means
|
34
|
-
there is a next
|
48
|
+
there is a next level of the operator. The '<>' means there is not. The operators that this example defines are
|
35
49
|
|
36
50
|
```
|
37
51
|
Operator/Level Arity
|
38
52
|
the/0 prefix operator
|
39
53
|
to/0 prefix operator
|
40
|
-
went/0
|
41
|
-
went/1 postfix operator
|
54
|
+
went/0 infix operator
|
42
55
|
```
|
43
56
|
|
44
57
|
The priorities defined in order of application are
|
45
58
|
|
46
59
|
```
|
47
|
-
the/
|
60
|
+
the/0 > to/0 > went/0
|
48
61
|
```
|
49
62
|
|
50
63
|
|
51
|
-
'
|
52
|
-
sentences such as "I went to the store bought a coffee and chips and jumped on the bus
|
64
|
+
'went' is defined as infix for the example but defined as a prefix opertator that evaluates to postfix operator
|
65
|
+
would allow sentences such as "I went to the store bought a coffee and chips and jumped on the bus".
|
53
66
|
|
54
67
|
## Bridges
|
55
68
|
|
56
69
|
This works by combining contexts. Each context has a marker which indicates that is the operator. The
|
57
|
-
bridge
|
58
|
-
support multiple languages mapping ultimately to the same JSON.
|
59
|
-
before in the v4 design seen in the youtube video. The syntax is
|
70
|
+
bridge is used to specify how to combine contexts to get the next context. This abstraction
|
71
|
+
support multiple languages mapping ultimately to the same JSON. The basic components are
|
60
72
|
|
61
73
|
```
|
62
74
|
{
|