tpmkms_4wp 8.0.0-beta.42 → 8.0.0-beta.44

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. package/common/animals.js +17 -20
  2. package/common/articles.js +6 -11
  3. package/common/avatar.js +5 -9
  4. package/common/characters.js +22 -26
  5. package/common/colors.instance.json +28 -0
  6. package/common/colors.js +4 -8
  7. package/common/comparable.js +5 -9
  8. package/common/concept.js +120 -124
  9. package/common/countable.js +5 -9
  10. package/common/crew.js +36 -41
  11. package/common/currency.js +25 -43
  12. package/common/dialogues.js +46 -49
  13. package/common/dimension.instance.json +8 -8
  14. package/common/dimension.js +7 -13
  15. package/common/edible.instance.json +112 -0
  16. package/common/edible.js +3 -8
  17. package/common/emotions.js +35 -38
  18. package/common/evaluate.js +5 -11
  19. package/common/events.js +6 -10
  20. package/common/fastfood.instance.json +401 -317
  21. package/common/fastfood.js +53 -63
  22. package/common/formulas.instance.json +10 -10
  23. package/common/formulas.js +7 -14
  24. package/common/gdefaults.js +8 -10
  25. package/common/help.js +7 -12
  26. package/common/hierarchy.js +8 -12
  27. package/common/javascript.js +7 -14
  28. package/common/kirk.js +5 -8
  29. package/common/length.js +4 -8
  30. package/common/listener.js +5 -11
  31. package/common/math.instance.json +16 -16
  32. package/common/math.js +6 -10
  33. package/common/meta.js +5 -22
  34. package/common/nameable.js +6 -13
  35. package/common/negation.js +5 -5
  36. package/common/numbers.js +5 -9
  37. package/common/ordering.instance.json +68 -0
  38. package/common/ordering.js +80 -86
  39. package/common/people.js +8 -12
  40. package/common/percentages.js +5 -9
  41. package/common/pipboy.instance.json +84 -28
  42. package/common/pipboy.js +7 -15
  43. package/common/pokemon.js +7 -20
  44. package/common/pos.js +4 -5
  45. package/common/pressure.js +4 -8
  46. package/common/properties.js +6 -12
  47. package/common/punctuation.js +5 -5
  48. package/common/reports.instance.json +1 -1
  49. package/common/reports.js +9 -14
  50. package/common/scorekeeper.js +8 -12
  51. package/common/sdefaults.js +4 -5
  52. package/common/sizeable.js +5 -9
  53. package/common/spock.js +5 -8
  54. package/common/stgame.js +18 -23
  55. package/common/stm.js +9 -15
  56. package/common/tell.js +9 -13
  57. package/common/temperature.instance.json +0 -112
  58. package/common/temperature.js +4 -8
  59. package/common/tester.js +1 -1
  60. package/common/testing.js +5 -9
  61. package/common/time.js +18 -23
  62. package/common/tokenize.js +4 -5
  63. package/common/ui.js +6 -12
  64. package/common/weight.js +4 -8
  65. package/common/yesno.js +5 -5
  66. package/package.json +2 -2
@@ -59,7 +59,7 @@
59
59
  "development": true
60
60
  },
61
61
  {
62
- "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:32",
62
+ "where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
63
63
  "id": "plusOperator",
64
64
  "level": 0,
65
65
  "bridge": "{ ...next(operator), marker: next(operator('plusExpression')), types: lub(append(['mathematicalExpression'], operator.types, before[0].types, after[0].types)), value: null, x: before[0], y: after[0], number: 'one', isResponse: true, evaluate: true }",
@@ -80,7 +80,7 @@
80
80
  "generatorp": "({context}) => context.word"
81
81
  },
82
82
  {
83
- "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:44",
83
+ "where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
84
84
  "id": "plusExpression",
85
85
  "level": 0,
86
86
  "bridge": "{ ...next(operator) }",
@@ -91,7 +91,7 @@
91
91
  "evaluator": "async ({e, context}) => {\n const x = toValue(await e(context.x)) \n const y = toValue(await e(context.y))\n if (!x || !y) {\n // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }\n context.isResponse = false\n } else {\n context.evalue = apply(x, y)\n context.evalue.isResponse = true\n context.evalue.paraphrase = false\n // context.paraphrase = false\n // context.isResponse = true\n }\n /*\n if (!context.value) {\n context.isResponse = false\n context.paraphrase = true\n }\n */\n }"
92
92
  },
93
93
  {
94
- "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:32",
94
+ "where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
95
95
  "id": "minusOperator",
96
96
  "level": 0,
97
97
  "bridge": "{ ...next(operator), marker: next(operator('minusExpression')), types: lub(append(['mathematicalExpression'], operator.types, before[0].types, after[0].types)), value: null, x: before[0], y: after[0], number: 'one', isResponse: true, evaluate: true }",
@@ -112,7 +112,7 @@
112
112
  "generatorp": "({context}) => context.word"
113
113
  },
114
114
  {
115
- "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:44",
115
+ "where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
116
116
  "id": "minusExpression",
117
117
  "level": 0,
118
118
  "bridge": "{ ...next(operator) }",
@@ -123,7 +123,7 @@
123
123
  "evaluator": "async ({e, context}) => {\n const x = toValue(await e(context.x)) \n const y = toValue(await e(context.y))\n if (!x || !y) {\n // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }\n context.isResponse = false\n } else {\n context.evalue = apply(x, y)\n context.evalue.isResponse = true\n context.evalue.paraphrase = false\n // context.paraphrase = false\n // context.isResponse = true\n }\n /*\n if (!context.value) {\n context.isResponse = false\n context.paraphrase = true\n }\n */\n }"
124
124
  },
125
125
  {
126
- "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:32",
126
+ "where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
127
127
  "id": "timesOperator",
128
128
  "level": 0,
129
129
  "bridge": "{ ...next(operator), marker: next(operator('timesExpression')), types: lub(append(['mathematicalExpression'], operator.types, before[0].types, after[0].types)), value: null, x: before[0], y: after[0], number: 'one', isResponse: true, evaluate: true }",
@@ -153,7 +153,7 @@
153
153
  "generatorp": "({context}) => context.word"
154
154
  },
155
155
  {
156
- "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:44",
156
+ "where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
157
157
  "id": "timesExpression",
158
158
  "level": 0,
159
159
  "bridge": "{ ...next(operator) }",
@@ -164,7 +164,7 @@
164
164
  "evaluator": "async ({e, context}) => {\n const x = toValue(await e(context.x)) \n const y = toValue(await e(context.y))\n if (!x || !y) {\n // context.evalue = { ...context, paraphrase: true, x: { ...context.x, value: x }, y: { ...context.y, value: y } }\n context.isResponse = false\n } else {\n context.evalue = apply(x, y)\n context.evalue.isResponse = true\n context.evalue.paraphrase = false\n // context.paraphrase = false\n // context.isResponse = true\n }\n /*\n if (!context.value) {\n context.isResponse = false\n context.paraphrase = true\n }\n */\n }"
165
165
  },
166
166
  {
167
- "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:32",
167
+ "where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
168
168
  "id": "divideByOperator",
169
169
  "level": 0,
170
170
  "bridge": "{ ...next(operator), marker: next(operator('divideByExpression')), types: lub(append(['mathematicalExpression'], operator.types, before[0].types, after[0].types)), value: null, x: before[0], y: after[0], number: 'one', isResponse: true, evaluate: true }",
@@ -193,7 +193,7 @@
193
193
  "generatorp": "({context}) => context.word"
194
194
  },
195
195
  {
196
- "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:44",
196
+ "where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
197
197
  "id": "divideByExpression",
198
198
  "level": 0,
199
199
  "bridge": "{ ...next(operator) }",
@@ -770,7 +770,7 @@
770
770
  "development": true
771
771
  },
772
772
  {
773
- "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:32",
773
+ "where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
774
774
  "id": "plusOperator",
775
775
  "level": 0,
776
776
  "bridge": "{ ...next(operator), marker: next(operator('plusExpression')), types: lub(append(['mathematicalExpression'], operator.types, before[0].types, after[0].types)), value: null, x: before[0], y: after[0], number: 'one', isResponse: true, evaluate: true }",
@@ -790,7 +790,7 @@
790
790
  ]
791
791
  },
792
792
  {
793
- "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:44",
793
+ "where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
794
794
  "id": "plusExpression",
795
795
  "level": 0,
796
796
  "bridge": "{ ...next(operator) }",
@@ -799,7 +799,7 @@
799
799
  ]
800
800
  },
801
801
  {
802
- "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:32",
802
+ "where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
803
803
  "id": "minusOperator",
804
804
  "level": 0,
805
805
  "bridge": "{ ...next(operator), marker: next(operator('minusExpression')), types: lub(append(['mathematicalExpression'], operator.types, before[0].types, after[0].types)), value: null, x: before[0], y: after[0], number: 'one', isResponse: true, evaluate: true }",
@@ -819,7 +819,7 @@
819
819
  ]
820
820
  },
821
821
  {
822
- "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:44",
822
+ "where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
823
823
  "id": "minusExpression",
824
824
  "level": 0,
825
825
  "bridge": "{ ...next(operator) }",
@@ -828,7 +828,7 @@
828
828
  ]
829
829
  },
830
830
  {
831
- "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:32",
831
+ "where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
832
832
  "id": "timesOperator",
833
833
  "level": 0,
834
834
  "bridge": "{ ...next(operator), marker: next(operator('timesExpression')), types: lub(append(['mathematicalExpression'], operator.types, before[0].types, after[0].types)), value: null, x: before[0], y: after[0], number: 'one', isResponse: true, evaluate: true }",
@@ -857,7 +857,7 @@
857
857
  ]
858
858
  },
859
859
  {
860
- "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:44",
860
+ "where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
861
861
  "id": "timesExpression",
862
862
  "level": 0,
863
863
  "bridge": "{ ...next(operator) }",
@@ -866,7 +866,7 @@
866
866
  ]
867
867
  },
868
868
  {
869
- "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:32",
869
+ "where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
870
870
  "id": "divideByOperator",
871
871
  "level": 0,
872
872
  "bridge": "{ ...next(operator), marker: next(operator('divideByExpression')), types: lub(append(['mathematicalExpression'], operator.types, before[0].types, after[0].types)), value: null, x: before[0], y: after[0], number: 'one', isResponse: true, evaluate: true }",
@@ -894,7 +894,7 @@
894
894
  ]
895
895
  },
896
896
  {
897
- "where": "/home/dev/code/theprogrammablemind/kms/common/math.js:44",
897
+ "where": "/home/dev/code/theprogrammablemind/kms/node_modules/theprogrammablemind/src/helpers.js:5",
898
898
  "id": "divideByExpression",
899
899
  "level": 0,
900
900
  "bridge": "{ ...next(operator) }",
package/common/math.js CHANGED
@@ -1,4 +1,4 @@
1
- const { Config, knowledgeModule, where } = require('./runtime').theprogrammablemind
1
+ const { knowledgeModule, where } = require('./runtime').theprogrammablemind
2
2
  const { defaultContextCheck } = require('./helpers')
3
3
  const dialogues = require('./dialogues')
4
4
  const numbers = require('./numbers')
@@ -69,7 +69,7 @@ const mathematicalOperator = (name, words, apply, before = []) => [
69
69
  }
70
70
  ]
71
71
 
72
- let configStruct = {
72
+ let config = {
73
73
  name: 'math',
74
74
  operators: [
75
75
  "([mathematicalExpression])",
@@ -108,20 +108,16 @@ let configStruct = {
108
108
  const template = {
109
109
  configs: [
110
110
  "mathematical modifies operator",
111
- configStruct,
111
+ config,
112
112
  // "* + / and - are mathematical operators",
113
113
  ]
114
114
  }
115
115
 
116
- const createConfig = async () => {
117
- const config = new Config({ name: 'math' }, module)
118
- await config.add(numbers, dialogues, punctuation, countable, comparable)
119
- return config
120
- }
121
-
122
116
  knowledgeModule( {
117
+ config: { name: 'math' },
118
+ includes: [numbers, dialogues, punctuation, countable, comparable],
119
+
123
120
  module,
124
- createConfig,
125
121
  description: 'talking about math',
126
122
  template: { template, instance },
127
123
  test: {
package/common/meta.js CHANGED
@@ -1,4 +1,4 @@
1
- const { Config, knowledgeModule, ensureTestFile, where, unflatten, flattens } = require('./runtime').theprogrammablemind
1
+ const { knowledgeModule, ensureTestFile, where, unflatten, flattens } = require('./runtime').theprogrammablemind
2
2
  const { defaultContextCheck } = require('./helpers')
3
3
  const _ = require('lodash')
4
4
  const gdefaults = require('./gdefaults.js')
@@ -17,7 +17,7 @@ const template = {
17
17
  };
18
18
 
19
19
  // TODO -> if a car's top speed is over 200 mph then the car is fast
20
- let configStruct = {
20
+ let config = {
21
21
  name: 'meta',
22
22
  operators: [
23
23
  "((phrase) [means] (phrase))",
@@ -371,29 +371,12 @@ let configStruct = {
371
371
  ],
372
372
  };
373
373
 
374
- const createConfig = async () => {
375
- const config = new Config(configStruct, module)
376
- config.stop_auto_rebuild()
377
- await config.add(gdefaults)
378
-
379
- await config.initializer( ({config, addGenerator, isModule}) => {
380
- if (!isModule) {
381
- addGenerator({
382
- where: where(),
383
- match: ({context}) => context.marker == 'unknown',
384
- apply: ({context}) => `${context.word}`
385
- })
386
- }
387
- })
388
-
389
- await config.restart_auto_rebuild()
390
- return config
391
- }
392
-
393
374
  knowledgeModule({
375
+ config,
376
+ includes: [gdefaults],
377
+
394
378
  module,
395
379
  description: 'Ways of defining new language elements',
396
- createConfig,
397
380
  test: {
398
381
  name: './meta.test.json',
399
382
  contents: meta_tests,
@@ -1,4 +1,4 @@
1
- const { Config, knowledgeModule, where } = require('./runtime').theprogrammablemind
1
+ const { knowledgeModule, where } = require('./runtime').theprogrammablemind
2
2
  const { defaultContextCheck } = require('./helpers')
3
3
  const helpers = require('./helpers')
4
4
  const stm = require('./stm')
@@ -70,7 +70,7 @@ class API {
70
70
 
71
71
  const api = new API()
72
72
 
73
- const configStruct = {
73
+ const config = {
74
74
  name: 'nameable',
75
75
  operators: [
76
76
  "([call] ([nameable]) (name))",
@@ -117,20 +117,13 @@ const configStruct = {
117
117
  ]
118
118
  }
119
119
 
120
- let createConfig = async () => {
121
- const config = new Config(configStruct, module)
122
- config.stop_auto_rebuild()
123
- await config.setApi(api)
124
- await config.add(stm)
125
-
126
- await config.restart_auto_rebuild()
127
- return config
128
- }
129
-
130
120
  knowledgeModule( {
121
+ config,
122
+ api: () => new API(),
123
+ includes: [stm],
124
+
131
125
  module,
132
126
  description: 'namable objects',
133
- createConfig,
134
127
  test: {
135
128
  name: './nameable.test.json',
136
129
  contents: nameable_tests,
@@ -1,10 +1,10 @@
1
- const { Config, knowledgeModule, where } = require('./runtime').theprogrammablemind
1
+ const { knowledgeModule, where } = require('./runtime').theprogrammablemind
2
2
  const { words, defaultContextCheck } = require('./helpers')
3
3
  const gdefaults = require('./gdefaults')
4
4
  const pos = require('./pos')
5
5
  const negation_tests = require('./negation.test.json')
6
6
 
7
- let configStruct = {
7
+ let config = {
8
8
  name: 'negation',
9
9
  operators: [
10
10
  "([negatable])",
@@ -21,11 +21,11 @@ let configStruct = {
21
21
  ],
22
22
  };
23
23
 
24
- const createConfig = async () => new Config(configStruct, module).add(gdefaults, pos)
25
-
26
24
  knowledgeModule( {
25
+ config,
26
+ includes: [gdefaults, pos],
27
+
27
28
  module,
28
- createConfig,
29
29
  description: 'negation',
30
30
  test: {
31
31
  name: './negation.test.json',
package/common/numbers.js CHANGED
@@ -1,4 +1,4 @@
1
- const { Config, knowledgeModule, where } = require('./runtime').theprogrammablemind
1
+ const { knowledgeModule, where } = require('./runtime').theprogrammablemind
2
2
  const { defaultContextCheck } = require('./helpers')
3
3
  const numbers_tests = require('./numbers.test.json')
4
4
  const gdefaults = require('./gdefaults')
@@ -10,7 +10,7 @@ const sdefaults = require('./sdefaults')
10
10
  10 million 300 hundred and fifty
11
11
  */
12
12
 
13
- let configStruct = {
13
+ let config = {
14
14
  name: 'numbers',
15
15
  operators: [
16
16
  "([number])",
@@ -83,15 +83,11 @@ let configStruct = {
83
83
  ],
84
84
  };
85
85
 
86
- const createConfig = async () => {
87
- const config = new Config(configStruct, module)
88
- await config.add(gdefaults, sdefaults)
89
- return config
90
- }
91
-
92
86
  knowledgeModule( {
87
+ config,
88
+ includes: [gdefaults, sdefaults],
89
+
93
90
  module,
94
- createConfig,
95
91
  description: 'talking about numbers',
96
92
  test: {
97
93
  name: './numbers.test.json',
@@ -2027,6 +2027,40 @@
2027
2027
  0
2028
2028
  ]
2029
2029
  ],
2030
+ [
2031
+ [
2032
+ "if",
2033
+ 0
2034
+ ],
2035
+ [
2036
+ "like",
2037
+ 0
2038
+ ],
2039
+ [
2040
+ "love",
2041
+ 0
2042
+ ],
2043
+ [
2044
+ "orList",
2045
+ 0
2046
+ ],
2047
+ [
2048
+ "then",
2049
+ 0
2050
+ ],
2051
+ [
2052
+ "unknown",
2053
+ 0
2054
+ ],
2055
+ [
2056
+ "unknown",
2057
+ 1
2058
+ ],
2059
+ [
2060
+ "want",
2061
+ 0
2062
+ ]
2063
+ ],
2030
2064
  [
2031
2065
  [
2032
2066
  "if",
@@ -2388,6 +2422,40 @@
2388
2422
  0
2389
2423
  ]
2390
2424
  ],
2425
+ [
2426
+ [
2427
+ "if",
2428
+ 0
2429
+ ],
2430
+ [
2431
+ "like",
2432
+ 0
2433
+ ],
2434
+ [
2435
+ "love",
2436
+ 0
2437
+ ],
2438
+ [
2439
+ "orList",
2440
+ 0
2441
+ ],
2442
+ [
2443
+ "then",
2444
+ 0
2445
+ ],
2446
+ [
2447
+ "unknown",
2448
+ 0
2449
+ ],
2450
+ [
2451
+ "unknown",
2452
+ 1
2453
+ ],
2454
+ [
2455
+ "want",
2456
+ 0
2457
+ ]
2458
+ ],
2391
2459
  [
2392
2460
  [
2393
2461
  "if",
@@ -1,4 +1,4 @@
1
- const { Config, knowledgeModule, where } = require('./runtime').theprogrammablemind
1
+ const { knowledgeModule, where } = require('./runtime').theprogrammablemind
2
2
  const { defaultContextCheck } = require('./helpers')
3
3
  const hierarchy = require('./hierarchy')
4
4
  const ordering_tests = require('./ordering.test.json')
@@ -32,96 +32,90 @@ const api = new API();
32
32
 
33
33
  if a likes b then a wants b
34
34
  */
35
- const createConfig = async () => {
36
- const config = new Config({ name: 'ordering' }, module)
37
- config.stop_auto_rebuild()
38
- await config.setApi(api)
39
- await config.add(hierarchy)
40
- // config.load(template, ordering_instance)
41
-
42
- await config.initializer(({config, km}) => {
43
- const oapi = km('ordering').api
44
- oapi.createOrdering({ name: 'preference', categories: [ ['love', 'like'], ['hate', 'dislike'] ], ordering: [ ['love', 'like'], ['like', 'dislike'], ['dislike', 'hate'] ] })
45
- const papi = km('properties').api
46
- // want is xfx between wanter and wantee
47
- // papi.createBinaryRelation(config, 'want', ['want', 'wants'], 'wanter', 'wantee')
48
- papi.createActionPrefix({
49
- operator: 'love',
50
- create: ['love'],
51
- before: [{tag: 'lover', id: 'object'}],
52
- after: [{tag: 'lovee', id: 'object'}],
53
- ordering: {
54
- name: 'preference',
55
- marker: 'love',
56
- object: 'lover',
57
- category: 'lovee',
58
- },
59
- doAble: true,
60
- config
61
- })
62
- papi.createActionPrefix({
63
- operator: 'like',
64
- create: ['like'],
65
- before: [{tag: 'liker', id: 'object'}],
66
- after: [{tag: 'likee', id: 'object'}],
67
- ordering: {
68
- name: 'preference',
69
- marker: 'like',
70
- object: 'liker',
71
- category: 'likee',
72
- },
73
- doAble: true,
74
- config
75
- })
76
- papi.createActionPrefix({
77
- operator: 'dislike',
78
- create: ['dislike'],
79
- before: [{tag: 'disliker', id: 'object'}],
80
- after: [{tag: 'dislikee', id: 'object'}],
81
- ordering: {
82
- name: 'preference',
83
- marker: 'dislike',
84
- object: 'disliker',
85
- category: 'dislikee',
86
- },
87
- doAble: true,
88
- config
89
- })
90
- papi.createActionPrefix({
91
- // pattern: [ {tag: 'hater', id: 'object'}, { operator, create: true, relation: true }, {tag: 'hatee', id: 'object'} ],
92
- operator: 'hate',
93
- create: ['hate'],
94
- before: [{tag: 'hater', id: 'object'}],
95
- after: [{tag: 'hatee', id: 'object'}],
96
- ordering: {
97
- name: 'preference',
98
- marker: 'hate',
99
- object: 'hater',
100
- category: 'hatee',
101
- },
102
- doAble: true,
103
- // negation: 'likes',
104
- config
105
- })
106
- /*
107
- papi.createActionPrefix({
108
- operator: 'own',
109
- create: ['own'],
110
- before: [{tag: 'owner', id: 'object'}],
111
- after: [{tag: 'ownee', id: 'object'}],
112
- relation: true,
113
- config
114
- })
115
- */
116
- })
117
- await config.restart_auto_rebuild()
118
- return config
35
+ const initializer = ({config, km}) => {
36
+ const oapi = km('ordering').api
37
+ oapi.createOrdering({ name: 'preference', categories: [ ['love', 'like'], ['hate', 'dislike'] ], ordering: [ ['love', 'like'], ['like', 'dislike'], ['dislike', 'hate'] ] })
38
+ const papi = km('properties').api
39
+ // want is xfx between wanter and wantee
40
+ // papi.createBinaryRelation(config, 'want', ['want', 'wants'], 'wanter', 'wantee')
41
+ papi.createActionPrefix({
42
+ operator: 'love',
43
+ create: ['love'],
44
+ before: [{tag: 'lover', id: 'object'}],
45
+ after: [{tag: 'lovee', id: 'object'}],
46
+ ordering: {
47
+ name: 'preference',
48
+ marker: 'love',
49
+ object: 'lover',
50
+ category: 'lovee',
51
+ },
52
+ doAble: true,
53
+ config
54
+ })
55
+ papi.createActionPrefix({
56
+ operator: 'like',
57
+ create: ['like'],
58
+ before: [{tag: 'liker', id: 'object'}],
59
+ after: [{tag: 'likee', id: 'object'}],
60
+ ordering: {
61
+ name: 'preference',
62
+ marker: 'like',
63
+ object: 'liker',
64
+ category: 'likee',
65
+ },
66
+ doAble: true,
67
+ config
68
+ })
69
+ papi.createActionPrefix({
70
+ operator: 'dislike',
71
+ create: ['dislike'],
72
+ before: [{tag: 'disliker', id: 'object'}],
73
+ after: [{tag: 'dislikee', id: 'object'}],
74
+ ordering: {
75
+ name: 'preference',
76
+ marker: 'dislike',
77
+ object: 'disliker',
78
+ category: 'dislikee',
79
+ },
80
+ doAble: true,
81
+ config
82
+ })
83
+ papi.createActionPrefix({
84
+ // pattern: [ {tag: 'hater', id: 'object'}, { operator, create: true, relation: true }, {tag: 'hatee', id: 'object'} ],
85
+ operator: 'hate',
86
+ create: ['hate'],
87
+ before: [{tag: 'hater', id: 'object'}],
88
+ after: [{tag: 'hatee', id: 'object'}],
89
+ ordering: {
90
+ name: 'preference',
91
+ marker: 'hate',
92
+ object: 'hater',
93
+ category: 'hatee',
94
+ },
95
+ doAble: true,
96
+ // negation: 'likes',
97
+ config
98
+ })
99
+ /*
100
+ papi.createActionPrefix({
101
+ operator: 'own',
102
+ create: ['own'],
103
+ before: [{tag: 'owner', id: 'object'}],
104
+ after: [{tag: 'ownee', id: 'object'}],
105
+ relation: true,
106
+ config
107
+ })
108
+ */
119
109
  }
120
110
 
121
111
  knowledgeModule( {
112
+ config: { name: 'ordering' },
113
+ api: () => new API(),
114
+ includes: [hierarchy],
115
+ initializer,
116
+
122
117
  module,
123
118
  description: 'ordering related concepts',
124
- createConfig,
125
119
  test: {
126
120
  name: './ordering.test.json',
127
121
  heck: ['children', 'concept', 'parents', 'properties'],
package/common/people.js CHANGED
@@ -1,4 +1,4 @@
1
- const { Config, knowledgeModule, where } = require('./runtime').theprogrammablemind
1
+ const { knowledgeModule, where } = require('./runtime').theprogrammablemind
2
2
  const { defaultContextCheck } = require('./helpers')
3
3
  const hierarchy = require('./hierarchy')
4
4
  const people_tests = require('./people.test.json')
@@ -25,7 +25,7 @@ const template = {
25
25
  // "wendy owns cleo",
26
26
  ],
27
27
  }
28
- let configStruct = {
28
+ let config = {
29
29
  name: 'people',
30
30
  operators: [
31
31
  "([person|person,people])",
@@ -45,11 +45,7 @@ let configStruct = {
45
45
  ],
46
46
  };
47
47
 
48
- const createConfig = async () => {
49
- const config = new Config(configStruct, module)
50
- config.stop_auto_rebuild()
51
- await config.add(hierarchy)
52
- await config.initializer( ({baseConfig, context, apis, isModule}) => {
48
+ const initializer = ({baseConfig, context, apis, isModule}) => {
53
49
  // const api = km('properties').api
54
50
  const api = apis('properties')
55
51
  // setup paraphrase
@@ -65,15 +61,15 @@ const createConfig = async () => {
65
61
  edAble: { operator: 'owned', word: 'owned' },
66
62
  config: baseConfig
67
63
  })
68
- })
69
- await config.restart_auto_rebuild()
70
- return config
71
- }
64
+ }
72
65
 
73
66
  knowledgeModule( {
67
+ config,
68
+ includes: [hierarchy],
69
+ initializer,
70
+
74
71
  module,
75
72
  description: 'about people',
76
- createConfig,
77
73
  test: {
78
74
  name: './people.test.json',
79
75
  contents: people_tests,