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 __init__(self):
     self.mRedis = RedisHelper()
     self.isPaperTag = False
     self.conf = ''
     self.isTitleTag = False
     self.paperId = -1
     self.isAuthorTag = False
     self.authors = list()
     self.isYearTag = False
     self.year = ''
Exemplo n.º 3
0
 def __init__(self):
     self.G = nx.Graph()
     self.stars = dict()
     self.targets = dict()
     self.loadStarsAndTargets()
     logging.info('loadStarsAndTargets done---------------')
     self.shortestPathLength = dict()
     self.mRedis = RedisHelper()
     self.buildGraph()
     logging.info('---------------')
Exemplo n.º 4
0
def getConfPaperNum():
    """统计每个会议收录了多少论文。

    格式:会议名-->收录论文数
    """
    index = 0
    with open(OUTPUT_STATISTIC_CONF_PAPER_NUM, 'w') as fileWriter:
        mRedis = RedisHelper()
        confPaperNum = dict()
        conferences = mRedis.getAllConfs()
        for conf in conferences:
            index += 1
            logging.info(str(index) + '--' + conf)
            paperNum = len(mRedis.getConfPapers(conf))
            tmp = confPaperNum.setdefault(paperNum, 0)
            confPaperNum[paperNum] = tmp + 1
        for paperNum, confNum in confPaperNum.items():
            fileWriter.write(str(paperNum) + '\t' + str(confNum) + '\n')
    fileWriter.close()
Exemplo n.º 5
0
def extracStarsAndTargets():
    mRedis = RedisHelper()
    starts = dict()
    targets = dict()
    authors = mRedis.getAllAuthors()
    confNumAuthors = dict()
    index = 0
    for author in authors:
        index += 1
        if index % 1000 == 0:
            logging.info(index)
        confNum = len(mRedis.getAuConfs(author))
        tmp = confNumAuthors.setdefault(confNum, [])
        tmp.append(author)
    logging.info('-------')
    for i in range(1, 101):
        logging.info(i)
        confauhtors = confNumAuthors[i]
        count = 0
        while count < 10:
            au = random.choice(confauhtors)
            if au not in targets.keys():
                targets[au] = i
                count += 1
    count = 0
    while count < 100:
        author = random.choice(authors)
        confNum = len(mRedis.getAuConfs(author))
        if author not in stars and confNum > 100:
            stars[author] = confNum
            count += 1
            logging.info(count)
    authors = []
    confNumAuthors = {}

    with open(OUTPUT_STAR_AUTHORS, 'w') as fileWriter:
        for author, confNum in stars.items():
            fileWriter.write(author + '\t' + str(confNum) + '\n')
    fileWriter.close()
    with open(OUTPUT_TARGET_AUTHORS, 'w') as fileWriter:
        for author, confNum in targets.items():
            fileWriter.write(author + '\t' + str(confNum) + '\n')
    fileWriter.close()
Exemplo n.º 6
0
def getAuthorConfNum():
    """统计每个学者的参会数。

    格式:参会数-->学者数
    """
    index = 0
    with open(OUTPUT_STATISTIC_AUTHOR_CONF_NUM, 'w') as fileWriter:
        mRedis = RedisHelper()
        authors = mRedis.getAllAuthors()
        authorConfNum = dict()
        for author in authors:
            index += 1
            if index % 1000 == 0:
                logging.info(index)
            confNum = len(mRedis.getAuConfs(author))
            tmp = authorConfNum.setdefault(confNum, 0)
            authorConfNum[confNum] = tmp + 1
        for k, v in authorConfNum.items():
            fileWriter.write(str(k) + '\t' + str(v) + '\n')
    fileWriter.close()
Exemplo n.º 7
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.º 8
0
 def __init__(self):
     self.mRedis = RedisHelper()