class TwitterSom(OneToOneNode): def __init__(self, router, nodeDict): OneToOneNode.__init__(self, router, nodeDict) from backend.som import SOMBuilder self.som = SOMBuilder(k=20, map_size=tuple(self.node['_somsize'])) self.som.send = make_send(self, incr=False) def compute(self, data): self.som.on_message(data)
def handle_vector(self, vec, text): for eq, end, x, y in self.fixed: if text == eq or text.endswith(end): self.handle_fixed_vector(vec, text, x, y) SOMBuilder.handle_vector(self, vec, text, rratio=2, rstep=0.5, sratio=0.5, nbefore=True)
def __init__(self, fixed, *args, **kwargs): SOMBuilder.__init__(self, *args, **kwargs) self.fixed = fixed
def __init__(self, router, nodeDict): OneToOneNode.__init__(self, router, nodeDict) from backend.som import SOMBuilder self.som = SOMBuilder(k=20, map_size=tuple(self.node['_somsize'])) self.som.send = make_send(self, incr=False)