blob: 519b601a06e940be1fbcffa66b7b3a7c1b3fae63 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#include <list>
#include "utf8.h"
#include <unordered_map>
struct context_occurrence
{
unsigned int count{ 1 };
std::unordered_map<utf8::utfchar32_t, unsigned int> counts;
explicit context_occurrence(utf8::utfchar32_t character);
void add(utf8::utfchar32_t character);
std::unordered_map<utf8::utfchar32_t, unsigned int>::iterator begin();
std::unordered_map<utf8::utfchar32_t, unsigned int>::iterator end();
};
struct context_model
{
void add(utf8::utfchar32_t character);
std::unordered_map<std::string, context_occurrence>::iterator begin();
std::unordered_map<std::string, context_occurrence>::iterator end();
private:
std::list<utf8::utfchar32_t> current_context;
std::unordered_map<std::string, context_occurrence> occurrences;
};
|