I needed something like a lorem ipsum generator today and I just made the best NodeJS text generator ever. Or maybe not. Time will tell 🙂 In any case, if you need to generate dummy texts with semi-random words, like:
Integisq dolalinsea legide moricapr, taneli lab adoriqid conacu perarinseru.
Please feel free to get the random-textblock package from npm. Usage is pretty simple, maybe event a bit too simple at the moment, but planning to add a few more features.

Get the package

The package is available via npm:

Alternatively, the related GitHub repository is github.com/seabadger-io/random-textblock

Usage

By default the getTextBlock() method generates 1-3 sentences, each containing 5-15 words. If you need a different result, you can define ranges or specify the exact layout of the text like:

More information and updates will be available in the repository: https://github.com/seabadger-io/random-textblock#readme

About

I wanted to avoid storing a rather large word list, but also wanted something that looks more or less the lorem ipsum texts. The quick solution was, that I took a few thousand Latin words, took them apart (2-3 letter fragments) and some of the more frequently used fragments I’ve put into a matrix. Each word may contain up to 4 such fragments and I also tried to position these fragments in the word, where they usually appeared in the real Latin words.

Now, this was a quick and dirty solution and there is some room for improvements, but the result is quite usable already. There is even a famous random saying to this: Refic facotituris men pon, coneculor putele omn ponarevivir supi.

Hope you will like it.

Issues

If you experience issues while using the text generator, please report it them directly here. Sorry and thanks.




Tagged with