Negligible Participation Metric

    weighted-markov-generator
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.1 • Public • Published

    weighted-markov-generator

    NPM Version   Unit Test

    Implementation of weighted markov generator in typescript.

    npm -i weighted-markov-generator
    

    See example implementation and demo in webpage: https://aperocky.com/markov/

    Use in typescript/ES6:

    import { WeightedMarkovGenerator } from 'weighted-markov-generator';
    

    node.js:

    const WeightedMarkovGenerator = require("weighted-markov-generator").WeightedMarkovGenerator;
    

    Example:

    let generator = WeightedMarkovGenerator(5) // max length of chain
    generator.seedText(NAVY_SEAL_COPYPASTA); // Seeding with well known sample text
    let text = generator.generateText(100, "I declare", ".");
    
    // text (randomly generated example):
    I declare and you couldn't, you would have held you would have over the **** did you little thing you call you can get away with saying tongue.
    

    generateText function signature:

    generateText(textLength: number, start: string = "", endsOn: string = ""): string {
    

    Generally, longer max lenght is associated with more coherence based off seed text. There are other word based markov chains, this is character based and should work reasonably well with other languages as well.

    Install

    npm i weighted-markov-generator

    DownloadsWeekly Downloads

    2

    Version

    1.0.1

    License

    ISC

    Unpacked Size

    8.02 kB

    Total Files

    8

    Last publish

    Collaborators

    • aperocky