hiero model compatibility

This commit is contained in:
Rico Sennrich 2014-10-15 14:20:40 +01:00
parent 44ce4b361a
commit ef2c9dc92d
3 changed files with 4 additions and 12 deletions

View File

@ -29,9 +29,8 @@ public:
{}
void EvaluateWhenApplied(const ChartHypothesis& hypo,
ScoreComponentCollection*) const {
throw std::logic_error("PhraseLengthFeature not valid in chart decoder");
}
ScoreComponentCollection*) const
{}
void EvaluateWithSourceContext(const InputType &input
, const InputPath &inputPath

View File

@ -83,10 +83,7 @@ void SourceWordDeletionFeature::ComputeFeatures(const Phrase &source,
if (targetLength == 1 && sourceLength == 1 && !alignmentInfo.GetSize()) return;
// flag aligned words
bool aligned[16];
UTIL_THROW_IF2(sourceLength >= 16, "Source length must be less than 16 words");
for(size_t i=0; i<sourceLength; i++)
aligned[i] = false;
std::vector<bool> aligned(sourceLength, false);
for (AlignmentInfo::const_iterator alignmentPoint = alignmentInfo.begin(); alignmentPoint != alignmentInfo.end(); alignmentPoint++)
aligned[ alignmentPoint->first ] = true;

View File

@ -73,11 +73,7 @@ void TargetWordInsertionFeature::ComputeFeatures(const Phrase &source,
if (targetLength == 1 && sourceLength == 1 && !alignmentInfo.GetSize()) return;
// flag aligned words
bool aligned[16];
UTIL_THROW_IF2(targetLength >= 16, "Target length must be less than 16 words");
for(size_t i=0; i<targetLength; i++) {
aligned[i] = false;
}
std::vector<bool> aligned(targetLength, false);
for (AlignmentInfo::const_iterator alignmentPoint = alignmentInfo.begin(); alignmentPoint != alignmentInfo.end(); alignmentPoint++) {
aligned[ alignmentPoint->second ] = true;
}