Giter Site home page Giter Site logo

marc's Introduction

MARC

A tiny Markov chain generator in JavaScript

Easily create Markov models from a given set of observations to generate random sequences of other potential observations.

Marc supports both time-homogeneous and higher-order Markov chains.

Usage

import Marc from 'marc';
// Our observations consist of four sentences from a rando's Twitter account
const observations = ['a sentence', 'another sentence', 'one more', 'and the last'];
// Give Mark the observations and tell it our token delimeter (' ')
const m = new Mark(observations, { delimeter: ' ', order: 0 }); // order = n - 1
// Generate a probable observation
const random = m.random();

Run the example

$> npm run example

A few examples, some funny, others serious (from NYTimes homepage, 01-19-2018):

  • Cuomo Looks at The Bike That Could Cost $11.52
  • Vows: For Love of Oat Milk Merkel?
  • ICE Detained My Life
  • How the Worst Way to Help Travelers Choose Safe Destinations
  • Brand to Pretend They’re Homeless Pro-Life Movement Has Plenty
  • Why James Franco Could Cost $11.52
  • Timeline: How Congress Breaks Down the Collusion We Were Waiting For?
  • Military Shifts Focus to Trump’s Radical Honesty
  • Trump Administration on #MeToo Moment Shape the Bitcoin Bubble
  • Sundance Film Festival: 5 Movies to Thwart Federal Government

marc's People

Contributors

tmanderson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.