-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBackoffStrategies.h
48 lines (37 loc) · 1.32 KB
/
BackoffStrategies.h
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
* BackoffStrategies.h
*
* Created on: Dec 12, 2016
* Author: onrust
*/
#ifndef BACKOFFSTRATEGIES_H_
#define BACKOFFSTRATEGIES_H_
#include "BackoffStrategy.h"
#include "LanguageModel.h"
#include "ProgramOptions.h"
#include "Utils.h"
namespace SLM {
class InterpolationStrategy;
class BackoffStrategies
{
public:
BackoffStrategies(SLM::ProgramOptions& programOptions, SLM::LanguageModel& lm);
virtual ~BackoffStrategies();
void prob(const Pattern& context, const Pattern& focus, bool isOOV);
void addBackoffStrategy(BackoffStrategy* strategy);
void nextFile();
void nextLine();
void done();
private:
std::vector<BackoffStrategy*> backoffStrategies;
};
class BackoffStrategiesFactory
{
public:
static std::vector<BackoffStrategy*> fromProgramOptions(SLM::ProgramOptions& programOptions, SLM::LanguageModel& lm);
static BackoffStrategy* createNgramBackoffStrategy(SLM::ProgramOptions& programOptions, SLM::LanguageModel& lm);
static BackoffStrategy* createLimitedBackoffStrategy(SLM::ProgramOptions& programOptions, SLM::LanguageModel& lm, SLM::InterpolationStrategy* interpolationStrategy);
static BackoffStrategy* createFullBackoffStrategy(SLM::ProgramOptions& programOptions, SLM::LanguageModel& lm, SLM::InterpolationStrategy* interpolationStrategy);
};
} /* namespace SLM */
#endif /* BACKOFFSTRATEGIES_H_ */