tpmkms_4wp 9.5.1-beta.13 → 9.5.1-beta.14
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/words.instance.json +2 -0
- package/common/words.js +53 -0
- package/common/words.test.json +2 -0
- package/package.json +5 -2
package/common/words.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const { knowledgeModule, where } = require('./runtime').theprogrammablemind
|
|
2
|
+
const { defaultContextCheck } = require('./helpers')
|
|
3
|
+
const words_tests = require('./words.test.json')
|
|
4
|
+
const words_instance = require('./words.instance.json')
|
|
5
|
+
const tokenize = require('./tokenize')
|
|
6
|
+
|
|
7
|
+
function initializer({objects, config, isModule}) {
|
|
8
|
+
objects.words = []
|
|
9
|
+
config.addArgs((args) => ({
|
|
10
|
+
getWordFromDictionary: (partial) => {
|
|
11
|
+
for (const word of objects.words) {
|
|
12
|
+
let matches = true
|
|
13
|
+
for (const key in partial) {
|
|
14
|
+
if (partial[key] !== word[key]) {
|
|
15
|
+
matches = false
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
if (matches) {
|
|
19
|
+
return word
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
addWordToDictionary: (context) => {
|
|
24
|
+
objects.words.push(context)
|
|
25
|
+
}
|
|
26
|
+
}))
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const template = {
|
|
30
|
+
configs: [],
|
|
31
|
+
fragments: [],
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
knowledgeModule( {
|
|
35
|
+
config: { name: 'words' },
|
|
36
|
+
includes: [tokenize],
|
|
37
|
+
initializer,
|
|
38
|
+
|
|
39
|
+
module,
|
|
40
|
+
description: 'talking about words',
|
|
41
|
+
test: {
|
|
42
|
+
name: './words.test.json',
|
|
43
|
+
contents: words_tests,
|
|
44
|
+
checks: {
|
|
45
|
+
context: [defaultContextCheck()],
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
template: {
|
|
49
|
+
template,
|
|
50
|
+
instance: words_instance,
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
})
|
package/package.json
CHANGED
|
@@ -333,6 +333,9 @@
|
|
|
333
333
|
"common/weight.instance.json",
|
|
334
334
|
"common/weight.js",
|
|
335
335
|
"common/weight.test.json",
|
|
336
|
+
"common/words.instance.json",
|
|
337
|
+
"common/words.js",
|
|
338
|
+
"common/words.test.json",
|
|
336
339
|
"common/wp.instance.json",
|
|
337
340
|
"common/wp.js",
|
|
338
341
|
"common/wp.test.json",
|
|
@@ -354,8 +357,8 @@
|
|
|
354
357
|
"scriptjs": "^2.5.9",
|
|
355
358
|
"table": "^6.7.1",
|
|
356
359
|
"uuid": "^9.0.0",
|
|
357
|
-
"theprogrammablemind_4wp": "9.5.1-beta.
|
|
360
|
+
"theprogrammablemind_4wp": "9.5.1-beta.14"
|
|
358
361
|
},
|
|
359
|
-
"version": "9.5.1-beta.
|
|
362
|
+
"version": "9.5.1-beta.14",
|
|
360
363
|
"license": "UNLICENSED"
|
|
361
364
|
}
|