2013-05-28 20:25:59 +04:00
|
|
|
#include <stdexcept>
|
|
|
|
#include "InputFeature.h"
|
2013-06-05 01:09:21 +04:00
|
|
|
#include "moses/Util.h"
|
|
|
|
#include "util/check.hh"
|
2013-05-28 20:25:59 +04:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
namespace Moses
|
|
|
|
{
|
|
|
|
InputFeature::InputFeature(const std::string &line)
|
2013-05-29 21:16:15 +04:00
|
|
|
:StatelessFeatureFunction("InputFeature", line)
|
2013-05-28 20:25:59 +04:00
|
|
|
{
|
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-05-28 20:25:59 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-06-05 01:09:21 +04:00
|
|
|
} // namespace
|
2013-05-28 20:25:59 +04:00
|
|
|
|