theprogrammablemind 7.10.0 → 7.10.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.
- package/client.js +280 -288
- package/demo.js +24 -24
- package/lines.js +2 -2
- package/package.json +1 -1
- package/runtime.js +2 -2
- package/src/config.js +261 -241
- package/src/digraph.js +9 -9
- package/src/digraph_internal.js +6 -6
- package/src/flatten.js +1 -1
- package/src/generators.js +41 -43
- package/src/helpers.js +57 -58
- package/src/project.js +6 -8
- package/src/semantics.js +40 -42
- package/src/unflatten.js +7 -7
package/src/unflatten.js
CHANGED
@@ -36,7 +36,7 @@ const concatLists = (l1, l2) => {
|
|
36
36
|
|
37
37
|
const findPropertyWithManyValues = (contexts, properties) => {
|
38
38
|
for (const property of properties) {
|
39
|
-
if (new Set(contexts.map(
|
39
|
+
if (new Set(contexts.map((context) => context[property])).size == 1) {
|
40
40
|
return property
|
41
41
|
}
|
42
42
|
}
|
@@ -77,23 +77,23 @@ class JSONSet {
|
|
77
77
|
// x wants and likes y C
|
78
78
|
|
79
79
|
const canonicalDefault = (value) => {
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
80
|
+
if (!value || !value.marker) {
|
81
|
+
return value
|
82
|
+
}
|
83
|
+
return { marker: value.marker, value: value.value, word: value.wordi, types: value.types }
|
84
84
|
}
|
85
85
|
|
86
86
|
// if properties null then check the contexts for unflatten property
|
87
87
|
const unflatten = (contexts, properties, canonical = canonicalDefault) => {
|
88
88
|
const grouped = {}
|
89
|
-
for (
|
89
|
+
for (const context of contexts) {
|
90
90
|
if (!grouped[context.marker]) {
|
91
91
|
grouped[context.marker] = []
|
92
92
|
}
|
93
93
|
grouped[context.marker].push(context)
|
94
94
|
}
|
95
95
|
let results = []
|
96
|
-
for (
|
96
|
+
for (const key in grouped) {
|
97
97
|
results = results.concat(unflattenHelper(grouped[key], properties || grouped[key][0].unflatten, canonical))
|
98
98
|
}
|
99
99
|
return results
|