Exemplo n.º 1
0
fich = open("//home//idexlab//" + "TotalMeasuresBM25" + ".txt", "w")
fgraph = open("//home//idexlab//" + "GraphTotal" + ".txt", "w")

for field in dataset.fields: 
    logging.debug("Field = " + field)
    if not knownAuthors: 
        dataset.learnModel() 
    dataset.overwriteVectoriser = False
    dataset.overwriteModel = False    
    
    if not knownAuthors: 
        relAuthorsDocSimilarity, relAuthorsDocCitations = dataset.findSimilarDocuments(field)
    else: 
        relAuthorsDocSimilarity, relAuthorsDocCitations = dataset.readKnownAuthors(field)
        #Relevant experts with BM25 score
        expertAuthors = dataset.readKnownAuthorsExpert(field)
	    

    relevantAuthors = set(relAuthorsDocSimilarity).union(set(relAuthorsDocCitations))
    logging.debug("Total number of relevant authors : " + str(len(relevantAuthors)))
    
    graph, authorIndexer = dataset.coauthorsGraph(field, relevantAuthors)
    #f = open(dataset.getCoauthorsFilename(field),'rb') #Save the graph of co-authors
    #storedlist=pickle.load(f)
    #for i in storedlist:
        #fgraph.write(str(i))
        #fgraph.write("\n"+ "Author vertices") 
        #fgraph.write(str(authorIndexer.getIdDict()))
        #fgraph.write(str(numpy.ones(graph.ecount())))
        #print(i)
    #fgraph.close()