Esempio n. 1
0
def oneS(document):
    grades = {"注册会员":1,"铁牌会员":2,"铜牌会员":3,"银牌会员":4,"金牌会员":5,"钻石会员":6,"双钻石会员":7,"企业客户":8}
    timeSTR,vip,votes,length,text = dict2review(document)
    vip = vip.encode('utf8')
    vip = grades[vip]
    print "votes",votes
    print length
    print text
    text = text.encode("utf8")
    
    seged = seg(text)
    posed = pos(seged)
    npOP,fCNT = opinionSEARCH3(posed)
    
    ## time
    now = datetime.now()
    stime = time.strptime(timeSTR, "%Y-%m-%d %H:%M")
    dt = datetime.fromtimestamp(mktime(stime))
    timeduration = str(now - dt)
    days =  timeduration.split()[0]
    
    
    sentiment = sentiFLY(text)
    ## digitalized indicators
    print vip,votes,days,length,fCNT,sentiment
    return vip,votes,days,length,fCNT,sentiment
Esempio n. 2
0
def oneS(document):
    grades = {
        "注册会员": 1,
        "铁牌会员": 2,
        "铜牌会员": 3,
        "银牌会员": 4,
        "金牌会员": 5,
        "钻石会员": 6,
        "双钻石会员": 7,
        "企业客户": 8
    }
    timeSTR, vip, votes, length, text = dict2review(document)
    vip = vip.encode('utf8')
    vip = grades[vip]
    print "votes", votes
    print length
    print text
    text = text.encode("utf8")

    seged = seg(text)
    posed = pos(seged)
    npOP, fCNT = opinionSEARCH3(posed)

    ## time
    now = datetime.now()
    stime = time.strptime(timeSTR, "%Y-%m-%d %H:%M")
    dt = datetime.fromtimestamp(mktime(stime))
    timeduration = str(now - dt)
    days = timeduration.split()[0]

    sentiment = sentiFLY(text)
    ## digitalized indicators
    print vip, votes, days, length, fCNT, sentiment
    return vip, votes, days, length, fCNT, sentiment
Esempio n. 3
0
def fetchFstat():
    db = dbCON('192.168.0.155',27017,'jd')
    print db
    coll = db['mobile_evaluation']
    qresult = coll.find({"pid": "1022456996"})
    #starsSTAT(db,'mobile_evaluation',"1022456996")
    
    ##feature dictionary to store the feature statistic result
    fdict = {}
    for i in qresult:
        text = i['opnion'].encode("utf8")
        seged = seg(text)
        try:
            posed = pos(seged)
        except:
            print "oopsss"
        npop = opinionSEARCH3(posed)[0]  
        if npop:
            for j in npop:
                countSTREAM(j,fdict)
    showCOUNT(fdict)
    return fdict
Esempio n. 4
0
def fetchFstat():
    db = dbCON('192.168.0.155', 27017, 'jd')
    print db
    coll = db['mobile_evaluation']
    qresult = coll.find({"pid": "1022456996"})
    #starsSTAT(db,'mobile_evaluation',"1022456996")

    ##feature dictionary to store the feature statistic result
    fdict = {}
    for i in qresult:
        text = i['opnion'].encode("utf8")
        seged = seg(text)
        try:
            posed = pos(seged)
        except:
            print "oopsss"
        npop = opinionSEARCH3(posed)[0]
        if npop:
            for j in npop:
                countSTREAM(j, fdict)
    showCOUNT(fdict)
    return fdict