diff options
author | Hieu Hoang <fishandfrolick@gmail.com> | 2012-07-10 12:25:00 +0400 |
---|---|---|
committer | Hieu Hoang <fishandfrolick@gmail.com> | 2012-07-10 12:25:00 +0400 |
commit | 7d664b745e7036ae2c7745ae1ce9b2e3a9cef55c (patch) | |
tree | 3038b43cef91b2f93aeeb98f22f8d9bd30e2ba98 /lm/read_arpa.cc | |
parent | 8180181a8923f47eaa407869603500e9f7c32d8f (diff) |
Integrate Lexi's LR Score into tuning
Diffstat (limited to 'lm/read_arpa.cc')
-rw-r--r-- | lm/read_arpa.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lm/read_arpa.cc b/lm/read_arpa.cc index 50d933c83..70727e4cb 100644 --- a/lm/read_arpa.cc +++ b/lm/read_arpa.cc @@ -11,6 +11,10 @@ #include <string.h> #include <stdint.h> +#ifdef WIN32 +#include <float.h> +#endif + namespace lm { // 1 for '\t', '\n', and ' '. This is stricter than isspace. @@ -95,8 +99,13 @@ void ReadBackoff(util::FilePiece &in, float &backoff) { backoff = in.ReadFloat(); if (backoff == ngram::kExtensionBackoff) backoff = ngram::kNoExtensionBackoff; { +#ifdef WIN32 + int float_class = _fpclass(backoff); + UTIL_THROW_IF(float_class == _FPCLASS_SNAN || float_class == _FPCLASS_QNAN || float_class == _FPCLASS_NINF || float_class == _FPCLASS_PINF, FormatLoadException, "Bad backoff " << backoff); +#else int float_class = fpclassify(backoff); UTIL_THROW_IF(float_class == FP_NAN || float_class == FP_INFINITE, FormatLoadException, "Bad backoff " << backoff); +#endif } UTIL_THROW_IF(in.get() != '\n', FormatLoadException, "Expected newline after backoff"); break; |