How to use the markovify.text.NewlineText function in markovify

To help you get started, we’ve selected a few markovify examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github caktus / taytay / taytay / views.py View on Github external
def make_markov_chain(album):
    lyrics = ""
    if album is not None:
        qs = models.Song.objects.filter(album__title=album)
    else:
        qs = models.Song.objects.all()
    for i in qs:
        lyrics += i.lyrics

    lyrics_generator = markovify.text.NewlineText(lyrics, state_size=2)
    return lyrics_generator