blob: 2be19ea2db9e09ee62837ca6814cbdc7147991b8 (
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
28
29
30
31
32
33
34
35
36
37
|
#ifndef SEMIRING_HH
#define SEMIRING_HH
//#pragma once
template<typename T>
class ViterbiSemiring {
public:
T one = 1.0;
T null = 0.0;
T add(T x, T y);
T multiply(T x, T y);
T convert(T x);
};
template<typename T> T
ViterbiSemiring<T>::add(T x, T y)
{
return max(x, y);
}
template<typename T> T
ViterbiSemiring<T>::multiply(T x, T y)
{
return x * y;
}
template<typename T> T
ViterbiSemiring<T>::convert(T x)
{
return (T)x;
}
#endif
|