예제 #1
0
    def get_arguments_graph(self,pos,neg): 
        loaded_pos, loaded_neg = self.load_corpus_reviews(200,250)
        user_pos, user_neg = self.tag_new_reviews(pos,neg)
        loaded_pos.extend(user_pos)
        loaded_neg.extend(user_neg)
        reviews = self.create_list_reviews(loaded_pos,loaded_neg)

        self.g = Grapher(reviews)
        Drawer.draw_dotgraph(self.g.get_dotgraph(), 'first_graph')
        Drawer.draw_gexfgraph(self.g.get_container(), 'first_graph')
        # every time get_container() is invoked, a new graph is generated
        self.g.compress()
        Drawer.draw_dotgraph(self.g.get_dotgraph(), 'final_graph')
        Drawer.draw_gexfgraph(self.g.get_container(), 'final_graph')
        # final_graph.gexf contains both the original graph and the final one

        xml_file = open('data/final_graph.gexf','r')
        return xml_file.read()
예제 #2
0
    
    s.split()

    print 'resolving cycles...'
    g.resolve_cycles()
    print 'computing accepted reviews...'
    g.set_warranted()
    # print 'drawing graph...'
    # Drawer.draw_graph(g.get_graph(), 'no_annoying_cycles_graph')
    
    s.split()

    print 'compressing graph...'
    g.compress()
    print 'drawing graph...'
    Drawer.draw_graph(g.get_graph(), 'compressed_graph')
    
    s.split()

    print 'removing redundant reviews in compressed graph'
    g.remove_dupes()
    print 'drawing graph...'
    Drawer.draw_graph(g.get_graph(), 'compressed_non-redundant_graph')

    s.split

    print 'recompressing graph...'
    g.compress()
    print 'drawing graph...'
    Drawer.draw_graph(g.get_graph(), 'recompressed_graph')
예제 #3
0
    reviews = l.get_all_reviews()
    print 'analysing ' + str(len(reviews)) + ' reviews...'
    print 'setting ratings and other judicial matters...'
    j = Judge(reviews)
    print 'determining conflicts...'
    conflicts = j.get_conflicts()

    s.split()

    print 'creating graph...'
    g = Grapher(reviews, conflicts, j)
    # print 'drawing graph...'
    # Drawer.draw_graph(g.get_graph(), 'original_graph')

    g.recompress()
    Drawer.draw_dotgraph(g.get_graph(), 'final_graph')
    Drawer.draw_gexfgraph(g.get_container(), 'final_graph')


    # s.split()

    # print 'removing redundant reviews...'
    # g.remove_dupes()
    # # print 'drawing graph...'
    # # Drawer.draw_graph(g.get_graph(), 'non-redundant_graph')
    
    # s.split()

    # print 'resolving cycles...'
    # g.resolve_cycles()
    # print 'computing accepted reviews...'