Code Monkey home page Code Monkey logo

markovnextgen's Introduction

MarkovNextGen

A lightning-fast .NET library for generating simple markov chains

Used in Jahrbuch's "Monika" Discord bot

Installation

This package is available on NuGet. Just search 'MarkovNextGen'

You can also download MarkovNextGen.dll from my website (Coming Soon!).

Usage

To create a new Markov generator, you can specify a chain file or use the default markov.pdo

using MarkovNextGen;

var default = new Markov(); // uses markov.pdo
var special = new Markov("myfile.pdo");

You can train the generator a variety of ways - with lines of text, a key and list of words, a whole new chain, etc.

var generator = new Markov();

generator.AddToChain("a quick brown fox jumps over a lazy dog"); // Just a line of text

var newchain = MarkovUtilities.ReadChain("somefile.pdo");
generator.AddToChain(newchain);		// Passing in a new chain

You can generate strings based on length, starting word, or any combination thereof

var generator = new Markov();

generator.AddToChain("a quick brown fox jumps over the lazy dog");

var gen1 = generator.Generate(5, "fox");	// 5 word chain starting with "fox"
var gen2 = generator.Generate(5);			// 5 word chain with random starting word
var gen3 = generator.Generate("fox");		// Automatic-length chain starting with "fox"
var gen4 = generator.Generate();			// Automatic-length chain with random starting word

You can refer to the full documentation (Coming Soon!) for more details

Performance

The lastest version of the Markov class adds a lot of improvements in efficiency. It can train from a 400 line text file and serialize to a 4500 line chain file all in under a second

The static methods in the MarkovUtilities class aren't as efficient, but they allow direct manipulation of chains without needing an instance of the Markov class.

markovnextgen's People

Contributors

dweslynch avatar

Stargazers

Michael Ducharm avatar Luke avatar ako avatar

Forkers

eclipseanu

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.