theprogrammablemind 7.2.3-beta.1 → 7.2.3-beta.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.
Files changed (2) hide show
  1. package/package.json +43 -43
  2. package/readme +37 -25
package/package.json CHANGED
@@ -1,30 +1,58 @@
1
1
  {
2
+ "main": "index.js",
3
+ "author": "dev@thinktelligence.com",
4
+ "version": "7.2.3-beta.2",
5
+ "files": [
6
+ "client.js",
7
+ "index.js",
8
+ "lines.js",
9
+ "demo.js",
10
+ "demo.test.json",
11
+ "src/helpers.js",
12
+ "src/flatten.js",
13
+ "src/unflatten.js",
14
+ "src/config.js",
15
+ "src/copy.js",
16
+ "src/digraph.js",
17
+ "src/generators.js",
18
+ "src/semantics.js"
19
+ ],
2
20
  "dependencies": {
3
- "uuid": "^8.3.2",
4
- "deep-equal": "^2.0.4",
5
- "scriptjs": "^2.5.9",
6
- "fs": "0.0.1-security",
7
21
  "lodash": "^4.17.20",
8
22
  "readline": "^1.3.0",
9
- "underscore": "^1.13.1",
23
+ "sort-json": "^2.0.0",
24
+ "json-diff": "^1.0.3",
10
25
  "json-stable-stringify": "^1.0.1",
11
26
  "node-fetch": "^2.6.1",
27
+ "underscore": "^1.13.1",
12
28
  "base-64": "^1.0.0",
13
- "sort-json": "^2.0.0",
14
- "json-diff": "^1.0.3"
29
+ "scriptjs": "^2.5.9",
30
+ "deep-equal": "^2.0.4",
31
+ "fs": "0.0.1-security",
32
+ "uuid": "^8.3.2"
15
33
  },
16
- "license": "ISC",
34
+ "devDependencies": {
35
+ "eslint": "^7.31.0",
36
+ "eslint-config-standard": "^16.0.3",
37
+ "@typescript-eslint/parser": "^4.28.4",
38
+ "eslint-plugin-node": "^11.1.0",
39
+ "@typescript-eslint/eslint-plugin": "^4.28.4",
40
+ "eslint-plugin-import": "^2.23.4",
41
+ "jest": "^26.6.3",
42
+ "eslint-plugin-promise": "^5.1.0"
43
+ },
44
+ "name": "theprogrammablemind",
17
45
  "scripts": {
18
- "test:watch": "npm run test -- --watch",
19
46
  "to": "node node_modules/.bin/jest --runInBand -t NEO",
20
- "test": "jest --config ./jest.config.json",
21
47
  "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\"",
48
+ "lint:fix": "eslint \"**/*.js\" --fix",
49
+ "test:watch": "npm run test -- --watch",
50
+ "test": "jest --config ./jest.config.json",
24
51
  "tod": "node inspect node_modules/.bin/jest --runInBand -t NEO",
25
- "lint:fix": "eslint \"**/*.js\" --fix"
52
+ "lint": "eslint \"**/*.js\"",
53
+ "to:debug": "node inspect node_modules/.bin/jest --runInBand -t NEO"
26
54
  },
27
- "version": "7.2.3-beta.1",
55
+ "license": "ISC",
28
56
  "keywords": [
29
57
  "NLP",
30
58
  "NLU",
@@ -33,33 +61,5 @@
33
61
  "natural language generation",
34
62
  "natural language understanding",
35
63
  "chatbot"
36
- ],
37
- "files": [
38
- "client.js",
39
- "index.js",
40
- "lines.js",
41
- "demo.js",
42
- "demo.test.json",
43
- "src/helpers.js",
44
- "src/flatten.js",
45
- "src/unflatten.js",
46
- "src/config.js",
47
- "src/copy.js",
48
- "src/digraph.js",
49
- "src/generators.js",
50
- "src/semantics.js"
51
- ],
52
- "main": "index.js",
53
- "author": "dev@thinktelligence.com",
54
- "name": "theprogrammablemind",
55
- "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
- "@typescript-eslint/eslint-plugin": "^4.28.4",
61
- "eslint": "^7.31.0",
62
- "eslint-plugin-node": "^11.1.0",
63
- "@typescript-eslint/parser": "^4.28.4"
64
- }
64
+ ]
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
- If you run node_modules/entodiction/test.js that will run a sample
10
- program against the API.
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
- operators = ['(i [([went] ([to] (<the> store)))])']
13
+ dev@devlaptop:~/temp/myProject$ node node_modules/theprogrammablemind/demo -q 'i went to the store' -d
14
+ ```
16
15
 
17
- bridges = [
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
- utterances = ["joe went to the store"]
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. The priority
31
- is used to train a neural net. The idea here is to give sample sentences that are marked up so a graph
32
- of priorities can be made and fed to a neural net. The '[]' or '<>' is used to mark operators. In a generalized
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 operator the '<>' means there is not. The operators that this example defines are
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 prefix operator
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/1 > to/1 > went/1 > went/2
60
+ the/0 > to/0 > went/0
48
61
  ```
49
62
 
50
63
 
51
- 'Went' could be defined as infix but in the future once I implement conjunction this definition will allow
52
- sentences such as "I went to the store bought a coffee and chips and jumped on the bus and I got there".
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 langauge is used to specify how to combine contexts to get the next context. This abstraction
58
- support multiple languages mapping ultimately to the same JSON. Its a generaliztion of what I did
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
  {