Fetch first k hints for given code_list

def get_hints(code_list, k=10, hint_folder=HINT_FOLDER, current_tokens=None):
    """
    Fetch first k hints for given code_list
    """

    def hint_score(v, size):
        """
        The formula for hint score
        """
        return 1.0 - abs(v / (size + 1) - 0.5)

    if len(code_list) <= 1:
        return [], []

    if current_tokens is None:
        current_tokens = []

    size = min(len(code_list), MAX_HINT_SMAPLING_SIZE)
    sample = random.sample(code_list, size)
    hint_list = []
    capital_dict = {}

    for code in sample:
        path = gen_path(hint_folder, code)
        fp = os.path.join(path, code)
        try:
            with open(fp) as f:
                hints = set(f.read().strip().split('\n'))
                hint_list.extend([h.lower() for h in hints])
                capital_dict.update({hint.lower(): hint for hint in hints})
        except FileNotFoundError:
            logging.warning("FileNotFoundError: No such file: %r" % fp )
    document_freq = Counter(hint_list)
    score = [(capital_dict[k], hint_score(v, size)) \
             for k, v in document_freq.items() if k not in current_tokens]
    if len(score) == 0:
        return [], []
    score.sort(key=lambda x: x[1], reverse=True)
    hints, scores = tuple(list(zip(*score[:k])))
    return hints, scores