Semantic Pointer vocab


I don’t understand the ff: code:

D = 8
model = spa.SPA(seed = 4)
with model:
   model.vocab = spa.Vocabulary(D)
   Fruit = ['CHERRY', 'APPLE', 'PEAR']
   for word in Fruit:

I get an error I doesn’t recognize CHERRY


CHERRY = model.vocab.parse('CHERRY')


yields the appropriate vector

It seems that for many models - including the AssociativeMemory model on the web site, the initial code is used.

What am I missing?



In the first case CHERRY is not an assigned variable. You either need to write print(model.vocab['CHERRY']), print(model.vocab.parse('CHERRY')), or do what you did in the second case where you assign the semantic pointer to an actual variable in your namespace.