Friday, February 24, 2023

Third-party ngram generator

This generator produces very nice, clean text in sentences creating large blocks of text. I like this better than algorithms that include linebreaks. I thought including linebreaks would be better, but it isn't. At any rate, this algorithm produces really nice output. You can install the library here

Sample text from my own work:

collapsing into. for the prophet s desire for by which like nations. the light at Adam Adam at a night then comdemn. and the battle for hell. our way to characterize itself. such burials so the plucked fish go to the function purpose cause an epiphany. the yawns of self satisfied. a dark brown sludge cries of good soil they will win out of genesis of destinies.

var generator = require('ngram-natural-language-generator').generator;
var fs = require('fs');

generator({
    filename: 'corpus.txt',
    model: {
        maxLength: 1000,
        minLength: 900
    }
}, function(err, sentence){
    if (err) {
        console.error(err);
    } else {
        fs.writeFile('ngramsoutput.txt', sentence, function(err) {
            if (err) {
                console.error(err);
            } else {
                console.log('Sentence saved to ngramsoutput.txt!');
            }
        });
    }
});


No comments:

Post a Comment