class CommunityBuilderTest(unittest.TestCase):
    
    def setUp(self):
        self.cb = CommunityBuilder('../data/cn-topic.db')

    def test_load_title_wordnet(self):
        g = self.cb.load_title_wordnet()
        print 'count of vertex and eges: %d, %d' %(g.vcount(),g.ecount())
Beispiel #2
0
def test_title_cluster(dbfile = '../data/sample_test.db'):
    from CommunityBuilder import CommunityBuilder
    import comdect
    cb = CommunityBuilder(dbfile)
    g = cb.load_title_wordnet(2)

    detect = comdect.WalkCommunityDetection(min_nodes=15)
    coms = detect.detect(g)
    print len(coms)
    coms = comuid2name(g,coms)
    rwclusters = load_topic_keyword(dbfile)

    purity = compare_word_cluster(coms, rwclusters)
    print purity
Beispiel #3
0
def get_graph(filename='/home/cs/src/semantic_community/data/sample_test.db'):
    from CommunityBuilder import CommunityBuilder
    cb = CommunityBuilder(filename)
    graph = cb.load_title_wordnet()
    return graph
Beispiel #4
0
def get_graph(filename='/home/cs/src/semantic_community/data/sample_test.db'):
    from CommunityBuilder import CommunityBuilder
    cb = CommunityBuilder(filename)
    graph = cb.load_title_wordnet()
    return graph