mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-27 22:14:57 +03:00
27 lines
430 B
C++
27 lines
430 B
C++
#ifndef BUILDER_DISCOUNT__
|
|
#define BUILDER_DISCOUNT__
|
|
|
|
#include <algorithm>
|
|
|
|
#include <stdint.h>
|
|
|
|
namespace lm {
|
|
namespace builder {
|
|
|
|
struct Discount {
|
|
float amount[4];
|
|
|
|
float Get(uint64_t count) const {
|
|
return amount[std::min<uint64_t>(count, 3)];
|
|
}
|
|
|
|
float Apply(uint64_t count) const {
|
|
return static_cast<float>(count) - Get(count);
|
|
}
|
|
};
|
|
|
|
} // namespace builder
|
|
} // namespace lm
|
|
|
|
#endif // BUILDER_DISCOUNT__
|