mosesdecoder/moses/PP/OrientationPhraseProperty.cpp

27 lines
786 B
C++
Raw Permalink Normal View History

2014-08-08 00:43:09 +04:00
#include "moses/PP/OrientationPhraseProperty.h"
#include <iostream>
namespace Moses
{
void OrientationPhraseProperty::ProcessValue(const std::string &value)
{
2015-01-14 14:07:42 +03:00
// bidirectional MSLR phrase orientation with 2x4 orientation classes:
2014-12-03 23:04:26 +03:00
// mono swap dleft dright
2014-08-08 00:43:09 +04:00
std::istringstream tokenizer(value);
try {
2014-12-03 23:04:26 +03:00
if (! (tokenizer >> m_l2rMonoProbability >> m_l2rSwapProbability >> m_l2rDleftProbability >> m_l2rDrightProbability
2015-01-14 14:07:42 +03:00
>> m_r2lMonoProbability >> m_r2lSwapProbability >> m_r2lDleftProbability >> m_r2lDrightProbability)) {
2014-08-08 00:43:09 +04:00
UTIL_THROW2("OrientationPhraseProperty: Not able to read value. Flawed property?");
}
} catch (const std::exception &e) {
UTIL_THROW2("OrientationPhraseProperty: Read error. Flawed property?");
}
};
} // namespace Moses