theprogrammablemind 7.2.3 → 7.3.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 +1 -1
- package/package.json +39 -39
- package/readme +46 -32
package/demo.js
CHANGED
package/package.json
CHANGED
@@ -1,42 +1,4 @@
|
|
1
1
|
{
|
2
|
-
"license": "ISC",
|
3
|
-
"scripts": {
|
4
|
-
"tod": "node inspect node_modules/.bin/jest --runInBand -t NEO",
|
5
|
-
"to": "node node_modules/.bin/jest --runInBand -t NEO",
|
6
|
-
"lint": "eslint \"**/*.js\"",
|
7
|
-
"test:debug": "node inspect node_modules/.bin/jest --runInBand --config ./jest.config.json",
|
8
|
-
"test:watch": "npm run test -- --watch",
|
9
|
-
"test": "jest --config ./jest.config.json",
|
10
|
-
"lint:fix": "eslint \"**/*.js\" --fix",
|
11
|
-
"to:debug": "node inspect node_modules/.bin/jest --runInBand -t NEO"
|
12
|
-
},
|
13
|
-
"main": "index.js",
|
14
|
-
"devDependencies": {
|
15
|
-
"eslint-plugin-node": "^11.1.0",
|
16
|
-
"eslint": "^7.31.0",
|
17
|
-
"jest": "^26.6.3",
|
18
|
-
"eslint-config-standard": "^16.0.3",
|
19
|
-
"eslint-plugin-import": "^2.23.4",
|
20
|
-
"@typescript-eslint/parser": "^4.28.4",
|
21
|
-
"@typescript-eslint/eslint-plugin": "^4.28.4",
|
22
|
-
"eslint-plugin-promise": "^5.1.0"
|
23
|
-
},
|
24
|
-
"dependencies": {
|
25
|
-
"underscore": "^1.13.1",
|
26
|
-
"deep-equal": "^2.0.4",
|
27
|
-
"node-fetch": "^2.6.1",
|
28
|
-
"lodash": "^4.17.20",
|
29
|
-
"uuid": "^8.3.2",
|
30
|
-
"scriptjs": "^2.5.9",
|
31
|
-
"base-64": "^1.0.0",
|
32
|
-
"sort-json": "^2.0.0",
|
33
|
-
"json-diff": "^1.0.3",
|
34
|
-
"json-stable-stringify": "^1.0.1",
|
35
|
-
"fs": "0.0.1-security",
|
36
|
-
"readline": "^1.3.0"
|
37
|
-
},
|
38
|
-
"author": "dev@thinktelligence.com",
|
39
|
-
"name": "theprogrammablemind",
|
40
2
|
"keywords": [
|
41
3
|
"NLP",
|
42
4
|
"NLU",
|
@@ -46,6 +8,17 @@
|
|
46
8
|
"natural language understanding",
|
47
9
|
"chatbot"
|
48
10
|
],
|
11
|
+
"devDependencies": {
|
12
|
+
"@typescript-eslint/parser": "^4.28.4",
|
13
|
+
"jest": "^26.6.3",
|
14
|
+
"eslint": "^7.31.0",
|
15
|
+
"eslint-plugin-node": "^11.1.0",
|
16
|
+
"eslint-plugin-import": "^2.23.4",
|
17
|
+
"eslint-plugin-promise": "^5.1.0",
|
18
|
+
"eslint-config-standard": "^16.0.3",
|
19
|
+
"@typescript-eslint/eslint-plugin": "^4.28.4"
|
20
|
+
},
|
21
|
+
"name": "theprogrammablemind",
|
49
22
|
"files": [
|
50
23
|
"client.js",
|
51
24
|
"index.js",
|
@@ -61,5 +34,32 @@
|
|
61
34
|
"src/generators.js",
|
62
35
|
"src/semantics.js"
|
63
36
|
],
|
64
|
-
"version": "7.
|
37
|
+
"version": "7.3.0",
|
38
|
+
"author": "dev@thinktelligence.com",
|
39
|
+
"dependencies": {
|
40
|
+
"base-64": "^1.0.0",
|
41
|
+
"json-stable-stringify": "^1.0.1",
|
42
|
+
"uuid": "^8.3.2",
|
43
|
+
"readline": "^1.3.0",
|
44
|
+
"scriptjs": "^2.5.9",
|
45
|
+
"node-fetch": "^2.6.1",
|
46
|
+
"fs": "0.0.1-security",
|
47
|
+
"sort-json": "^2.0.0",
|
48
|
+
"deep-equal": "^2.0.4",
|
49
|
+
"lodash": "^4.17.20",
|
50
|
+
"underscore": "^1.13.1",
|
51
|
+
"json-diff": "^1.0.3"
|
52
|
+
},
|
53
|
+
"main": "index.js",
|
54
|
+
"license": "ISC",
|
55
|
+
"scripts": {
|
56
|
+
"test:watch": "npm run test -- --watch",
|
57
|
+
"lint:fix": "eslint \"**/*.js\" --fix",
|
58
|
+
"test": "jest --config ./jest.config.json",
|
59
|
+
"to:debug": "node inspect node_modules/.bin/jest --runInBand -t NEO",
|
60
|
+
"lint": "eslint \"**/*.js\"",
|
61
|
+
"test:debug": "node inspect node_modules/.bin/jest --runInBand --config ./jest.config.json",
|
62
|
+
"to": "node node_modules/.bin/jest --runInBand -t NEO",
|
63
|
+
"tod": "node inspect node_modules/.bin/jest --runInBand -t NEO"
|
64
|
+
}
|
65
65
|
}
|
package/readme
CHANGED
@@ -1,62 +1,73 @@
|
|
1
1
|
# The Programmable Mind (aka Entodicton)
|
2
2
|
|
3
3
|
This is the client for a server that processes natural language statements
|
4
|
-
into JSON. Instead of using grammar based parser,
|
5
|
-
generalized operator precedence parser
|
4
|
+
into JSON which can be paraphrase or acted upon. Instead of using grammar based parser,
|
5
|
+
the server uses a generalized operator precedence parser.
|
6
6
|
|
7
7
|
## Demo Walkthough
|
8
8
|
|
9
|
-
|
10
|
-
program against the API.
|
11
|
-
|
12
|
-
This is the input
|
9
|
+
A simple demo program can be run by installing this package and the running this command.
|
13
10
|
|
14
11
|
```
|
15
|
-
|
12
|
+
dev@devlaptop:~/temp/myProject$ node node_modules/theprogrammablemind/demo -q 'i went to the store' -d
|
13
|
+
```
|
16
14
|
|
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
|
-
]
|
15
|
+
This is the input
|
24
16
|
|
25
|
-
|
17
|
+
```
|
18
|
+
operators: [
|
19
|
+
'((i) [went] ([to] (<the> store)))',
|
20
|
+
],
|
21
|
+
bridges: [
|
22
|
+
{
|
23
|
+
id: "the",
|
24
|
+
level: 0,
|
25
|
+
bridge: "{ ...after, determiner: 'the' }"
|
26
|
+
},
|
27
|
+
{
|
28
|
+
id: "to",
|
29
|
+
level: 0,
|
30
|
+
bridge: "{ ...next(operator), after: after[0] }"
|
31
|
+
},
|
32
|
+
{
|
33
|
+
id: "went",
|
34
|
+
level: 0,
|
35
|
+
generatorp: ({context, gp}) => `${gp(context.actor)} went to ${gp(context.place)}`,
|
36
|
+
bridge: "{ action: 'go', marker: 'went', actor: before[0], place: after[0].after }"
|
37
|
+
},
|
38
|
+
],
|
26
39
|
```
|
27
40
|
|
28
41
|
## Operators
|
29
42
|
|
30
|
-
Operators is used to do two things: specify the priority of operators and the argument structure.
|
31
|
-
|
32
|
-
of priorities can be made
|
43
|
+
Operators is used to do two things: specify the priority of operators and the argument structure.
|
44
|
+
The idea here is to give sample sentences that are marked up so a graph
|
45
|
+
of priorities can be made. The '[]' or '<>' is used to mark operators. In a generalized
|
33
46
|
operator precedence parser, the result of a apply an operator can be another operator. The '[]' means
|
34
|
-
there is a next
|
47
|
+
there is a next level of the operator. The '<>' means there is not. The operators that this example defines are
|
35
48
|
|
36
49
|
```
|
37
50
|
Operator/Level Arity
|
38
51
|
the/0 prefix operator
|
39
52
|
to/0 prefix operator
|
40
|
-
went/0
|
41
|
-
went/1 postfix operator
|
53
|
+
went/0 infix operator
|
42
54
|
```
|
43
55
|
|
44
56
|
The priorities defined in order of application are
|
45
57
|
|
46
58
|
```
|
47
|
-
the/
|
59
|
+
the/0 > to/0 > went/0
|
48
60
|
```
|
49
61
|
|
50
62
|
|
51
|
-
'
|
52
|
-
sentences such as "I went to the store bought a coffee and chips and jumped on the bus
|
63
|
+
'went' is defined as infix for the example but defined as a prefix operator that evaluates to postfix operator
|
64
|
+
would allow sentences such as "I went to the store bought a coffee and chips and jumped on the bus".
|
53
65
|
|
54
66
|
## Bridges
|
55
67
|
|
56
|
-
This works by combining contexts. Each context has a marker which indicates
|
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
|
68
|
+
This works by combining contexts. Each context has a marker which indicates what is the operator. The
|
69
|
+
bridge is used to specify how to combine contexts to get the next context. This abstraction
|
70
|
+
support multiple languages mapping ultimately to the same JSON. The basic components are
|
60
71
|
|
61
72
|
```
|
62
73
|
{
|
@@ -101,10 +112,6 @@ the result is
|
|
101
112
|
}
|
102
113
|
```
|
103
114
|
|
104
|
-
## Utterances
|
105
|
-
|
106
|
-
This is a list of statement that will be processed using the given definitions
|
107
|
-
|
108
115
|
## Priorities
|
109
116
|
|
110
117
|
If request fail to process correctly one of the main causes is operator ordering. The 'operators' definition is used to generate training data for the ordering neural net. Sometimes that is not enough. There is a 'priorities' property that can be used to supply additional training data. Priorties is a list of operators. The last operator it the preferred one. The logs show the order that operators were run in. If it wrong look for another message like
|
@@ -130,3 +137,10 @@ A generator is used to describe how to map json back to strings. This is an exam
|
|
130
137
|
The first part is a condition that is used to select the context. This example would match a context where the value 'marker' equals 'tankConcept' and the property 'number' is an number greater than zero. The second part can access properties in the context and generate a string. The access the properties 'number' and 'word' to generate a string.
|
131
138
|
|
132
139
|
List the default generators first. For example if you want English to be the default list the generator for English for and for other language with a language selector later.
|
140
|
+
|
141
|
+
# More
|
142
|
+
|
143
|
+
Videos with more details can be found at <a href=http://thinktelligence.com/kms>thinktelligence videos</a>
|
144
|
+
|
145
|
+
This is a list of statement that will be processed using the given definitions
|
146
|
+
|