mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 19:27:11 +03:00
update VW context feature interface
This commit is contained in:
parent
73c0a86445
commit
acf7d7eedd
@ -250,8 +250,9 @@ public:
|
||||
// we have not extracted features for this context yet
|
||||
|
||||
Discriminative::FeatureVector contextVector;
|
||||
AlignmentInfo alignInfo("");
|
||||
for(size_t i = 0; i < contextFeatures.size(); ++i)
|
||||
(*contextFeatures[i])(targetContext, classifier, contextVector);
|
||||
(*contextFeatures[i])(input, targetContext, alignInfo, classifier, contextVector);
|
||||
|
||||
contextFeaturesCache[contextHash] = contextVector;
|
||||
VERBOSE(3, "VW :: context cache miss\n");
|
||||
@ -416,8 +417,9 @@ public:
|
||||
targetContext.Append(targetSent->GetSubString(Range(0, currentStart - 1)));
|
||||
|
||||
// extract target-context features
|
||||
AlignmentInfo alignInfo("");
|
||||
for(size_t i = 0; i < contextFeatures.size(); ++i)
|
||||
(*contextFeatures[i])(targetContext, classifier, dummyVector);
|
||||
(*contextFeatures[i])(input, targetContext, alignInfo, classifier, dummyVector);
|
||||
|
||||
// go over topts, extract target side features and train the classifier
|
||||
for (size_t toptIdx = 0; toptIdx < translationOptionList.size(); toptIdx++) {
|
||||
|
@ -102,7 +102,7 @@ public:
|
||||
, Discriminative::FeatureVector &outFeatures) const = 0;
|
||||
|
||||
// Overload to process target-dependent features, create features once for
|
||||
// every target phrase. One source word range will have at leat one target
|
||||
// every target phrase. One source word range will have at least one target
|
||||
// phrase, but may have more.
|
||||
virtual void operator()(const InputType &input
|
||||
, const TargetPhrase &targetPhrase
|
||||
@ -113,7 +113,9 @@ public:
|
||||
// evaluated during decoding. For efficiency, features are not fed directly into
|
||||
// the classifier object but instead output in the vector "features" and managed
|
||||
// separately in VW.h.
|
||||
virtual void operator()(const Phrase &phrase
|
||||
virtual void operator()(const InputType &input
|
||||
, const Phrase &contextPhrase
|
||||
, const AlignmentInfo &alignmentInfo
|
||||
, Discriminative::Classifier &classifier
|
||||
, Discriminative::FeatureVector &outFeatures) const = 0;
|
||||
|
||||
|
@ -19,11 +19,13 @@ public:
|
||||
VWFeatureBase::UpdateRegister();
|
||||
}
|
||||
|
||||
virtual void operator()(const Phrase &phrase
|
||||
virtual void operator()(const InputType &input
|
||||
, const Phrase &contextPhrase
|
||||
, const AlignmentInfo &alignmentInfo
|
||||
, Discriminative::Classifier &classifier
|
||||
, Discriminative::FeatureVector &outFeatures) const {
|
||||
for (size_t i = 0; i < m_contextSize; i++)
|
||||
outFeatures.push_back(classifier.AddLabelIndependentFeature("tcwin^-" + SPrint(i + 1) + "^" + GetWord(phrase, i)));
|
||||
outFeatures.push_back(classifier.AddLabelIndependentFeature("tcwin^-" + SPrint(i + 1) + "^" + GetWord(contextPhrase, i)));
|
||||
}
|
||||
|
||||
virtual void SetParameter(const std::string& key, const std::string& value) {
|
||||
|
@ -30,7 +30,9 @@ public:
|
||||
, Discriminative::FeatureVector &outFeatures) const {
|
||||
}
|
||||
|
||||
virtual void operator()(const Phrase &phrase
|
||||
virtual void operator()(const InputType &input
|
||||
, const Phrase &contextPhrase
|
||||
, const AlignmentInfo &alignmentInfo
|
||||
, Discriminative::Classifier &classifier
|
||||
, Discriminative::FeatureVector &outFeatures) const {
|
||||
}
|
||||
|
@ -28,7 +28,9 @@ public:
|
||||
, Discriminative::FeatureVector &outFeatures) const {
|
||||
}
|
||||
|
||||
virtual void operator()(const Phrase &phrase
|
||||
virtual void operator()(const InputType &input
|
||||
, const Phrase &contextPhrase
|
||||
, const AlignmentInfo &alignmentInfo
|
||||
, Discriminative::Classifier &classifier
|
||||
, Discriminative::FeatureVector &outFeatures) const {
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user