#ifndef SEMIRING_HH #define SEMIRING_HH template 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 T ViterbiSemiring::add(T x, T y) { return max(x, y); } template T ViterbiSemiring::multiply(T x, T y) { return x * y; } template T ViterbiSemiring::convert(T x) { return (T)x; } #endif