Open davelab6 opened 11 years ago
(Probably we need a MUCH larger en.txt than the current one for this to work well. :)
This is still unresolved
can this be resolved? :)
now gensent.py
produces output
planting, cutting, hoeing, watering, walking amid his terror as well as birds.
gendarme repete:-- the gendarme and his exertions must have been without a
be fatigued than wounded. it was almost always comes too soon. wait
this hollow road of ohain, to grouchy's delay, to blucher's arrival, to
or raising AttemptError if it does not found any words
The latest commit is too harsh, as this will not work when all letters except Y and y are not included, but works when all 52 latin letters are included.
$ ./gensent.py abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXZ
by change of emotion which was dark, that the ball had traversed
solitude, silence, night, i can surely sell me a sou! my wife
evil. there exist people who are your fifteen hundred years before. m.
on, nevertheless," ejaculated thenardier, and that they alone recognize; he abruptly unmasked
$ ./gensent.py abcdefghijklmnopqrstuvwxzABCDEFGHIJKLMNOPQRSTUVWXZ
Traceback (most recent call last):
File "./gensent.py", line 34, in <module>
main(sys.argv[1:])
File "./gensent.py", line 31, in main
print m.random_walk_string(10, start)
File "/Users/dcrossland/src/example-trigram-davelab6/markov_chain.py", line 196, in random_walk_string
result = self.random_walk(length, init)
File "/Users/dcrossland/src/example-trigram-davelab6/markov_chain.py", line 187, in random_walk
next = self.random_step(prestate)
File "/Users/dcrossland/src/example-trigram-davelab6/markov_chain.py", line 164, in random_step
raise AttemptError(u'Unable to find words in {0} attempts'.format(20))
markov_chain.AttemptError: Unable to find words in 20 attempts
$
The output should contain words that contain ONLY the input letters (similar to https://github.com/forcebold/adhesiontext-for-robofont/blob/master/adhesiontext.py and https://github.com/davelab6/libretext/)
Currently output includes all letters:
Expected output: