ekms 9.4.5 → 9.5.0-beta.0

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 (43) hide show
  1. package/common/animals.instance.json +40 -280
  2. package/common/colors.instance.json +92 -320
  3. package/common/comparable.instance.json +42 -10
  4. package/common/crew.instance.json +673 -965
  5. package/common/crew.js +0 -15
  6. package/common/dates.instance.json +2 -84
  7. package/common/dates.js +1 -0
  8. package/common/dimension.instance.json +2 -2
  9. package/common/dimension.js +1 -1
  10. package/common/edible.instance.json +874 -2097
  11. package/common/fastfood.instance.json +4865 -6422
  12. package/common/fastfood.js +1 -0
  13. package/common/gdefaults.js +34 -2
  14. package/common/helpers/concept.js +2 -1
  15. package/common/helpers/dialogues.js +2 -1
  16. package/common/kirk.instance.json +3 -23
  17. package/common/latin.instance.json +472 -1
  18. package/common/latin.js +145 -19
  19. package/common/latin.test.json +5325 -0
  20. package/common/latin_helpers.js +358 -0
  21. package/common/length.instance.json +128 -384
  22. package/common/menus.instance.json +21 -61
  23. package/common/people.instance.json +128 -96
  24. package/common/percentages.js +1 -0
  25. package/common/pipboy.instance.json +84 -366
  26. package/common/pipboy.js +2 -1
  27. package/common/pipboy.test.json +1690 -0
  28. package/common/pokemon.instance.json +351 -103
  29. package/common/pos.js +39 -34
  30. package/common/pressure.instance.json +32 -124
  31. package/common/properties.js +0 -16
  32. package/common/reminders.test.json +2702 -2786
  33. package/common/reports.instance.json +2 -2
  34. package/common/reports.js +4 -1
  35. package/common/reports.test.json +5547 -4514
  36. package/common/spock.instance.json +3 -23
  37. package/common/temperature.instance.json +40 -196
  38. package/common/tokenize.js +30 -2
  39. package/common/weight.instance.json +241 -301
  40. package/common/wp.instance.json +347 -373
  41. package/common/wp.js +25 -4
  42. package/common/wp.test.json +3104 -0
  43. package/package.json +3 -2
package/common/latin.js CHANGED
@@ -1,30 +1,120 @@
1
1
  const { knowledgeModule, where } = require('./runtime').theprogrammablemind
2
2
  const { defaultContextCheck } = require('./helpers')
3
3
  const gdefaults = require("./gdefaults")
4
+ const { conjugateVerb, getDeclensions } = require("./latin_helpers")
4
5
  const latin_tests = require('./latin.test.json')
6
+ const latin_instance = require('./latin.instance.json')
5
7
 
6
8
  /*
7
9
  marcus est vir
8
10
  marcus vir est
11
+ vir marcus est -> if vir is know to be a category and marcus is not that overides ordering
9
12
 
10
13
  estne
11
14
  marcus quintus iuliaque
15
+
16
+ oculi lupi in umbra lucent ut gemmae et dentes ut margaritae
17
+ oculi lupi in umbra lucent ut gemmae -> get this
18
+ dentes ut margaritae -> have these cases. reinterpret the first one uses the new cases oculi -> dentes + ut gemmae -> ut margaritae
19
+
20
+ equus et aninus leo et lupus canis et ovis bestiae sunt
21
+ aliae bestiae sunt aves aliae pisces
22
+ moribus antiquis res stat romana virisque
23
+ fossa nimis lata et vallum nimis altum est
24
+ arma germanorium tam bona sunt nostra
25
+ hiems tempus frigidus est (compound subject)
12
26
  */
13
27
  const config = {
14
- name: 'latin',
15
28
  operators: [
16
- "((*) [queryMarker])",
29
+ "((hierarchy/*) [queryMarker|ne])",
17
30
  "([hierarchiable])",
18
31
  "((hierarchiable) [hierarchy|] (hierarchiable))",
19
32
  "((hierarchiable) (hierarchiable) [hierarchy|])",
20
33
  "([hierarchy|] (hierarchiable) (hierarchiable))",
34
+
35
+ "(x [list|et] y)",
36
+ "((listable/*) [listMarker|que])",
37
+
38
+ // "([inLatin|in] (context.declension == 'ablative' || context.declension == 'accusative'))"
21
39
  ],
22
40
  bridges: [
41
+ {
42
+ id: 'inLatin',
43
+ words: ['in'],
44
+ before: ['iacere'],
45
+ bridge: "{ ...next(operator), declension: 'inLatin', object: object, operator: operator, interpolate: [{ property: 'operator' }, { property: 'object' }] }",
46
+ selector: {
47
+ ordinals: [1],
48
+ arguments: {
49
+ object: "(context.declension == 'accusative' || context.declension == 'ablative')",
50
+ },
51
+ },
52
+ },
53
+ {
54
+ id: "iacere",
55
+ level: 0,
56
+ words: [
57
+ ...conjugateVerb('iacere'),
58
+ ],
59
+ bridge: "{ ...next(operator), thrower: nominative?, receiver: dative?, object: object?, location: location?, interpolate: [{ property: 'thrower' }, { property: 'receiver' }, { property: 'location' }, { property: 'object' }, operator] }",
60
+ selector: {
61
+ arguments: {
62
+ nominative: "(context.declension == 'nominative' && context.number == operator.number)",
63
+ dative: "(context.declension == 'dative')",
64
+ object: "(context.declension == 'accusative')",
65
+ location: "(context.declension == 'inLatin')",
66
+ },
67
+ },
68
+ },
69
+ {
70
+ id: "dare",
71
+ level: 0,
72
+ bridge: "{ ...next(operator), giver: nominative?, receiver: dative?, object: accusative?, interpolate: [{ property: 'giver' }, { property: 'receiver' }, { property: 'object' }, operator] }",
73
+ selector: {
74
+ arguments: {
75
+ nominative: "(context.declension == 'nominative' && context.number == operator.number)",
76
+ dative: "(context.declension == 'dative')",
77
+ accusative: "(context.declension == 'accusative')",
78
+ },
79
+ },
80
+ words: [
81
+ ...conjugateVerb('dare'),
82
+ ],
83
+ },
84
+ {
85
+ id: "list",
86
+ level: 0,
87
+ selector: {
88
+ match: "same",
89
+ left: [ { pattern: '($type && context.instance == variables.instance)' } ],
90
+ right: [ { pattern: '($type && context.instance == variables.instance)' } ],
91
+ passthrough: true
92
+ },
93
+ bridge: "{ ...next(operator), listable: true, isList: true, value: append(before, after), operator: operator, interpolate: [ { separator: 'operator', values: 'value' } ] }"
94
+ },
95
+ {
96
+ id: "list",
97
+ level: 1,
98
+ selector: {
99
+ match: "same",
100
+ left: [ { pattern: '($type && context.instance == variables.instance)' } ],
101
+ passthrough: true
102
+ },
103
+ bridge: "{ ...operator, value: append(before, operator.value) }"
104
+ },
105
+
23
106
  {
24
107
  id: "queryMarker",
25
- bridge: "{ ...next(before[0]), question: true }",
108
+ bridge: "{ ...before[0], verb: before[0], interpolate: [before[0], '', operator], question: true }",
109
+ separators: '|',
26
110
  before: ['hierarchy'],
27
111
  },
112
+ {
113
+ id: "listMarker",
114
+ localHierarchy: [['unknown', 'listable']],
115
+ bridge: "{ ...before[0], verb: before[0], interpolate: [before[0], '', operator], isList: true }",
116
+ separators: '|',
117
+ },
28
118
  { id: "hierarchiable" },
29
119
  {
30
120
  id: "hierarchy",
@@ -40,33 +130,69 @@ const config = {
40
130
  ]
41
131
  },
42
132
  ],
43
- words: {
44
- literals: {
45
- "ne": [{ id: 'queryMarker', initial: { value: 'queryMarker' } }],
46
- },
47
- patterns: [
48
- { "pattern": ["ne"], defs: [
49
- {
50
- id: "queryMarker",
51
- uuid: '1',
52
- initial: { value: 'greg' }
53
- }
54
- ]},
55
- ],
56
- },
133
+ semantics: [
134
+ {
135
+ match: ({context}) => context.marker == 'unknown',
136
+ apply: ({context, config, addWord}) => {
137
+ const id = context.word
138
+ const word = context.word
139
+ config.addWord(word, { id, value: id })
140
+ config.addOperator(`([${id}|])`)
141
+ config.addBridge({ id, isA: ['hierarchiable'] })
142
+ }
143
+ }
144
+ ],
57
145
  };
58
146
 
147
+ const template = {
148
+ configs: [
149
+ ({config}) => {
150
+ config.addArgs(({config, api, isA}) => ({
151
+ addLatinNoun: ({ id, nominative, genetive, development }) => {
152
+ config.addOperator({ pattern: `([${id}|])`, development: development })
153
+ config.addBridge({ id, isA: ['hierarchiable'] })
154
+ const declensions = getDeclensions(nominative, genetive)
155
+ for (const declension of declensions) {
156
+ config.addWord(declension.word, { id, initial: { ...declension, development } })
157
+ }
158
+ }
159
+ }))
160
+ },
161
+ ({addLatinNoun}) => {
162
+ addLatinNoun({ id: 'davus_person', nominative: 'davus', development: true })
163
+ addLatinNoun({ id: 'titus_person', nominative: 'titus', development: true })
164
+ addLatinNoun({ id: 'pear_food', nominative: 'pirum', development: true })
165
+ addLatinNoun({ id: 'table_latin', nominative: 'mensa', development: true })
166
+ },
167
+ config,
168
+ ({addSuffix}) => addSuffix('que'),
169
+ ]
170
+ }
171
+
59
172
  knowledgeModule( {
60
- config,
173
+ config: { name: 'latin' },
174
+ // initializer,
61
175
  includes: [gdefaults],
62
176
 
63
177
  module,
64
- description: 'latin',
178
+ description: 'machina quae scriptum latinum intellegit et agit',
65
179
  test: {
66
180
  name: './latin.test.json',
67
181
  contents: latin_tests,
182
+ includes: {
183
+ words: {
184
+ literals: ['marcus'],
185
+ },
186
+ bridges: ['marcus'],
187
+ operators: ['([marcus|])'],
188
+ },
68
189
  checks: {
69
190
  context: [defaultContextCheck()],
70
191
  },
71
192
  },
193
+
194
+ template: {
195
+ template,
196
+ instance: latin_instance,
197
+ },
72
198
  })