theprogrammablemind_4wp 7.10.0-beta.15 → 7.10.0-beta.17
Sign up to get free protection for your applications and to get access to all the features.
- package/client.js +256 -259
- package/demo.js +24 -24
- package/lines.js +2 -2
- package/package.json +1 -1
- package/runtime.js +12 -12
- package/src/config.js +233 -239
- 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
@@ -1,18 +1,18 @@
|
|
1
1
|
module.exports = {
|
2
2
|
process: {
|
3
|
-
env:
|
4
|
-
exit:
|
5
|
-
stdin:
|
6
|
-
stdout:
|
3
|
+
env: 'Should not be called in the browser',
|
4
|
+
exit: 'Should not be called in the browser',
|
5
|
+
stdin: 'Should not be called in the browser',
|
6
|
+
stdout: 'Should not be called in the browser'
|
7
7
|
},
|
8
|
-
child_process:
|
8
|
+
child_process: 'Should not be called in the browser',
|
9
9
|
fs: {
|
10
|
-
existsSync: () => false
|
10
|
+
existsSync: () => false
|
11
11
|
},
|
12
|
-
ArgumentParser:
|
13
|
-
readline:
|
14
|
-
jsonDiff:
|
15
|
-
sortJson:
|
16
|
-
util:
|
17
|
-
performance:
|
12
|
+
ArgumentParser: 'Should not be called in the browser',
|
13
|
+
readline: 'Should not be called in the browser',
|
14
|
+
jsonDiff: 'Should not be called in the browser',
|
15
|
+
sortJson: 'Should not be called in the browser',
|
16
|
+
util: 'Should not be called in the browser',
|
17
|
+
performance: 'Should not be called in the browser'
|
18
18
|
}
|