Deep Learning, Natural Language Process, Machine Learning, Markov Chains, Nlp Tutorial.
convertFreqIntoProb(T): for kx in T.keys(): s = float(sum(T[kx].values())) for k in T[kx].keys(): T[kx][k] = T[kx][k]/s return T T = convertFreqIntoProb(T) print(T) --> {'llo ': {'h': 1.0}, 'ello': {' ': 1.0}, 'o he': {'l': 1.0}, 'lo h': {'e': 1.0}, 'hell': {'i': 0.3333333333333333, 'o':