ekms 8.0.0 → 8.1.0-beta.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.
Files changed (124) hide show
  1. package/common/animals.instance.json +3055 -1651
  2. package/common/animals.js +17 -20
  3. package/common/articles.js +103 -0
  4. package/common/articles.test.json +310 -0
  5. package/common/asking.instance.json +2 -0
  6. package/common/asking.js +253 -0
  7. package/common/asking.test.json +2290 -0
  8. package/common/avatar.js +6 -10
  9. package/common/characters.js +23 -30
  10. package/common/colors.instance.json +25666 -0
  11. package/common/colors.js +67 -0
  12. package/common/colors.test.json +4425 -0
  13. package/common/comparable.instance.json +1750 -0
  14. package/common/comparable.js +36 -28
  15. package/common/comparable.test.json +1196 -2
  16. package/common/concept.js +121 -119
  17. package/common/concept.test.json +688 -0
  18. package/common/conjunction.instance.json +2 -0
  19. package/common/conjunction.js +104 -0
  20. package/common/conjunction.test.json +322 -0
  21. package/common/countable.js +20 -14
  22. package/common/countable.test.json +1050 -0
  23. package/common/crew.instance.json +16432 -9850
  24. package/common/crew.js +39 -42
  25. package/common/crew.test.json +714 -452
  26. package/common/currency.js +28 -46
  27. package/common/dialogues.js +187 -429
  28. package/common/dialogues.test.json +684 -450
  29. package/common/dimension.instance.json +517 -289
  30. package/common/dimension.js +22 -24
  31. package/common/dimension.test.json +727 -1944
  32. package/common/edible.instance.json +20506 -10664
  33. package/common/edible.js +4 -9
  34. package/common/emotions.instance.json +195 -123
  35. package/common/emotions.js +36 -39
  36. package/common/evaluate.instance.json +2 -0
  37. package/common/evaluate.js +53 -0
  38. package/common/evaluate.test.json +574 -0
  39. package/common/events.js +11 -15
  40. package/common/fastfood.instance.json +223185 -113172
  41. package/common/fastfood.js +77 -87
  42. package/common/fastfood.test.json +8205 -3733
  43. package/common/formulas.instance.json +444 -244
  44. package/common/formulas.js +20 -27
  45. package/common/formulas.test.json +1027 -955
  46. package/common/gdefaults.js +45 -32
  47. package/common/help.js +9 -14
  48. package/common/help.test.json +71 -18
  49. package/common/helpers/concept.js +37 -10
  50. package/common/helpers/dialogues.js +22 -4
  51. package/common/helpers/formulas.js +0 -14
  52. package/common/helpers/meta.js +0 -1
  53. package/common/helpers/properties.js +92 -84
  54. package/common/helpers.js +35 -24
  55. package/common/hierarchy.js +18 -25
  56. package/common/javascript.js +12 -19
  57. package/common/kirk.instance.json +583 -300
  58. package/common/kirk.js +6 -9
  59. package/common/length.instance.json +8995 -4964
  60. package/common/length.js +5 -9
  61. package/common/listener.js +48 -0
  62. package/common/listener.test.json +104 -0
  63. package/common/math.instance.json +409 -1202
  64. package/common/math.js +17 -21
  65. package/common/meta.js +24 -50
  66. package/common/nameable.instance.json +2 -0
  67. package/common/nameable.js +144 -0
  68. package/common/nameable.test.json +3191 -0
  69. package/common/negation.instance.json +2 -0
  70. package/common/negation.js +38 -0
  71. package/common/negation.test.json +308 -0
  72. package/common/numbers.js +28 -32
  73. package/common/ordering.instance.json +459 -274
  74. package/common/ordering.js +81 -87
  75. package/common/ordinals.instance.json +2 -0
  76. package/common/ordinals.js +61 -0
  77. package/common/ordinals.test.json +412 -0
  78. package/common/people.instance.json +2138 -1321
  79. package/common/people.js +9 -14
  80. package/common/people.test.json +1815 -1073
  81. package/common/percentages.instance.json +2 -0
  82. package/common/percentages.js +53 -0
  83. package/common/percentages.test.json +751 -0
  84. package/common/pipboy.instance.json +12261 -6898
  85. package/common/pipboy.js +53 -62
  86. package/common/pipboy.test.json +2835 -0
  87. package/common/pokemon.instance.json +4432 -2351
  88. package/common/pokemon.js +8 -21
  89. package/common/pos.js +16 -14
  90. package/common/pressure.instance.json +2311 -1303
  91. package/common/pressure.js +5 -9
  92. package/common/properties.instance.json +151 -87
  93. package/common/properties.js +164 -167
  94. package/common/properties.test.json +17605 -4030
  95. package/common/punctuation.js +24 -8
  96. package/common/punctuation.test.json +233 -5
  97. package/common/reports.instance.json +1037 -551
  98. package/common/reports.js +77 -103
  99. package/common/reports.test.json +15623 -10458
  100. package/common/scorekeeper.js +19 -31
  101. package/common/sdefaults.js +17 -8
  102. package/common/sizeable.js +13 -12
  103. package/common/spock.instance.json +582 -299
  104. package/common/spock.js +6 -9
  105. package/common/stgame.js +20 -20
  106. package/common/stm.js +182 -29
  107. package/common/stm.test.json +1734 -1
  108. package/common/tell.js +15 -19
  109. package/common/temperature.instance.json +2379 -1355
  110. package/common/temperature.js +5 -9
  111. package/common/tester.js +15 -4
  112. package/common/testing.js +8 -13
  113. package/common/time.js +21 -26
  114. package/common/tokenize.js +8 -8
  115. package/common/tokenize.test.json +86 -1
  116. package/common/ui.instance.json +151 -460
  117. package/common/ui.js +22 -34
  118. package/common/ui.test.json +641 -5357
  119. package/common/weight.instance.json +7957 -4350
  120. package/common/weight.js +5 -9
  121. package/common/weight.test.json +242 -238
  122. package/common/yesno.js +6 -6
  123. package/main.js +68 -45
  124. package/package.json +44 -6
package/common/concept.js CHANGED
@@ -1,4 +1,4 @@
1
- const { Config, knowledgeModule, flatten, where, Digraph } = require('./runtime').theprogrammablemind
1
+ const { knowledgeModule, flatten, where, Digraph } = require('./runtime').theprogrammablemind
2
2
  const { defaultContextCheck } = require('./helpers')
3
3
  const { API }= require('./helpers/concept')
4
4
  const dialogues = require('./dialogues.js')
@@ -14,140 +14,142 @@ const concept_instance = require('./concept.instance.json')
14
14
  plain and regular fries mean the same thing
15
15
  */
16
16
 
17
- const createConfig = () => {
18
- const config = new Config({
19
- name: 'concept',
20
- operators: [
21
- "((context.punctuation != true)* [modifies|] (concept))",
22
- "([concept])",
23
- "([literally] (modifies/0))",
24
- ],
25
- bridges: [
26
- {
27
- id: "modifies",
28
- isA: ['verby'],
29
- words: [{ word: 'modifies', number: 'one', flatten: false }, { word: 'modify', number: 'many', flatten: true }],
30
- // bridge: "{ ...next(operator), modifiers: before, concept: after[0], flatten: true }"
31
- bridge: "{ ...next(operator), modifiers: before, concept: after[0] }"
32
- },
33
- { id: "literally", bridge: "{ ...after[0], flatten: false, literally: true }" },
34
- { id: "concept", bridge: "{ ...next(operator) }" },
35
- ],
36
- priorities: [
37
- { "context": [['literally', 0], ['modifies', 0], ], "choose": [0] },
38
- ],
39
- hierarchy: [
40
- ['concept', 'theAble'],
41
- ['concept', 'queryable'],
42
- ],
43
- generators: [
44
- {
45
- notes: '"fire type, water type and earth type" to "fire water and earth type"',
46
- /*
47
- {
48
- "water": {
49
- "marker": "water",
50
- "value": "water",
51
- "word": "water"
52
- },
53
- "marker": "water_type",
54
- "modifiers": [
55
- "water"
56
- ],
57
- "types": [
58
- "water_type"
59
- ],
60
- "value": "water_type",
61
- "word": "type",
62
- "paraphrase": true
17
+ config = {
18
+ name: 'concept',
19
+ operators: [
20
+ "((context.punctuation != true)* [modifies|] (concept))",
21
+ "([concept])",
22
+ "([literally] (modifies/0))",
23
+ ],
24
+ bridges: [
25
+ {
26
+ id: "modifies",
27
+ isA: ['verb'],
28
+ words: [{ word: 'modifies', number: 'one', flatten: false }, { word: 'modify', number: 'many', flatten: true }],
29
+ // bridge: "{ ...next(operator), modifiers: before, concept: after[0], flatten: true }"
30
+ bridge: "{ ...next(operator), modifiers: before, concept: after[0] }"
31
+ },
32
+ { id: "literally", bridge: "{ ...after[0], flatten: false, literally: true }" },
33
+ { id: "concept", bridge: "{ ...next(operator) }" },
34
+ ],
35
+ priorities: [
36
+ { "context": [['literally', 0], ['modifies', 0], ], "choose": [0] },
37
+ ],
38
+ hierarchy: [
39
+ ['concept', 'theAble'],
40
+ ['concept', 'queryable'],
41
+ ],
42
+ generators: [
43
+ {
44
+ notes: '"fire type, water type and earth type" to "fire water and earth type"',
45
+ /*
46
+ {
47
+ "water": {
48
+ "marker": "water",
49
+ "value": "water",
50
+ "word": "water"
63
51
  },
64
- */
65
- where: where(),
66
- match: ({context}) => {
67
- // debugger;
68
- if (!context.paraphrase) {
69
- return
70
- }
71
- if (context.marker !== 'list') {
72
- return
73
- }
74
- if ((context.value || []).length < 2) {
75
- return
76
- }
77
- if (!context.value[0].word) {
78
- return
79
- }
80
- const word = context.value[0].word
81
-
82
- for (let value of context.value) {
83
- if (!(value.modifiers && value.modifiers.length == 1 && value.word == word)) {
84
- return
85
- }
86
- }
87
- return true
52
+ "marker": "water_type",
53
+ "modifiers": [
54
+ "water"
55
+ ],
56
+ "types": [
57
+ "water_type"
58
+ ],
59
+ "value": "water_type",
60
+ "word": "type",
61
+ "paraphrase": true
88
62
  },
89
- apply: ({g, context}) => {
90
- const modifiers = context.value.map( (p) => p[p.modifiers[0]] )
91
- context.word = context.value[0].word
92
- context.value = null
93
- context.modifiers = ['modifier']
94
- context.modifier = {
95
- marker: 'list',
96
- paraphrase: true,
97
- value: modifiers
98
- }
99
- context.paraphrase = true
100
- return g(context)
63
+ */
64
+ where: where(),
65
+ match: ({context}) => {
66
+ if (!context.paraphrase) {
67
+ return
101
68
  }
102
- },
103
- {
104
- where: where(),
105
- match: ({context}) => context.marker == 'modifies' && context.paraphrase,
106
- apply: ({context, gp, gw}) => {
107
- if (context.literally) {
108
- return `${context.modifiers.map(gp).join(" ")} literally ${gw(context, { number: context.modifiers[context.modifiers.length - 1] })} ${gp(context.concept)}`
109
- } else {
110
- return `${context.modifiers.map(gp).join(" ")} ${gw(context, { number: context.modifiers[context.modifiers.length - 1] })} ${gp(context.concept)}`
111
- }
69
+ if (context.marker !== 'list') {
70
+ return
112
71
  }
113
- // const chosen = chooseNumber(context, word.singular, word.plural)
114
- },
115
- ],
116
- semantics: [
117
- {
118
- notes: 'define a modifier',
119
- where: where(),
120
- match: ({context}) => context.marker == 'modifies',
121
- apply: ({config, query, km, context}) => {
122
- let modifiers
123
- if (context.literally) {
124
- literalModifiers = context.modifiers[0]
125
- modifiers = literalModifiers.value.map(modifier => modifier.value)
126
- modifiers = modifiers.slice(0, -1).concat([literalModifiers.marker]).concat(modifiers.slice(-1))
127
- } else {
128
- modifiers = context.modifiers.map(modifier => modifier.value)
72
+ if ((context.value || []).length < 2) {
73
+ return
74
+ }
75
+ if (!context.value[0].word) {
76
+ return
77
+ }
78
+ const word = context.value[0].word
79
+
80
+ for (let value of context.value) {
81
+ if (!(value.modifiers && value.modifiers.length == 1 && value.word == word)) {
82
+ return
129
83
  }
130
- km('concept').api.kindOfConcept({ config, modifiers, object: context.concept.value || context.concept.marker })
131
84
  }
85
+ return true
132
86
  },
133
- ],
134
- }, module)
135
- config.stop_auto_rebuild()
136
- config.api = new API()
137
- config.add(dialogues())
138
- config.restart_auto_rebuild()
139
- return config
87
+ apply: async ({g, context}) => {
88
+ const modifiers = context.value.map( (p) => p[p.modifiers[0]] )
89
+ context.word = context.value[0].word
90
+ context.value = null
91
+ context.modifiers = ['modifier']
92
+ context.modifier = {
93
+ marker: 'list',
94
+ paraphrase: true,
95
+ value: modifiers
96
+ }
97
+ context.paraphrase = true
98
+ return await g(context)
99
+ }
100
+ },
101
+ {
102
+ where: where(),
103
+ match: ({context}) => context.marker == 'modifies' && context.paraphrase,
104
+ apply: async ({context, gp, gw}) => {
105
+ const modifiers = []
106
+ for (modifier of context.modifiers) {
107
+ modifiers.push(await gp(modifier))
108
+ }
109
+ if (context.literally) {
110
+ return `${modifiers.join(" ")} literally ${await gw(context, { number: context.modifiers[context.modifiers.length - 1] })} ${await gp(context.concept)}`
111
+ } else {
112
+ return `${modifiers.join(" ")} ${await gw(context, { number: context.modifiers[context.modifiers.length - 1] })} ${await gp(context.concept)}`
113
+ }
114
+ }
115
+ // const chosen = chooseNumber(context, word.singular, word.plural)
116
+ },
117
+ ],
118
+ semantics: [
119
+ {
120
+ notes: 'define a modifier',
121
+ where: where(),
122
+ match: ({context}) => context.marker == 'modifies',
123
+ apply: ({config, query, km, context}) => {
124
+ let modifiers
125
+ if (context.literally) {
126
+ literalModifiers = context.modifiers[0]
127
+ // modifiers = literalModifiers.value.map(modifier => modifier.value)
128
+ modifiers = literalModifiers.value
129
+ modifiers = modifiers.slice(0, -1).concat([literalModifiers.marker]).concat(modifiers.slice(-1))
130
+ } else {
131
+ modifiers = context.modifiers
132
+ // modifiers = context.modifiers.map(modifier => modifier.value)
133
+ }
134
+ // km('concept').api.kindOfConcept({ config, modifiers, object: context.concept.value || context.concept.marker })
135
+ km('concept').api.kindOfConcept({ config, modifiers, object: context.concept })
136
+ }
137
+ },
138
+ ],
140
139
  }
141
140
 
142
141
  knowledgeModule({
142
+ config,
143
+ includes: [dialogues],
144
+ api: () => new API(),
145
+
143
146
  module,
144
147
  description: 'The idea of a concept whatever that might end up being',
145
- createConfig,
146
148
  test: {
147
149
  name: './concept.test.json',
148
150
  contents: concept_tests,
149
151
  checks: {
150
- context: defaultContextCheck,
152
+ context: defaultContextCheck(),
151
153
  objects: [],
152
154
  }
153
155
  }