def load_blog(conn): cursor = conn.cursor() cursor.execute("select a.blogid, a.uid, a.subject, a.dateline, b.message from ihome_blog a left join ihome_blogfield b on a.blogid = b.blogid") rows = cursor.fetchall() for row in rows: parts = [] if row[2]: parts = SegUtil.seg(row[2].encode("utf8")) if row[4]: parts.extend(SegUtil.seg(row[4].encode("utf8"))) for p in parts: if p[1] == 'ns' or p[1] == 'nr' or p[1] == 'nt' or p[1] == 'n': if p[0] not in tags: tags[p[0]] = [0, 0, 0] tags[p[0]][0] += 1 tags[p[0]][1] += 1 cursor.close()
def load_blog(conn): cursor = conn.cursor() cursor.execute("select a.blogid, a.uid, a.subject, a.dateline, b.message from ihome_blog a left join ihome_blogfield b on a.blogid = b.blogid where a.dateline > %d" % start_time) rows = cursor.fetchall() for row in rows: parts = [] if row[2]: parts = SegUtil.seg(row[2].encode("utf8")) if row[4]: parts.extend(SegUtil.seg(row[4].encode("utf8"))) for p in parts: if p[1] == 'ns' or p[1] == 'nr' or p[1] == 'nt' or p[1] == 'n': if len(p[0]) <= 0: continue if p[0] not in tags: tags[p[0]] = [0, 0, 0] tags[p[0]][0] += 1 tags[p[0]][1] += 1 cursor.close()
def load_complain(conn,date): cursor = conn.cursor() cursor.execute("select doid,uid,message,datatime from ihome_complain where datatime="+date) rows = cursor.fetchall() for row in rows: parts = [] if row[2]: parts = SegUtil.seg(row[2].encode("utf8")) for p in parts: if p[1] == 'ns' or p[1] == 'nr' or p[1] == 'nt' or p[1] == 'n': if p[0] not in tags: tags[p[0]] = [0, 0, 0] tags[p[0]][0] += 1 tags[p[0]][2] += 1 cursor.close()
def load_complain(conn): cursor = conn.cursor() cursor.execute("select doid,uid,message,addtime from ihome_complain ") rows = cursor.fetchall() for row in rows: parts = [] if row[2]: parts = SegUtil.seg(row[2].encode("utf8")) for p in parts: if p[1] == 'ns' or p[1] == 'nr' or p[1] == 'nt' or p[1] == 'n': if p[0] not in tags: tags[p[0]] = [0, 0, 0] tags[p[0]][0] += 1 tags[p[0]][2] += 1 cursor.close()
def load_doing(conn): cursor = conn.cursor() cursor.execute( "select a.doid, a.uid, a.message, a.dateline from ihome_doing a") rows = cursor.fetchall() for row in rows: parts = [] if row[2]: parts = SegUtil.seg(row[2].encode("utf8")) for p in parts: if p[1] == 'ns' or p[1] == 'nr' or p[1] == 'nt' or p[1] == 'n': if p[0] not in tags: tags[p[0]] = [0, 0, 0] tags[p[0]][0] += 1 tags[p[0]][2] += 1 cursor.close()
def load_doing(conn): cursor = conn.cursor() cursor.execute("select a.doid, a.uid, a.message, a.dateline from ihome_doing a") rows = cursor.fetchall() for row in rows: parts = [] if row[2]: parts = SegUtil.seg(row[2].encode("utf8")) for p in parts: if p[1] == 'ns' or p[1] == 'nr' or p[1] == 'nt' or p[1] == 'n': if p[0] not in tags: tags[p[0]] = [0, 0, 0] tags[p[0]][0] += 1 tags[p[0]][2] += 1 cursor.close()