tpmkms 8.0.0-beta.39 → 8.0.0-beta.40
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/nameable.js +10 -3
- package/common/stm.js +21 -13
- package/package.json +2 -2
package/common/nameable.js
CHANGED
@@ -21,8 +21,15 @@ class API {
|
|
21
21
|
context.stm.names.push(name)
|
22
22
|
}
|
23
23
|
|
24
|
-
get(name) {
|
25
|
-
return this.
|
24
|
+
get(type, name) {
|
25
|
+
return this.args.kms.stm.api.mentions({
|
26
|
+
context: type,
|
27
|
+
condition: (context) => {
|
28
|
+
if (context.stm && context.stm.names) {
|
29
|
+
return context.stm.names.includes(name)
|
30
|
+
}
|
31
|
+
}
|
32
|
+
})
|
26
33
|
}
|
27
34
|
|
28
35
|
getNamesByType(type) {
|
@@ -96,7 +103,7 @@ const configStruct = {
|
|
96
103
|
// TODO find report being referred to
|
97
104
|
const nameable = (await e(context.nameable)).evalue
|
98
105
|
const name = context.name.text
|
99
|
-
config.addWord(name, { id: nameable.marker, initial: `{ value: "${
|
106
|
+
config.addWord(name, { id: nameable.marker, initial: `{ value: "${name}", pullFromContext: true, nameable_named: true }` })
|
100
107
|
api.setName(nameable, name)
|
101
108
|
}
|
102
109
|
},
|
package/common/stm.js
CHANGED
@@ -65,18 +65,20 @@ class API {
|
|
65
65
|
this._objects.mentioned.unshift(concept)
|
66
66
|
}
|
67
67
|
|
68
|
-
mentions({ context, useHierarchy=true } = {}) {
|
68
|
+
mentions({ context, useHierarchy=true, condition = (() => true) } = {}) {
|
69
69
|
const findPrevious = !!context.stm_previous
|
70
70
|
|
71
71
|
// care about value first
|
72
72
|
let findCounter = 0
|
73
73
|
for (let m of this._objects.mentioned) {
|
74
74
|
if (context.value && (context.value == m.marker || context.value == m.value)) {
|
75
|
-
|
76
|
-
|
75
|
+
findCounter += 1
|
76
|
+
if (findPrevious && findCounter < 2) {
|
77
77
|
continue
|
78
78
|
}
|
79
|
-
|
79
|
+
if (condition()) {
|
80
|
+
return m
|
81
|
+
}
|
80
82
|
}
|
81
83
|
}
|
82
84
|
|
@@ -88,21 +90,25 @@ class API {
|
|
88
90
|
findCounter = 0
|
89
91
|
for (let m of this._objects.mentioned) {
|
90
92
|
if (context.marker != 'unknown' && this.isA(m.marker, context.marker)) {
|
91
|
-
|
92
|
-
|
93
|
+
findCounter += 1
|
94
|
+
if (findPrevious && findCounter < 2) {
|
93
95
|
continue
|
94
96
|
}
|
95
|
-
|
97
|
+
if (condition(m)) {
|
98
|
+
return m
|
99
|
+
}
|
96
100
|
}
|
97
101
|
// if (context.types && context.types.includes(m.marker)) {
|
98
102
|
if (context.types) {
|
99
103
|
for (let parent of context.types) {
|
100
104
|
if (parent != 'unknown' && this.isA(m.marker, parent)) {
|
101
|
-
|
102
|
-
|
105
|
+
findCounter += 1
|
106
|
+
if (findPrevious && findCounter < 2) {
|
103
107
|
continue
|
104
108
|
}
|
105
|
-
|
109
|
+
if (condition(m)) {
|
110
|
+
return m
|
111
|
+
}
|
106
112
|
}
|
107
113
|
}
|
108
114
|
}
|
@@ -112,11 +118,13 @@ class API {
|
|
112
118
|
if (context.types && context.types.length == 1) {
|
113
119
|
for (let m of this._objects.mentioned) {
|
114
120
|
if (context.unknown) {
|
115
|
-
|
116
|
-
|
121
|
+
findCounter += 1
|
122
|
+
if (findPrevious && findCounter < 2) {
|
117
123
|
continue
|
118
124
|
}
|
119
|
-
|
125
|
+
if (condition(m)) {
|
126
|
+
return m
|
127
|
+
}
|
120
128
|
}
|
121
129
|
}
|
122
130
|
}
|
package/package.json
CHANGED
@@ -291,8 +291,8 @@
|
|
291
291
|
"table": "^6.7.1",
|
292
292
|
"base-64": "^1.0.0",
|
293
293
|
"argparse": "^2.0.1",
|
294
|
-
"theprogrammablemind": "8.0.0-beta.
|
294
|
+
"theprogrammablemind": "8.0.0-beta.40"
|
295
295
|
},
|
296
|
-
"version": "8.0.0-beta.
|
296
|
+
"version": "8.0.0-beta.40",
|
297
297
|
"license": "UNLICENSED"
|
298
298
|
}
|