for line in f:
    if line.strip() and not line.startswith('TOPIC'):
        name, val = line.split()
d[name].append(float(val))
for k, v in list(d.items()):
    pass
How to determine probability of words?