MCPcopy Index your code
hub / github.com/lazyprogrammer/machine_learning_examples / generate

Function generate

hmm_class/frost.py:97–117  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

95 assert(False) # should never get here
96
97def generate():
98 for i in range(4):
99 sentence =[]
100
101 # initial word
102 w0 = sample_word(initial)
103 sentence.append(w0)
104
105 # sample second word
106 w1 = sample_word(second_word[w0])
107 sentence.append(w1)
108
109 # second-order transitions until END
110 while True:
111 w2 = sample_word(transitions[(w0, w1)])
112 if w2 == 'END':
113 break
114 sentence.append(w2)
115 w0 = w1
116 w1 = w2
117 print(' '.join(sentence))
118
119generate()
120

Callers 1

frost.pyFile · 0.85

Calls 1

sample_wordFunction · 0.85

Tested by

no test coverage detected