Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MarkovChain: add iter and iter_from methods #18

Merged
merged 1 commit into from
Jul 12, 2017

Conversation

mgeisler
Copy link
Owner

These methods return an iterator which will generate a neverending
chain of words. The iterator can be used by itself, or it can be used
indirectly by the generate and generate_from methods.

The new iterator works slightly differently from the old code in
corner cases where the iteration ends up in a state from which there
is no next state in the Markov chain. Like before, a new state is
picked at random, but this now happens one word earlier than before.
This should not make a big difference outside of artificially small
test cases.

These methods return an iterator which will generate a neverending
chain of words. The iterator can be used by itself, or it can be used
indirectly by the generate and generate_from methods.

The new iterator works slightly differently from the old code in
corner cases where the iteration ends up in a state from which there
is no next state in the Markov chain. Like before, a new state is
picked at random, but this now happens one word earlier than before.
This should not make a big difference outside of artificially small
test cases.
@mgeisler mgeisler force-pushed the markov-chain-iterator branch from c5b4be2 to 290ed03 Compare July 12, 2017 22:22
@mgeisler mgeisler merged commit 7d71dea into master Jul 12, 2017
@mgeisler mgeisler deleted the markov-chain-iterator branch April 22, 2018 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant