コード例 #1
0
def get_hot_term_in_year(year_list=None, freq=5):
    """ Find the most frequent title terms that appear >= freq times in given years. """
    bib_data = get_bib_data()
    _, years, _, years_cnt = get_year_by_term_mat(bib_data, freq=0)
    if not year_list:
        year_list = years
    for y in year_list:
        ind = years.index(y)
        year_cnt = years_cnt[ind]
        tmp = {t : year_cnt[t] for t in year_cnt if (t and year_cnt[t] >= freq)}
        bib_parser.bar_plot(tmp, 'Hot terms', 'Term', 'Frequency', './simple/hot_terms/hot_terms_%s.png' %y, show=False, sorted_by_key=True)
コード例 #2
0
def get_hot_term_in_author(author_list=None, freq=5):
    """ Find relevant terms for each author in given author list.
        Here, term t is relevant to author a if term t appears more than freq times in all pubs of author a. 
    """
    bib_data = get_bib_data()
    _, authors, _, authors_cnt = get_author_by_term_mat(bib_data, tfreq=0, afreq=10)
    if not author_list:
        author_list = authors
    for au in author_list:
        ind = authors.index(au)
        au_cnt = authors_cnt[ind]
        tmp = {t : au_cnt[t] for t in au_cnt if (t and au_cnt[t] >= freq)}
        dot_ind = au.find(' ')
        au_name = au[:dot_ind]
        if au_name == 'M{\\"u}ller': # fix latex name error!
            au_name = 'Muller'
        bib_parser.bar_plot(tmp, 'Relevant terms', 'Term', 'Frequency', './simple/hot_terms/rel_terms_%s.png' %au_name.encode('utf-8'), show=False, sorted_by_key=True)