Exemplo n.º 1
0
 def __init__(self, router, nodeDict):
     OneToOneNode.__init__(self, router, nodeDict)
     self.snoc = SocNOC()
     self.snoc.send = make_send(self)
     if '_categories' in self.node:
         with open('backend/affect.pickle') as affect_file:
             self.snoc.categories = dict(self.node['_categories'], affect=pickle.load(affect_file))
Exemplo n.º 2
0
class TwitterProcess(OneToOneNode):
    def __init__(self, router, nodeDict):
        OneToOneNode.__init__(self, router, nodeDict)
        self.snoc = SocNOC()
        self.snoc.send = make_send(self)
        if '_categories' in self.node:
            with open('backend/affect.pickle') as affect_file:
                self.snoc.categories = dict(self.node['_categories'], affect=pickle.load(affect_file))
    
    def compute(self, data):
        self.snoc.receive_tweet(**data)
Exemplo n.º 3
0
class BlogProcess(OneToOneNode):
    def __init__(self, router, nodeDict):
        OneToOneNode.__init__(self, router, nodeDict)
        self.snoc = SocNOC(k=10, spicefreq=0, cnetfreq=0)
        self.snoc.send = make_send(self)
        if '_categories' in self.node:
            with open('backend/affect.pickle') as affect_file:
                self.snoc.categories = dict(self.node['_categories'], affect=pickle.load(affect_file))
    
    def compute(self, data):
        self.snoc.process_post(**data)
Exemplo n.º 4
0
 def read(feed, url, tag):
     try:
         item = next(feed)
     except StopIteration:
         reactor.callLater(random(), get, url, tag)
     else:
         post = SocNOC.process_feed_item(item)
         if isinstance(post, basestring):
             send(dict(post=post, word=tag))
         reactor.callLater(random(), read, feed, url, tag)