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

how can i use this to generate first order markov chain number #33

Closed
ghost opened this issue Oct 18, 2016 · 5 comments
Closed

how can i use this to generate first order markov chain number #33

ghost opened this issue Oct 18, 2016 · 5 comments

Comments

@ghost
Copy link

ghost commented Oct 18, 2016

I want to generate first order markov chain by giving randomly generated number sequence x=[5 6 1 6 4 1 2 4 6 6 1 6 6 3 5 1 3 6 5 6 4 1 6 6 5 5 5 3 4 2] as input. how to do this.

@jsvine
Copy link
Owner

jsvine commented Oct 20, 2016

Try this:

chain = markovify.Chain([ x ], state_size=1)
print(list(chain.gen()))

@ghost
Copy link
Author

ghost commented Oct 20, 2016

I don't know which file I should have to copy and where to add above mentioned lines.

@jsvine
Copy link
Owner

jsvine commented Oct 20, 2016

I don't understand the question. Could you elaborate?

@ghost
Copy link
Author

ghost commented Oct 20, 2016

chain = markovify.Chain([ x ], state_size=1)
print(list(chain.gen()))

This two lines only give output with given x in python, or I have copy paste above two lines in any file of this markovify project.

@jsvine
Copy link
Owner

jsvine commented Oct 20, 2016

Ah, I see. Here's a full script that should work, using the x you referenced in your initial comment:

import markovify
x = [5, 6, 1, 6, 4, 1, 2, 4, 6, 6, 1, 6, 6, 3, 5, 1, 3, 6, 5, 6, 4, 1, 6, 6, 5, 5, 5, 3, 4, 2]
chain = markovify.Chain([ x ], state_size=1)
print(list(chain.gen()))

@jsvine jsvine closed this as completed Mar 31, 2017
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

No branches or pull requests

1 participant