theprogrammablemind 7.10.0 → 7.10.1
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/client.js +280 -288
- package/demo.js +24 -24
- package/lines.js +2 -2
- package/package.json +1 -1
- package/runtime.js +2 -2
- package/src/config.js +261 -241
- package/src/digraph.js +9 -9
- package/src/digraph_internal.js +6 -6
- package/src/flatten.js +1 -1
- package/src/generators.js +41 -43
- package/src/helpers.js +57 -58
- package/src/project.js +6 -8
- package/src/semantics.js +40 -42
- package/src/unflatten.js +7 -7
package/demo.js
CHANGED
@@ -8,55 +8,55 @@ const { Config, knowledgeModule, where } = require('theprogrammablemind')
|
|
8
8
|
let config = {
|
9
9
|
name: 'demo',
|
10
10
|
operators: [
|
11
|
-
'((i) [went] ([to] (<the> store)))'
|
11
|
+
'((i) [went] ([to] (<the> store)))'
|
12
12
|
],
|
13
13
|
bridges: [
|
14
|
-
{
|
15
|
-
id:
|
16
|
-
level: 0,
|
17
|
-
bridge: "{ ...after, determiner: 'the' }"
|
18
|
-
},
|
19
|
-
{
|
20
|
-
id: "to",
|
21
|
-
level: 0,
|
22
|
-
bridge: "{ ...next(operator), after: after[0] }"
|
14
|
+
{
|
15
|
+
id: 'the',
|
16
|
+
level: 0,
|
17
|
+
bridge: "{ ...after, determiner: 'the' }"
|
23
18
|
},
|
24
|
-
{
|
25
|
-
id:
|
26
|
-
level: 0,
|
27
|
-
|
28
|
-
bridge: "{ action: 'go', marker: 'went', actor: before[0], place: after[0].after }"
|
19
|
+
{
|
20
|
+
id: 'to',
|
21
|
+
level: 0,
|
22
|
+
bridge: '{ ...next(operator), after: after[0] }'
|
29
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
30
|
],
|
31
31
|
generators: [
|
32
32
|
{
|
33
|
-
match: ({context}) => context.isResponse,
|
34
|
-
apply: ({context}) => context.evalue
|
33
|
+
match: ({ context }) => context.isResponse,
|
34
|
+
apply: ({ context }) => context.evalue
|
35
35
|
},
|
36
36
|
{
|
37
|
-
match: ({context}) => context.marker == 'unknown',
|
38
|
-
apply: ({context}) => context.text
|
37
|
+
match: ({ context }) => context.marker == 'unknown',
|
38
|
+
apply: ({ context }) => context.text
|
39
39
|
}
|
40
40
|
],
|
41
41
|
semantics: [
|
42
42
|
{
|
43
|
-
match: ({context}) => context.marker == 'went',
|
44
|
-
apply: ({context}) => {
|
43
|
+
match: ({ context }) => context.marker == 'went',
|
44
|
+
apply: ({ context }) => {
|
45
45
|
// same way as kms that I wrote. you dont have to do this though
|
46
46
|
context.isResponse = true
|
47
47
|
context.evalue = 'okay, sounds good'
|
48
48
|
}
|
49
49
|
}
|
50
50
|
]
|
51
|
-
}
|
51
|
+
}
|
52
52
|
|
53
53
|
config = new Config(config, module)
|
54
|
-
knowledgeModule({
|
54
|
+
knowledgeModule({
|
55
55
|
module,
|
56
56
|
config,
|
57
57
|
description: 'demo for readme',
|
58
58
|
test: {
|
59
59
|
name: './demo.test.json',
|
60
60
|
contents: require('./demo.test.json')
|
61
|
-
}
|
61
|
+
}
|
62
62
|
})
|
package/lines.js
CHANGED
@@ -13,9 +13,9 @@ class Lines {
|
|
13
13
|
setElement (row, column, value, fullWidth = false) {
|
14
14
|
const values = value.toString().split('\n')
|
15
15
|
if (column >= this.widths.length) {
|
16
|
-
throw new Error(
|
16
|
+
throw new Error('Column out of range.')
|
17
17
|
}
|
18
|
-
const width = fullWidth ? value.length: this.widths[column]
|
18
|
+
const width = fullWidth ? value.length : this.widths[column]
|
19
19
|
let index = 0
|
20
20
|
for (value of values) {
|
21
21
|
while (value.length > 0) {
|
package/package.json
CHANGED
package/runtime.js
CHANGED
@@ -6,7 +6,7 @@ module.exports = {
|
|
6
6
|
env: process.env,
|
7
7
|
exit: process.exit,
|
8
8
|
stdin: process.stdin,
|
9
|
-
stdout: process.stdout
|
9
|
+
stdout: process.stdout
|
10
10
|
},
|
11
11
|
child_process: require('child_process'),
|
12
12
|
fs,
|
@@ -15,5 +15,5 @@ module.exports = {
|
|
15
15
|
jsonDiff: require('json-diff'),
|
16
16
|
sortJson: require('sort-json'),
|
17
17
|
util: require('util'),
|
18
|
-
performance: require('perf_hooks')
|
18
|
+
performance: require('perf_hooks')
|
19
19
|
}
|