Exemplo n.º 1
0
def analyze_generate():
    a = load_user_data(conf_path)
    dbSession = model.startSession(a)
    dec = decoder.Decoder()

    q = dbSession.query(model.Tweet)
    tq = q.filter(model.Tweet.isAnalyze < 2)[:10000]
    for t in tq:
        print(t.user, parse_text(t.text))
        print(dec.decode(parse_text(t.text)))
Exemplo n.º 2
0
def main():
    global session
    #sys.stdout = codecs.getwriter('utf_8')(sys.stdout)
    user = get_auth_data("config.json")
    session = model.startSession(user)

    #api = auth_api.connect(user["consumer_token"], user["consumer_secret"])
    #api = tweepy_connect.connect()
    if len(sys.argv) > 1:
        in_word = sys.argv[1].decode("utf-8")
    else:
        in_word = u"帰宅"
    pickup_reply(in_word)
Exemplo n.º 3
0
def staticGenerate():
    #sched = scheduler.Scheduler()
    #sched.schedule()
    u = LoadUserData(conf_path)
    dbSession = model.startSession(u)
    if False:
        if( sched.has_schedule() ):
            str = doSchedule(sched)
    else:
        q = dbSession.query(model.Condition)
        q2 = q.filter(model.Condition.name=="hunger")
        if q.count() == 0:
            c = model.Condition()
            c.name = "hunger"
            c.value ="1000"
            dbSession.save(c)
            dbSession.commit()
        else:
            cond = q2.one().value
            print cond
            sendMessage( u"おなかすいたー" )
        """if( rep.count() > 0 ):
Exemplo n.º 4
0
def staticGenerate():
    #sched = scheduler.Scheduler()
    #sched.schedule()
    u = LoadUserData(conf_path)
    dbSession = model.startSession(u)
    if False:
        if (sched.has_schedule()):
            str = doSchedule(sched)
    else:
        q = dbSession.query(model.Condition)
        q2 = q.filter(model.Condition.name == "hunger")
        if q.count() == 0:
            c = model.Condition()
            c.name = "hunger"
            c.value = "1000"
            dbSession.save(c)
            dbSession.commit()
        else:
            cond = q2.one().value
            print cond
            sendMessage(u"おなかすいたー")
        """if( rep.count() > 0 ):
Exemplo n.º 5
0
 def test_query(self):
     u = LoadUserData(conf_path)
     table = readReplyTableFile.read("../common/replyTable.json")
     session = model.startSession(u)
     rep = session.query(model.RetQueue)
     print reply.do2(table, rep, session)
Exemplo n.º 6
0
 def __init__(self, fileName=None):
     if fileName != None:
         self.user = getAuthData(fileName)
     observer.Listener.__init__(self)
     self.session = model.startSession()
Exemplo n.º 7
0
 def init_session(self):
     userdata = self.getAuthData("./config.json")
     self.dbSession = model.startSession(userdata)
Exemplo n.º 8
0
 def test_query(self):
     u = LoadUserData(conf_path)
     table = readReplyTableFile.read("../common/replyTable.json")
     session = model.startSession(u)
     rep = session.query(model.RetQueue)
     print reply.do2(table, rep, session)
Exemplo n.º 9
0
					if reverse:
						tmpList.append({"name":fq.now,"count":fq.count})
					else:
						tmpList.append({"name":fq.next,"count":fq.count})
				shuffleList = shuffleByCount(tmpList)
				for i in shuffleList:
					stack.append({"text":i["name"],"visit":False})

	#print ("ans")
	sentence = ""
	selectwordList = []
	if reverse : 
		stack.reverse()
		stack.pop()

	for s in stack:
		if s["visit"] == True:
			sa = s["text"]
			#print s
			sentence += sa
			selectwordList.append(sa)
	return sentence,selectwordList

if __name__ == "__main__":
	u = getAuthData(conf_path) 
	session = model.startSession(u)
	fs,sl1 = depthFirstSearch(session,"yystart","yyend",g_depthMax,False)
	bs,sl2 = depthFirstSearch(session,"yyend",  "yystart",g_depthMax,True)	
	print fs
	print bs
Exemplo n.º 10
0
                        tmpList.append({"name": fq.now, "count": fq.count})
                    else:
                        tmpList.append({"name": fq.next, "count": fq.count})
                shuffleList = shuffleByCount(tmpList)
                for i in shuffleList:
                    stack.append({"text": i["name"], "visit": False})

    #print ("ans")
    sentence = ""
    selectwordList = []
    if reverse:
        stack.reverse()
        stack.pop()

    for s in stack:
        if s["visit"] == True:
            sa = s["text"]
            #print s
            sentence += sa
            selectwordList.append(sa)
    return sentence, selectwordList


if __name__ == "__main__":
    u = getAuthData(conf_path)
    session = model.startSession(u)
    fs, sl1 = depthFirstSearch(session, "yystart", "yyend", g_depthMax, False)
    bs, sl2 = depthFirstSearch(session, "yyend", "yystart", g_depthMax, True)
    print fs
    print bs
Exemplo n.º 11
0
 def init_session(self):
     userdata = self.getAuthData("./config.json")
     self.dbSession = model.startSession(userdata)