示例#1
0
def load_subject_weibo_data():
    """加载客观微博数据
    """
    # topicname = u'外滩踩踏-微博'
    # topicname = u'呼格案-微博'
    # topicname = u'复旦投毒案-微博'
    topicname = u'APEC-微博'

    em = EventManager()
    topicid = em.getEventIDByName(topicname)
    event = Event(topicid)

    # f = open('caitai.jl')
    # f = open('huge.jl')
    # f = open('fudan.jl')
    f = open('apec.jl')
    for line in f:
        item = json.loads(line.strip())
        item['text'] = item['text'].encode('utf-8')
        item = subob_classifier(item)
        if not item['subject']:
            news = subject_weibo2news(item)
            event.saveItem(news)

    f.close()
示例#2
0
def load_subject_weibo_data():
    """加载客观微博数据
    """
    # topicname = u'外滩踩踏-微博'
    # topicname = u'呼格案-微博'
    # topicname = u'复旦投毒案-微博'
    topicname = u'APEC-微博'

    em = EventManager()
    topicid = em.getEventIDByName(topicname)
    event = Event(topicid)

    # f = open('caitai.jl')
    # f = open('huge.jl')
    # f = open('fudan.jl')
    f = open('apec.jl')
    for line in f:
        item = json.loads(line.strip())
        item['text'] = item['text'].encode('utf-8')
        item = subob_classifier(item)
        if not item['subject']:
            news = subject_weibo2news(item)
            event.saveItem(news)

    f.close()
示例#3
0
def one_topic_clear(topicname_start):
    topicname, start_datetime = topicname_start
    em = EventManager()
    topicid = em.getEventIDByName(topicname)
    start_ts = datetime2ts(start_datetime)

    event = Event(topicid)
    event.initialize(start_ts)
示例#4
0
def one_topic_clear(topicname_start):
    topicname, start_datetime = topicname_start
    em = EventManager()
    topicid = em.getEventIDByName(topicname)
    start_ts = datetime2ts(start_datetime)

    event = Event(topicid)
    event.initialize(start_ts)
示例#5
0
def initializeNewsTopic():
    """初始化新闻话题
    """
    em = EventManager()

    topicname = u'外滩踩踏'
    start_datetime = "2015-01-02 00:00:00"
    topicid = em.getEventIDByName(topicname)
    start_ts = datetime2ts(start_datetime)

    event = Event(topicid)
    event.initialize(start_ts)
示例#6
0
def initializeNewsTopic():
    """初始化新闻话题
    """
    em = EventManager()

    topicname = u'外滩踩踏'
    start_datetime = "2015-01-02 00:00:00"
    topicid = em.getEventIDByName(topicname)
    start_ts = datetime2ts(start_datetime)

    event = Event(topicid)
    event.initialize(start_ts)
示例#7
0
def initializeWeiboTopic():
    """初始化weibo话题
    """
    em = EventManager()

    # topicname = u'外滩踩踏-微博'
    # start_datetime = "2015-01-02 00:00:00"
    # topicname = u'呼格案-微博'
    # start_datetime = "2014-12-14 00:00:00"
    # topicname = u'复旦投毒案-微博'
    # start_datetime = "2014-12-15 00:00:00"
    topicname = u'APEC-微博'
    start_datetime = "2014-12-15 00:00:00"

    topicid = em.getEventIDByName(topicname)
    start_ts = datetime2ts(start_datetime)

    event = Event(topicid)
    event.initialize(start_ts)
示例#8
0
def initializeWeiboTopic():
    """初始化weibo话题
    """
    em = EventManager()

    # topicname = u'外滩踩踏-微博'
    # start_datetime = "2015-01-02 00:00:00"
    # topicname = u'呼格案-微博'
    # start_datetime = "2014-12-14 00:00:00"
    # topicname = u'复旦投毒案-微博'
    # start_datetime = "2014-12-15 00:00:00"
    topicname = u'APEC-微博'
    start_datetime = "2014-12-15 00:00:00"

    topicid = em.getEventIDByName(topicname)
    start_ts = datetime2ts(start_datetime)

    event = Event(topicid)
    event.initialize(start_ts)
示例#9
0
def load_object_weibo_data():
    """加载主观微博数据
    """
    # topicname = u'外滩踩踏-微博'
    # topicname = u'呼格案-微博'
    # topicname = u'复旦投毒案-微博'
    # topicname = u'APEC-微博'
    # topicname = u'高校宣传思想工作-微博'
    topicname = u'张灵甫遗骨被埋羊圈-微博'

    em = EventManager()
    topicid = em.getEventIDByName(topicname)
    print topicid
    eventcomment = EventComments(topicid)

    # f = open('caitai.jl')
    # f = open('huge.jl')
    # f = open('fudan.jl')
    # f = open('apec.jl')
    # f = open('items_qiushi.jl')
    f = open('items_zhang.jl')
    for line in f:
        item = json.loads(line.strip())
        if 'mid' in item:
            item['text'] = item['text'].encode('utf-8')
            item = subob_classifier(item)
            if item['subject']:
                comment = api_object_weibo2comment(item)
                eventcomment.saveItem(comment)

        """
        item['text'] = item['text'].encode('utf-8')
        item = subob_classifier(item)
        if item['subject']:
            weibo = object_weibo2comment(item)
            eventcomment.saveItem(weibo)
        """

    f.close()
示例#10
0
def load_object_weibo_data():
    """加载主观微博数据
    """
    # topicname = u'外滩踩踏-微博'
    # topicname = u'呼格案-微博'
    # topicname = u'复旦投毒案-微博'
    # topicname = u'APEC-微博'
    # topicname = u'高校宣传思想工作-微博'
    topicname = u'张灵甫遗骨被埋羊圈-微博'

    em = EventManager()
    topicid = em.getEventIDByName(topicname)
    print topicid
    eventcomment = EventComments(topicid)

    # f = open('caitai.jl')
    # f = open('huge.jl')
    # f = open('fudan.jl')
    # f = open('apec.jl')
    # f = open('items_qiushi.jl')
    f = open('items_zhang.jl')
    for line in f:
        item = json.loads(line.strip())
        if 'mid' in item:
            item['text'] = item['text'].encode('utf-8')
            item = subob_classifier(item)
            if item['subject']:
                comment = api_object_weibo2comment(item)
                eventcomment.saveItem(comment)
        """
        item['text'] = item['text'].encode('utf-8')
        item = subob_classifier(item)
        if item['subject']:
            weibo = object_weibo2comment(item)
            eventcomment.saveItem(weibo)
        """

    f.close()