Ejemplo n.º 1
0
def output_clusters_to_file(clusters, rownames, filename):
    '''
    DEPRECATED
    This method takes as input a set of clusters and generates 
    a very simplistic representation of these clusters in text form
    in a file. 
    '''
    
    ws = WarehouseServer()
    out = file(filename, 'w')
    out.write("Clustering results")
    out.write('\n')
    i = 0 
    for cluster in clusters:
        out.write('\n')
        out.write('***********************************************************')
        out.write('\n')
        out.write("Cluster"+str(i))
        out.write('\n')
        for document in cluster:
            out.write( ws.get_document_by_id(rownames[document]).content)
            out.write('\n')
        i += 1
Ejemplo n.º 2
0
def output_clusters_to_file(clusters, rownames, filename):
    '''
    DEPRECATED
    This method takes as input a set of clusters and generates 
    a very simplistic representation of these clusters in text form
    in a file. 
    '''

    ws = WarehouseServer()
    out = file(filename, 'w')
    out.write("Clustering results")
    out.write('\n')
    i = 0
    for cluster in clusters:
        out.write('\n')
        out.write(
            '***********************************************************')
        out.write('\n')
        out.write("Cluster" + str(i))
        out.write('\n')
        for document in cluster:
            out.write(ws.get_document_by_id(rownames[document]).content)
            out.write('\n')
        i += 1