roytu / chatmarkov Goto Github PK
View Code? Open in Web Editor NEWSimulate a conversation based on previous chatlogs
License: Other
Simulate a conversation based on previous chatlogs
License: Other
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.