generate_ranking_table.py
def missed_ratios(total_missed, total_recalled, filtering=False, n=2):
    "Compute missed ratios for local ranking."
    # Create set of all words in importance class 5.
    all_words = set()
    all_words.update(total_missed.keys())
    all_words.update(total_recalled.keys())
    
    # Create container.
    all_results = []
    for word in all_words:
        # Compute ratio
        occurrences = total_missed[word] + total_recalled[word]
        ratio = float(total_missed[word])/occurrences
        # Create tuple in sorting order.
        # Sorting of tuples in Python means that if the first element isn't decisive, the second element is used to break the tie.
        result = (ratio, occurrences, word)
        # Add to the list.
        all_results.append(result)
    
    if filtering:
        all_results = occurrences_above_n(all_results, n)
    
    # Sort the list
    sorted_results = sorted(all_results, reverse=True)
    return sorted_results
Compute missed ratios for local ranking.
Compute missed ratios for local ranking.
Compute missed ratios for local ranking .
def missed_ratios(total_missed, total_recalled, filtering=False, n=2):
    all_words = set()
    all_words.update(total_missed.keys())
    all_words.update(total_recalled.keys())
    all_results = []
    for word in all_words:
        occurrences = total_missed[word] + total_recalled[word]
        ratio = float(total_missed[word])/occurrences
        result = (ratio, occurrences, word)
        all_results.append(result)
    if filtering:
        all_results = occurrences_above_n(all_results, n)
    sorted_results = sorted(all_results, reverse=True)
    return sorted_results
def missed_ratios ( total_missed , total_recalled , filtering = False , n = 2 ) : all_words = set ( ) all_words . update ( total_missed . keys ( ) ) all_words . update ( total_recalled . keys ( ) ) all_results = [ ] for word in all_words : occurrences = total_missed [ word ] + total_recalled [ word ] ratio = float ( total_missed [ word ] ) / occurrences result = ( ratio , occurrences , word ) all_results . append ( result ) if filtering : all_results = occurrences_above_n ( all_results , n ) sorted_results = sorted ( all_results , reverse = True ) return sorted_results
Compute missed ratios for local ranking.
Compute missed ratios for local ranking .
"Compute missed ratios for local ranking." # Create set of all words in importance class 5. # Create container. # Compute ratio # Create tuple in sorting order. # Sorting of tuples in Python means that if the first element isn't decisive, the second element is used to break the tie. # Add to the list. # Sort the list
total_missed
total_recalled
filtering
n