Word Reactor is a Markov chain-based word generator running inside a physics simulation. Run it in your browser.
Open it in the browser and generate words. Click or tap empty spaces to spawn stream of words for different topics. Drag the balls around to mix things up, and collide the balls with "topic" words in them to create new words:
Include it in your
Or add it to your
<haxelib name="markov-namegen" />
How It Works
The markov-namegen haxelib uses Markov chains to generate random words. Given a set of words as training data, the library calculates the conditional probability of a letter coming up after a sequence of letters chosen so far. It looks back up to "n" characters, where "n" is the order of the model.
The physics simulation is made using Nape, a 2D rigid body physics engine for Haxe. When balls containing topic words collide, balls are added to the simulation that contain new words generated using the training data for those topics.
The visualization is rendered using HTML5 with text, images and canvas elements, using absolute positioning for the balls. This is all kept in sync with the Nape physics simulation in a requestAnimationFrame loop.
- Inspired by the ball pool experiment by Ricardo Cabello and sample projects from Nape by Luca Deltodesco.
- Many of the concepts used for the word generator were suggested in this article by Jeffrey Lund.
- If you have any questions or suggestions then get in touch or open an issue.
The demo code is licensed under CC BY-NC. The haxelib library itself is MIT licensed. Training data was compiled from sites like Wikipedia and census data sources.