mosesdecoder/moses/FF/InputFeature.cpp

30 lines
636 B
C++
Raw Normal View History

#include <stdexcept>
#include "InputFeature.h"
2013-06-05 01:09:21 +04:00
#include "moses/Util.h"
#include "util/check.hh"
using namespace std;
namespace Moses
{
InputFeature::InputFeature(const std::string &line)
2013-05-29 21:16:15 +04:00
:StatelessFeatureFunction("InputFeature", line)
{
2013-06-05 01:09:21 +04:00
for (size_t i = 0; i < m_args.size(); ++i) {
2013-06-05 16:42:56 +04:00
const vector<string> &args = m_args[i];
CHECK(args.size() == 2);
2013-06-05 01:09:21 +04:00
2013-06-05 16:42:56 +04:00
if (args[0] == "num-input-features") {
m_numInputScores = Scan<size_t>(args[1]);
} else if (args[0] == "real-word-count") {
m_numRealWordCount = Scan<size_t>(args[1]);
} else {
throw "Unknown argument " + args[0];
}
}
}
2013-06-05 01:09:21 +04:00
} // namespace