A2Z-F24

Markov Chains and Context Free Grammars

Markov and CFG slides

Weighted Selection / Sampling

Markov Chains

Markov Project References

CFG Resources

CFG Project References

CFG Visual Art

Additional Reading

Assignment

Try using Markov Chains. Or Context Free Gramamars! Feel free to pick just one or try both!

(It is not required to write any new code for this assignment. You are welcome to run one or more of the provided examples with your own data. You can document the results in a blog post (or link to a web page where the text is generated). Iโ€™ll include some other ideas below in case you are feeling ambitious.)

Markov Chains

Use one of the existing examples to generate text with your own input data. Experiment with the โ€œorderโ€ and โ€œmaximumโ€ length variables. Try mixing multiple texts. Copy paste your favorite outputs from the browser and document in a blog post.

It is not required to write any new code for this assignment, however Iโ€™ll include some ideas for further exploration below.

Context-Free Grammars

Invent your own grammar and generate text. I suggest using Tracery but you can base your code on any of my examples, or try RiGrammer from the RiTa library.

Getting results from a context-free-grammar can be tricky. Short and sweet, highly structured ideas tend to work well. For example.

Something you might consider is pulling the โ€œterminalโ€ words for your grammar from an API or other data source. You are also welcome to explore generative visual art with Context Free Grammars basing your exercise off of the L-System material described above. Or what else can you generate from a Context-Free Grammar? Music?

Add your assignment below via Pull Request

(Please note you are welcome to post under a pseudonym and/or password protect your published assignment. For NYU blogs, privacy options are covered in the NYU Wordpress Knowledge Base. Finally, if you prefer not to post your assignment at all here, you may email the submission.)

Emoji Key for Video Tutorials, Readings, and more