示例#1
0
# -*- coding:UTF-8 -*-
"""
Created on Dec 26, 2013

@author: administrator
"""
import testTextrank
import pymongo
from emotionalDicAnalysis import emotionAnalysis

a = emotionAnalysis()

conn = pymongo.Connection("localhost", 27017)
db = conn.test
dbCollecton = db.purecontent

cursor = dbCollecton.find().limit(100)
testTextrank.wordAdd("/home/administrator/Python/dicLibrary/user.dic")
for sentence in cursor:
    print sentence["content"]
    summary = testTextrank.textrank(sentence["content"])
    if len(summary) > 1:
        print "分数:" + str(emotionAnalysis.calculateSentiment(a, summary))
示例#2
0
# -*- coding:UTF-8 -*-

import pymongo
import testTextrank
import filterWeibo
from emotionalDicAnalysis import emotionAnalysis

a = emotionAnalysis()

conn = pymongo.Connection('localhost',27017)
dbCollection = conn.test.database

cursor = dbCollection.find({"lanmu":"我是歌手"})
testTextrank.wordAdd('/home/administrator/Python/dicLibrary/user.dic')
for doc in cursor:
    neirong = filterWeibo.filtering(doc['content'])
    print "内容: "+neirong
    summary = testTextrank.textrank(neirong)
    if len(summary)>1:
        print "分数:"+ str(a.calculateSentiment(summary))
示例#3
0
#-*- coding:UTF-8 -*-
'''
Created on Dec 26, 2013

@author: administrator
'''
import testTextrank
import pymongo
from emotionalDicAnalysis import emotionAnalysis

a = emotionAnalysis()

conn = pymongo.Connection('localhost', 27017)
db = conn.test
dbCollecton = db.purecontent

cursor = dbCollecton.find().limit(100)
testTextrank.wordAdd('/home/administrator/Python/dicLibrary/user.dic')
for sentence in cursor:
    print sentence['content']
    summary = testTextrank.textrank(sentence["content"])
    if len(summary) > 1:
        print "分数:" + str(emotionAnalysis.calculateSentiment(a, summary))
示例#4
0
# -*- coding:UTF-8 -*-

import pymongo
import testTextrank
import filterWeibo
from emotionalDicAnalysis import emotionAnalysis

a = emotionAnalysis()

conn = pymongo.Connection('localhost', 27017)
dbCollection = conn.test.database

cursor = dbCollection.find({"lanmu": "我是歌手"})
testTextrank.wordAdd('/home/administrator/Python/dicLibrary/user.dic')
for doc in cursor:
    neirong = filterWeibo.filtering(doc['content'])
    print "内容: " + neirong
    summary = testTextrank.textrank(neirong)
    if len(summary) > 1:
        print "分数:" + str(a.calculateSentiment(summary))