This package is a word (list) generator built on the Markov chain model.
Documentation available here
Inspired by this article written (in french) by David Louapre.
It generates words by using the probability of a character to appear after a specific chain of characters. Thus, depending on the original words list you put in, it will generate words which would look like those of the words list.
You can throw a lot of differents words lists at it depending on the expected result (words, names, whatever... in many languages).
It's been tested and worked fine on english, french and mythological words/names containing special characters. Just make sure the original words list is formatted as you would expect the output to be (no characters you don't want like
;, ... unless you wan't them you appear in the result).
Of course, in the following example, the original words list is very short so you won't get many words generated since the pool of probabilities is very small, so to get the best results, you'll need to give it a strong words list unless you expect very specific results.
Ex.: Original words list:
monday tuesday wednesday wedding dingo demon daylight sunlight lighthouse
ding mon weddingo demondaylight tuesdaylight sunlighthouse light wednesdaylight demonday day daylighthouse mondaylight wednesdaylighthouse tuesdaylighthouse demondaylighthouse mondaylighthouse
$ npm install wordgenie$ npm install --save wordgenie
var fs = ;// Load the module.var Generator = ;// Read a word listfs;
- Explain the configuration of the "analyze" method
- Explain the markovLen parameter
- Allow the user to put in a String instead of a Set in the "analyze" method (the Set was chosen as a good way to avoid duplicates, but I could manage that from inside the module)
- Do something about the case sensitivity (since atm it doesn't recognize the relation between lowercase chars and their uppercase equivalent)
- Implement callbacks in the "genWord", "genSet" and "analyze" methods (maybe, is there even a point to do it?)