0.2.0 • Published 3 years ago

markovifying v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Markovifying

Markovifying is a JavaScript module with for generating easily saveable and human readable markov chain models for predictive text generation.

Features

  • Customizeable state size
  • Models can be saved as JSON, in a human readable format.

Installation

npm install markovifying

Browser versions are available in the releases tab.

Usage

const markov = require("markovifying")
const fs = require("fs")

// Import text and split it into sentences
const textArray = fs.fileReadSync("./text.txt", "utf-8").split("\n")

// Build the model
const model = markov.generateModel(textArray)

// Print a sentence generated by the model
console.log(markov.generateTextFromModel(model))