tpmkms_4wp 9.5.1-beta.30 → 9.5.1-beta.31

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/meta.js CHANGED
@@ -296,6 +296,7 @@ const config = {
296
296
  }
297
297
  if (context.to.value) {
298
298
  kms.stm.api.setVariable(context.from.value, context.to.value)
299
+ // config.addWord(context.from.word, context.to)
299
300
  } else {
300
301
  await kms.dialogues.api.makeObject({ context: context.from, types: context.to.types || [], config });
301
302
  kms.stm.api.setVariable(context.from.value, context.to)
@@ -1,5 +1,5 @@
1
1
  const { knowledgeModule, where } = require('./runtime').theprogrammablemind
2
- const { defaultContextCheck } = require('./helpers')
2
+ const { defaultContextCheck, defaultContextCheckProperties } = require('./helpers')
3
3
  const helpers = require('./helpers')
4
4
  const stm = require('./stm')
5
5
  const nameable_tests = require('./nameable.test.json')
@@ -107,19 +107,26 @@ const config = {
107
107
  id: 'call',
108
108
  isA: ['verb'],
109
109
  bridge: "{ ...next(operator), nameable: after[0], name: after[1:][0] }",
110
- // bridge: "{ ...next(operator), nameable: after[0], name: after[1] }",
111
- // generatorp: async ({context, g}) => `call ${await g(context.nameable)} ${await g(context.name)}`,
112
110
  generatorp: async ({context, g, gs}) => `call ${await g(context.nameable)} ${await gs(context.name)}`,
113
- semantic: async ({config, context, api, e}) => {
111
+ semantic: async ({config, context, api, e, verbatim, g}) => {
114
112
  // TODO find report being referred to
115
113
  const nameable = (await e(context.nameable)).evalue
114
+ if (!nameable) {
115
+ verbatim(`${await g(context.nameable)} is not known`)
116
+ return
117
+ }
116
118
  const name = context.name.map((n) => n.text).join(' ')
117
119
  // const name = context.name.text
118
120
  config.addWord(name, { id: nameable.marker, initial: `{ value: "${name}", pullFromContext: true, nameable_named: true }` })
119
121
  api.setName(nameable, name)
120
- }
122
+ },
123
+ check: defaultContextCheckProperties(['nameable', 'name']),
124
+ },
125
+ {
126
+ id: 'nameable',
127
+ words: helpers.words('nameable'),
128
+ children: ['thisitthat'],
121
129
  },
122
- { id: 'nameable', words: helpers.words('nameable')},
123
130
  ]
124
131
  }
125
132
 
@@ -6862,5 +6862,441 @@
6862
6862
  ]
6863
6863
  }
6864
6864
  ]
6865
+ },
6866
+ {
6867
+ "associations": [
6868
+ [
6869
+ [
6870
+ "call",
6871
+ 0
6872
+ ],
6873
+ [
6874
+ "nameable",
6875
+ 0
6876
+ ],
6877
+ [
6878
+ "unknown",
6879
+ 0
6880
+ ]
6881
+ ]
6882
+ ],
6883
+ "config": {
6884
+ "words": {
6885
+ "hierarchy": [
6886
+ ],
6887
+ "literals": {
6888
+ "\"": [
6889
+ {
6890
+ "id": "doubleQuote",
6891
+ "initial": "{\"word\":\"\\\"\",\"depth\":\"+\"}",
6892
+ "word": "\""
6893
+ }
6894
+ ],
6895
+ "(": [
6896
+ {
6897
+ "id": "leftParenthesis",
6898
+ "initial": "{\"word\":\"(\",\"value\":\"(\",\"depth\":\"+\"}",
6899
+ "word": "("
6900
+ }
6901
+ ],
6902
+ ")": [
6903
+ {
6904
+ "id": "rightParenthesis",
6905
+ "initial": "{\"word\":\")\",\"value\":\")\",\"depth\":\"-\"}",
6906
+ "word": ")"
6907
+ }
6908
+ ],
6909
+ ",": [
6910
+ {
6911
+ "id": "comma",
6912
+ "initial": "{\"word\":\",\",\"value\":\",\",\"depth\":\"+\"}",
6913
+ "word": ","
6914
+ }
6915
+ ],
6916
+ ".": [
6917
+ {
6918
+ "id": "endOfSentence",
6919
+ "initial": "{ value: \"endOfSentence\"}"
6920
+ }
6921
+ ],
6922
+ ":": [
6923
+ {
6924
+ "id": "colon",
6925
+ "initial": "{ value: \"colon\"}"
6926
+ }
6927
+ ],
6928
+ "memorable": [
6929
+ {
6930
+ "id": "memorable",
6931
+ "initial": "{\"word\":\"memorable\",\"number\":\"one\"}",
6932
+ "word": "memorable"
6933
+ }
6934
+ ],
6935
+ "memorables": [
6936
+ {
6937
+ "id": "memorable",
6938
+ "initial": "{\"word\":\"memorables\",\"number\":\"many\"}",
6939
+ "word": "memorables"
6940
+ }
6941
+ ],
6942
+ "nameable": [
6943
+ {
6944
+ "id": "nameable",
6945
+ "initial": "{\"word\":\"nameable\",\"number\":\"one\"}",
6946
+ "word": "nameable"
6947
+ }
6948
+ ],
6949
+ "nameables": [
6950
+ {
6951
+ "id": "nameable",
6952
+ "initial": "{\"word\":\"nameables\",\"number\":\"many\"}",
6953
+ "word": "nameables"
6954
+ }
6955
+ ],
6956
+ "the": [
6957
+ {
6958
+ "id": "the",
6959
+ "initial": "{ modifiers: [] }"
6960
+ }
6961
+ ]
6962
+ },
6963
+ "patterns": [
6964
+ ]
6965
+ }
6966
+ },
6967
+ "contexts": [
6968
+ {
6969
+ "context_id": 2,
6970
+ "context_index": 1,
6971
+ "dead": true,
6972
+ "default": true,
6973
+ "level": 1,
6974
+ "marker": "call",
6975
+ "name": [
6976
+ {
6977
+ "dead": true,
6978
+ "level": 0,
6979
+ "marker": "unknown",
6980
+ "range": {
6981
+ "end": 17,
6982
+ "start": 14
6983
+ },
6984
+ "text": "fred",
6985
+ "unknown": true,
6986
+ "value": "fred",
6987
+ "word": "fred"
6988
+ }
6989
+ ],
6990
+ "nameable": {
6991
+ "dead": true,
6992
+ "level": 0,
6993
+ "marker": "nameable",
6994
+ "number": "one",
6995
+ "range": {
6996
+ "end": 12,
6997
+ "start": 5
6998
+ },
6999
+ "text": "nameable",
7000
+ "types": [
7001
+ "nameable"
7002
+ ],
7003
+ "word": "nameable"
7004
+ },
7005
+ "range": {
7006
+ "end": 17,
7007
+ "start": 0
7008
+ },
7009
+ "text": "call nameable fred",
7010
+ "topLevel": true,
7011
+ "touchedBy": [
7012
+ "nameable#call2"
7013
+ ],
7014
+ "value": "call",
7015
+ "word": "call"
7016
+ },
7017
+ {
7018
+ "context_id": 3,
7019
+ "isResponse": true,
7020
+ "marker": "verbatim",
7021
+ "topLevel": true,
7022
+ "verbatim": "nameable is not known"
7023
+ }
7024
+ ],
7025
+ "developerTest": false,
7026
+ "generatedParenthesized": [
7027
+ "",
7028
+ "(nameable is not known)"
7029
+ ],
7030
+ "metadata": {
7031
+ "opChoices": [
7032
+ {
7033
+ "counter": 1,
7034
+ "op": [
7035
+ "unknown",
7036
+ 0
7037
+ ],
7038
+ "ops": [
7039
+ [
7040
+ "call",
7041
+ 0
7042
+ ],
7043
+ [
7044
+ "unknown",
7045
+ 0
7046
+ ]
7047
+ ]
7048
+ },
7049
+ {
7050
+ "counter": 2,
7051
+ "op": [
7052
+ "call",
7053
+ 0
7054
+ ],
7055
+ "ops": [
7056
+ [
7057
+ "call",
7058
+ 0
7059
+ ]
7060
+ ]
7061
+ }
7062
+ ]
7063
+ },
7064
+ "objects": {
7065
+ "nameToUUID": {
7066
+ "articles": "articles2",
7067
+ "evaluate": "evaluate2",
7068
+ "gdefaults": "gdefaults2",
7069
+ "nameable": "nameable1",
7070
+ "pos": "pos2",
7071
+ "punctuation": "punctuation2",
7072
+ "stm": "stm2",
7073
+ "tokenize": "tokenize2",
7074
+ "words": "words2"
7075
+ },
7076
+ "namespaced": {
7077
+ "articles2": {
7078
+ "km": "articles2"
7079
+ },
7080
+ "evaluate2": {
7081
+ "km": "evaluate2"
7082
+ },
7083
+ "gdefaults2": {
7084
+ "km": "gdefaults2"
7085
+ },
7086
+ "nameable1": {
7087
+ "km": "nameable1",
7088
+ "named": {
7089
+ }
7090
+ },
7091
+ "pos2": {
7092
+ "km": "pos2"
7093
+ },
7094
+ "punctuation2": {
7095
+ "km": "punctuation2"
7096
+ },
7097
+ "stm2": {
7098
+ "km": "stm2",
7099
+ "mentioned": [
7100
+ ],
7101
+ "variables": {
7102
+ }
7103
+ },
7104
+ "tokenize2": {
7105
+ "km": "tokenize2"
7106
+ },
7107
+ "words2": {
7108
+ "km": "words2",
7109
+ "words": [
7110
+ ]
7111
+ }
7112
+ },
7113
+ "processed": [
7114
+ {
7115
+ "context": {
7116
+ "context_id": 3,
7117
+ "isResponse": true,
7118
+ "marker": "verbatim",
7119
+ "topLevel": true,
7120
+ "verbatim": "nameable is not known"
7121
+ },
7122
+ "generatedParenthesized": [
7123
+ ],
7124
+ "paraphrases": [
7125
+ ],
7126
+ "paraphrasesParenthesized": [
7127
+ ],
7128
+ "responses": [
7129
+ "",
7130
+ "nameable is not known"
7131
+ ]
7132
+ },
7133
+ {
7134
+ "context": {
7135
+ "context_id": 2,
7136
+ "context_index": 1,
7137
+ "dead": true,
7138
+ "default": true,
7139
+ "level": 1,
7140
+ "marker": "call",
7141
+ "name": [
7142
+ {
7143
+ "dead": true,
7144
+ "level": 0,
7145
+ "marker": "unknown",
7146
+ "range": {
7147
+ "end": 17,
7148
+ "start": 14
7149
+ },
7150
+ "text": "fred",
7151
+ "unknown": true,
7152
+ "value": "fred",
7153
+ "word": "fred"
7154
+ }
7155
+ ],
7156
+ "nameable": {
7157
+ "dead": true,
7158
+ "level": 0,
7159
+ "marker": "nameable",
7160
+ "number": "one",
7161
+ "range": {
7162
+ "end": 12,
7163
+ "start": 5
7164
+ },
7165
+ "text": "nameable",
7166
+ "types": [
7167
+ "nameable"
7168
+ ],
7169
+ "word": "nameable"
7170
+ },
7171
+ "range": {
7172
+ "end": 17,
7173
+ "start": 0
7174
+ },
7175
+ "text": "call nameable fred",
7176
+ "topLevel": true,
7177
+ "touchedBy": [
7178
+ "nameable#call2"
7179
+ ],
7180
+ "value": "call",
7181
+ "word": "call"
7182
+ },
7183
+ "generatedParenthesized": [
7184
+ ],
7185
+ "paraphrases": [
7186
+ ],
7187
+ "paraphrasesParenthesized": [
7188
+ ],
7189
+ "responses": [
7190
+ "",
7191
+ "nameable is not known"
7192
+ ]
7193
+ }
7194
+ ]
7195
+ },
7196
+ "paraphrases": [
7197
+ "call nameable fred",
7198
+ "nameable is not known"
7199
+ ],
7200
+ "paraphrasesParenthesized": [
7201
+ "(call (nameable) (fred))",
7202
+ "(nameable is not known)"
7203
+ ],
7204
+ "query": "call nameable fred",
7205
+ "responses": [
7206
+ "",
7207
+ "nameable is not known"
7208
+ ],
7209
+ "summaries": [
7210
+ {
7211
+ "length": 1,
7212
+ "summaries": [
7213
+ {
7214
+ "counter": 1,
7215
+ "operators": [
7216
+ {
7217
+ "marker": [
7218
+ "call",
7219
+ 0
7220
+ ],
7221
+ "range": {
7222
+ "end": 3,
7223
+ "start": 0
7224
+ }
7225
+ },
7226
+ {
7227
+ "marker": [
7228
+ "nameable",
7229
+ 0
7230
+ ],
7231
+ "range": {
7232
+ "end": 12,
7233
+ "start": 5
7234
+ }
7235
+ },
7236
+ {
7237
+ "marker": [
7238
+ "unknown",
7239
+ 0
7240
+ ],
7241
+ "range": {
7242
+ "end": 17,
7243
+ "start": 14
7244
+ }
7245
+ }
7246
+ ]
7247
+ },
7248
+ {
7249
+ "counter": 2,
7250
+ "operators": [
7251
+ {
7252
+ "marker": [
7253
+ "call",
7254
+ 0
7255
+ ],
7256
+ "range": {
7257
+ "end": 3,
7258
+ "start": 0
7259
+ }
7260
+ },
7261
+ {
7262
+ "marker": [
7263
+ "nameable",
7264
+ 0
7265
+ ],
7266
+ "range": {
7267
+ "end": 12,
7268
+ "start": 5
7269
+ }
7270
+ },
7271
+ {
7272
+ "marker": [
7273
+ "unknown",
7274
+ 0
7275
+ ],
7276
+ "range": {
7277
+ "end": 17,
7278
+ "start": 14
7279
+ }
7280
+ }
7281
+ ]
7282
+ },
7283
+ {
7284
+ "counter": 3,
7285
+ "operators": [
7286
+ {
7287
+ "marker": [
7288
+ "call",
7289
+ 1
7290
+ ],
7291
+ "range": {
7292
+ "end": 17,
7293
+ "start": 0
7294
+ }
7295
+ }
7296
+ ]
7297
+ }
7298
+ ]
7299
+ }
7300
+ ]
6865
7301
  }
6866
7302
  ]