Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHieu Hoang <hieuhoang@gmail.com>2016-11-09 01:19:39 +0300
committerHieu Hoang <hieuhoang@gmail.com>2016-11-09 01:19:39 +0300
commite8f418f10991668ae91926c26e6450c710c4475c (patch)
treeb57261bc05273875755805b4141fefe75cca0978
parent948af8f35472f5878a91c76531891634a1b67210 (diff)
implement –mark-unknown, -unknown-word-prefix, and –unknown-word-suffix for backward compatibility
-rw-r--r--contrib/moses2/FF/FeatureFunctions.cpp53
1 files changed, 31 insertions, 22 deletions
diff --git a/contrib/moses2/FF/FeatureFunctions.cpp b/contrib/moses2/FF/FeatureFunctions.cpp
index 53eb0f351..8ca145060 100644
--- a/contrib/moses2/FF/FeatureFunctions.cpp
+++ b/contrib/moses2/FF/FeatureFunctions.cpp
@@ -68,34 +68,43 @@ void FeatureFunctions::Create()
UTIL_THROW_IF2(ffParams == NULL, "Must have [feature] section");
BOOST_FOREACH(const std::string &line, *ffParams){
- //cerr << "line=" << line << endl;
- FeatureFunction *ff = Create(line);
+ //cerr << "line=" << line << endl;
+ FeatureFunction *ff = Create(line);
- m_featureFunctions.push_back(ff);
+ m_featureFunctions.push_back(ff);
- StatefulFeatureFunction *sfff = dynamic_cast<StatefulFeatureFunction*>(ff);
- if (sfff) {
- sfff->SetStatefulInd(m_statefulFeatureFunctions.size());
- m_statefulFeatureFunctions.push_back(sfff);
- }
+ StatefulFeatureFunction *sfff = dynamic_cast<StatefulFeatureFunction*>(ff);
+ if (sfff) {
+ sfff->SetStatefulInd(m_statefulFeatureFunctions.size());
+ m_statefulFeatureFunctions.push_back(sfff);
+ }
- if (ff->HasPhraseTableInd()) {
- ff->SetPhraseTableInd(m_withPhraseTableInd.size());
- m_withPhraseTableInd.push_back(ff);
- }
+ if (ff->HasPhraseTableInd()) {
+ ff->SetPhraseTableInd(m_withPhraseTableInd.size());
+ m_withPhraseTableInd.push_back(ff);
+ }
- PhraseTable *pt = dynamic_cast<PhraseTable*>(ff);
- if (pt) {
- pt->SetPtInd(m_phraseTables.size());
- m_phraseTables.push_back(pt);
- }
+ PhraseTable *pt = dynamic_cast<PhraseTable*>(ff);
+ if (pt) {
+ pt->SetPtInd(m_phraseTables.size());
+ m_phraseTables.push_back(pt);
+ }
- const UnknownWordPenalty *unkWP = dynamic_cast<const UnknownWordPenalty *>(pt);
- if (unkWP) {
- m_unkWP = unkWP;
- }
+ UnknownWordPenalty *unkWP = dynamic_cast<UnknownWordPenalty *>(pt);
+ if (unkWP) {
+ m_unkWP = unkWP;
-}
+ // legacy support
+ if (m_system.options.unk.drop) {
+ unkWP->SetParameter("drop", "true");
+ }
+ if (m_system.options.unk.mark) {
+ unkWP->SetParameter("prefix", m_system.options.unk.prefix);
+ unkWP->SetParameter("suffix", m_system.options.unk.suffix);
+ }
+ }
+
+ }
}
FeatureFunction *FeatureFunctions::Create(const std::string &line)