def read_freqs_file(filepath, separator=' '):
    """ Reads word frequencies file and returns dictionary
    where words are keys and frequencies are values.
    """
    f = open(filepath, 'r')
    ret = {}
    for line in f.read().split('\n'):
        tokens = line.split(separator)
        if len(tokens) == 2:
            ret[tokens[0]] = int(tokens[1])
    return ret