Coder Social home page Coder Social logo

rustkov's Introduction

Rustkov

Rustkov is a Rust library aiming to build chatbots using a markov chain.

Example

use rustkov::prelude::*;

fn main() -> Result<()> {
    // Create a new brain which contains the markov chain
    let mut brain = Brain::new()
        // train him with a dataset
        .from_dataset("path/to/your/dataset.txt")?
        .get();

    // As we didn't specify a config file to the brain,
    // we need to adjust config options here.
    // For instance, let's make it so it can learn from inputs.
    brain.config.training = true;

    // `brain.generate` returns an option, as the reply_chance config might
    // be less than 1.
    if let Some(response) = brain.generate("Hello there!")? {
        println!("{}", response);
    }

    // Get a reference to a BrainStats struct, computing statistics for a given brain
    let stats = brain.stats();

    println!("I know {} words!", stats.get_total_words());

    Ok(())
}

Installation

Add the following to your Cargo.toml file:

[dependencies]
rustkov = "0.1.0"

rustkov's People

Contributors

kjolnyr avatar

Stargazers

 avatar Griffin Gore avatar  avatar Martin Schöpf avatar  avatar Robertas avatar  avatar  avatar

Watchers

 avatar

Forkers

moparisthebest

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.