(ts)
| 66 | initial[t] = c / initial_total |
| 67 | |
| 68 | def list2pdict(ts): |
| 69 | # turn each list of possibilities into a dictionary of probabilities |
| 70 | d = {} |
| 71 | n = len(ts) |
| 72 | for t in ts: |
| 73 | d[t] = d.get(t, 0.) + 1 |
| 74 | for t, c in iteritems(d): |
| 75 | d[t] = c / n |
| 76 | return d |
| 77 | |
| 78 | for t_1, ts in iteritems(second_word): |
| 79 | # replace list with dictionary of probabilities |