Here is the python:
-- in the ket class: def find_topic(self,context,op): return context.map_to_topic(self,op) -- in the superposition class: def find_topic(self,context,op): result = superposition() for x in self.data: result += context.map_to_topic(x,op) # .drop_below(min) here too? r = result.normalize(100).coeff_sort() return r -- in the new_context class: def map_to_topic(self,e,op,t=0): if type(op) == ket: op = op.label[4:] result = superposition() for label in self.ket_rules_dict: if op in self.ket_rules_dict[label]: frequency_list = self.recall(op,label,True) value = normed_frequency_class(e,frequency_list) if value > t: result.data.append(ket(label,value)) # "result += ket(label,value)" when swap in fast_superposition return result.normalize(100).coeff_sort()I guess that is it. Though I suppose how the algo works, given the above python, is somewhat opaque. Examples in the next few posts.
No comments:
Post a Comment