Add MarkovMatrix class

This commit is contained in:
Joscha 2016-11-03 20:15:44 +00:00
parent c0e84ee194
commit b1048a5abc
3 changed files with 71 additions and 1 deletions

23
src/MarkovMatrix.hpp Normal file
View file

@ -0,0 +1,23 @@
#ifndef MARKOVMATRIX_HPP
#define MARKOVMATRIX_HPP
#include <map>
#include <string>
class MarkovMatrix
{
public:
MarkovMatrix(int length);
~MarkovMatrix();
void feed(std::string line);
void reset(int length=0); // reset the matrix, length>0 -> set a new length
std::map<std::string, int> hiccup(std::string& previous);
private:
int length;
std::map<std::string, std::map<std::string, int> > matrix;
};
#endif