tpmkms_4wp 9.4.5-beta.3 → 9.4.5-beta.5

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/common/latin.js CHANGED
@@ -1,7 +1,9 @@
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
@@ -10,23 +12,109 @@ const latin_tests = require('./latin.test.json')
10
12
 
11
13
  estne
12
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)
13
26
  */
14
27
  const config = {
15
- name: 'latin',
16
28
  operators: [
17
- "((hierarchy/*) [queryMarker])",
29
+ "((hierarchy/*) [queryMarker|ne])",
18
30
  "([hierarchiable])",
19
31
  "((hierarchiable) [hierarchy|] (hierarchiable))",
20
32
  "((hierarchiable) (hierarchiable) [hierarchy|])",
21
33
  "([hierarchy|] (hierarchiable) (hierarchiable))",
34
+
35
+ "(x [list|et] y)",
36
+ "((listable/*) [listMarker|que])",
37
+
38
+ // "([inLatin|in] (context.declension == 'ablative' || context.declension == 'accusative'))"
22
39
  ],
23
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
+
24
106
  {
25
107
  id: "queryMarker",
26
- bridge: "{ ...before[0], question: true }",
108
+ bridge: "{ ...before[0], verb: before[0], interpolate: [before[0], '', operator], question: true }",
27
109
  separators: '|',
28
110
  before: ['hierarchy'],
29
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
+ },
30
118
  { id: "hierarchiable" },
31
119
  {
32
120
  id: "hierarchy",
@@ -42,28 +130,48 @@ const config = {
42
130
  ]
43
131
  },
44
132
  ],
45
- words: {
46
- literals: {
47
- "ne": [
48
- {
49
- id: 'queryMarker',
50
- initial: { value: 'queryMarker' },
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
+ ],
145
+ };
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
+ }
51
158
  }
52
- ],
159
+ }))
53
160
  },
54
- /*
55
- patterns: [
56
- {
57
- pattern: ["ne"],
58
- defs: [ { id: "queryMarker", uuid: '1', }, ],
59
- },
60
- ],
61
- */
62
- },
63
- };
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
+ }
64
171
 
65
172
  knowledgeModule( {
66
- config,
173
+ config: { name: 'latin' },
174
+ // initializer,
67
175
  includes: [gdefaults],
68
176
 
69
177
  module,
@@ -71,8 +179,20 @@ knowledgeModule( {
71
179
  test: {
72
180
  name: './latin.test.json',
73
181
  contents: latin_tests,
182
+ includes: {
183
+ words: {
184
+ literals: ['marcus'],
185
+ },
186
+ bridges: ['marcus'],
187
+ operators: ['([marcus|])'],
188
+ },
74
189
  checks: {
75
190
  context: [defaultContextCheck()],
76
191
  },
77
192
  },
193
+
194
+ template: {
195
+ template,
196
+ instance: latin_instance,
197
+ },
78
198
  })