Giter VIP home page Giter VIP logo

chatmarkov's Introduction

ChatMarkov
-----------

Roy Tu
[email protected]
http://thatsnail.blogspot.com/

Written in C++
Microsoft Visual C++ 2010 Express Edition

---------------

1. Overview

---------------

This program reads chatlogs and builds a Markov chain for each username, simulating a conversation with it.

---------------

2. How to Use

---------------

Included are two sample chatlogs in two different formats.  So far, only AIM logs are supported.

The native format used by the program is the following:

User 1: Messages.
User 2: Messages!
User 3: I love messages!

etc.

This format is denoted by the username, followed by a colon (:) and a space ( ), followed by the message and a newline (\n).  Chats not currently supported can be converted to this format manually.

Supported formats are converted by the program into the native format.

The following variables can be specified in the program:

const string DIRECTORY = "chatlog-AIM.txt"; //Directory of the chatlog (base directory is the location of the .vcxproj)
const LOG_TYPE LOGTYPE = AIM; //Format; currently supports NONE (native format) or AIM (AIM logs)

Note: Do NOT use chatlog.txt as your filename as it WILL be overwritten; the program converts all formats into its native format and stores it in "chatlog.txt".

---------------

3. Technical Details

---------------

The algorithm is a level-1 Markov chain.  Each user's messages are compiled into one large string per user, and the Markov chains are compiled by recording the probability of each word following every other word.  The conversations are then generated by choosing a word at random and choosing each new word based on the previous, using the Markov chain tables as a probability distribution.

The nature of the algorithm means it works best with very large chatlogs, as it requires words to repeat in order to create variety in chat.

---------------

4. To-Do

---------------

4.1 Smoothing

---------

A smoothing algorithm may be applied to the Markov table on-generation in order to increase the variety of dialogue.  Laplace smoothing is suggested.

---------

4.2 Speed Optimizations

---------

The program currently generates Markov tables with an efficiency of roughly O(n^2), where n is the unique wordcount of each user.  This is clearly very bad, and a better technique would be necessary for large chatlogs.

Large strings should be passed by pointers instead of by value in function calls.

Inline functions are a possibility but likely would not make a substantial difference.

Assembly optimization is worth considering.

---------

4.3 More Formats

---------

The limited number of formats supported restricts this program strictly to the more tech-savvy users who can convert their formats by hand.  To prepare this program for general public consumption, it must be able to convert a larger variety of formats.

Suggested formats:

IRC
Windows Live Messenger
Yahoo Instant Messenger
Cleverbot

---------------

5. Conclusion

---------------

Feel free to fork this project on GitHub and add your own modifications.  Credit will be given for your contributions.

chatmarkov's People

Contributors

roytu avatar

Stargazers

 avatar

Watchers

 avatar James Cloos 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.