<commit_before>import json
from article import Article
import operator
from textblob import TextBlob
import solr


NUM_TOP_ARTICLES = 15
THREASHOLD_VALUE = 6

def get_top(sentence, n):
    '''
    Get the top n most frequently used nouns in a string
    @param sentence: The string being analyzed
    @param n: The number of results desired
    @return: An array of n nouns sorted by frequency of use in sentence in descending order
    '''
    blob = TextBlob(sentence)
    most_used_nps = blob.np_counts
    sorted_nps = sorted(most_used_nps.items(), key=operator.itemgetter(1), reverse=True)
    i = 0
    arr = []
    for entry in sorted_nps:
        if(i < n):
            arr.append(entry[0])
    return arr

def are_similar_top(top_a, top_b, threshold):
    '''
    Determines whether two lists of frequently used nouns have at least threashold nouns in common
    @param top_a: A list of nouns<commit_msg>Bug in solr Instance<commit_after>import json
from article import Article
import operator
from textblob import TextBlob
import solr


NUM_TOP_ARTICLES = 30
THREASHOLD_VALUE = 6

def get_top(sentence, n):
    '''
    Get the top n most frequently used nouns in a string
    @param sentence: The string being analyzed
    @param n: The number of results desired
    @return: An array of n nouns sorted by frequency of use in sentence in descending order
    '''
    blob = TextBlob(sentence)
    most_used_nps = blob.np_counts
    sorted_nps = sorted(most_used_nps.items(), key=operator.itemgetter(1), reverse=True)
    i = 0
    arr = []
    for entry in sorted_nps:
        if(i < n):
            arr.append(entry[0])
        i += 1
    return arr

def are_similar_top(top_a, top_b, threshold):
    '''
    Determines whether two lists of frequently used nouns have at least threashold nouns in common
    @param top_a: A list of nouns
{'fraction_non_alphanumeric': 0.06926406926406926, 'fraction_numerical': 0.007034632034632035, 'mean_word_length': 3.2702078521939955, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1734840', 'n_tokens_mistral': 598, 'n_tokens_neox': 568, 'n_words': 216}