Exemplo n.º 1
0
def getLevelWithConfNum():
    mRedis = RedisHelper()
    authors = mRedis.getAllAuthors()
    confPaperNumDict = dict()
    confCoauNumDict = dict()
    index = 0
    for author in authors:
        index += 1
        if index % 1000 == 0:
            logging.info(index)
        confNum = len(mRedis.getAuConfs(author))
        paperNum = len(mRedis.getAuPapers(author))
        coauNum = len(mRedis.getAuCoauthors(author))
        paperNumList = confPaperNumDict.setdefault(confNum, [])
        paperNumList.append(paperNum)
        coauNumList = confCoauNumDict.setdefault(confNum, [])
        coauNumList.append(coauNum)
    index = 0
    with open(OUTPUT_ACADEMIC_LEVEL_PAPER_COAU_NUM, 'w') as fileWriter:
        for confNum in confPaperNumDict.keys():
            index += 1
            if index % 1000 == 0:
                logging.info(index)
            paperNumList = confPaperNumDict[confNum]
            avg_P, max_num_P, min_num_P = statisticOfList(paperNumList)
            coauNumList = confCoauNumDict[confNum]
            avg_C, max_num_C, min_num_C = statisticOfList(coauNumList)
            fileWriter.write(
                str(confNum) + '\t' + str(avg_P) + '\t' + str(max_num_P) +
                '\t' + str(min_num_P) + '\t' + str(avg_C) + '\t' +
                str(max_num_C) + '\t' + str(min_num_C) + '\n')
    fileWriter.close()
Exemplo n.º 2
0
def getLevelWithConfNum():
    mRedis = RedisHelper()
    authors = mRedis.getAllAuthors()
    confPaperNumDict = dict()
    confCoauNumDict = dict()
    index = 0
    for author in authors:
        index += 1
        if index % 1000 == 0:
            logging.info(index)
        confNum = len(mRedis.getAuConfs(author))
        paperNum = len(mRedis.getAuPapers(author))
        coauNum = len(mRedis.getAuCoauthors(author))
        paperNumList = confPaperNumDict.setdefault(confNum, [])
        paperNumList.append(paperNum)
        coauNumList = confCoauNumDict.setdefault(confNum, [])
        coauNumList.append(coauNum)
    index = 0
    with open(OUTPUT_ACADEMIC_LEVEL_PAPER_COAU_NUM,'w') as fileWriter:
        for confNum in confPaperNumDict.keys():
            index += 1
            if index % 1000 == 0:
                logging.info(index)
            paperNumList = confPaperNumDict[confNum]
            avg_P, max_num_P, min_num_P = statisticOfList(paperNumList)
            coauNumList = confCoauNumDict[confNum]
            avg_C, max_num_C, min_num_C = statisticOfList(coauNumList)
            fileWriter.write(str(confNum) + '\t'
                + str(avg_P) + '\t' + str(max_num_P) + '\t' + str(min_num_P) + '\t'
                + str(avg_C) + '\t' + str(max_num_C) + '\t' + str(min_num_C) + '\n')
    fileWriter.close()
Exemplo n.º 3
0
def getAuthorPaperNum():
    """统计每个学者发表了多少论文。

    格式:论文数-->学者数
    """
    index = 0
    with open(OUTPUT_STATISTIC_AUTHOR_PAPER_NUM, 'w') as fileWriter:
        mRedis = RedisHelper()
        authors = mRedis.getAllAuthors()
        authorPaperNum = dict()
        for author in authors:
            index += 1
            if index % 1000 == 0:
                logging.info(index)
            paperNum = len(mRedis.getAuPapers(author))
            tmp = authorPaperNum.setdefault(paperNum, 0)
            authorPaperNum[paperNum] = tmp + 1
        for k, v in authorPaperNum.items():
            fileWriter.write(str(k) + '\t' + str(v) + '\n')
    fileWriter.close()
Exemplo n.º 4
0
def getAuthorPaperNum():
    """统计每个学者发表了多少论文。

    格式:论文数-->学者数
    """
    index = 0
    with open(OUTPUT_STATISTIC_AUTHOR_PAPER_NUM, 'w') as fileWriter:
        mRedis = RedisHelper()
        authors = mRedis.getAllAuthors()
        authorPaperNum = dict()
        for author in authors:
            index += 1
            if index % 1000 == 0:
                logging.info(index)
            paperNum = len(mRedis.getAuPapers(author))
            tmp = authorPaperNum.setdefault(paperNum, 0)
            authorPaperNum[paperNum] = tmp + 1
        for k, v in authorPaperNum.items():
            fileWriter.write(str(k) + '\t' + str(v) + '\n')
    fileWriter.close()