Add MarkovMatrix class
This commit is contained in:
parent
c0e84ee194
commit
b1048a5abc
3 changed files with 71 additions and 1 deletions
23
src/MarkovMatrix.hpp
Normal file
23
src/MarkovMatrix.hpp
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue