diff options
author | Ulrich Germann <Ulrich.Germann@gmail.com> | 2015-11-11 20:07:45 +0300 |
---|---|---|
committer | Ulrich Germann <Ulrich.Germann@gmail.com> | 2015-11-11 20:07:45 +0300 |
commit | f247e26fed78347cfcaeb8f82b8db6b50feff3f8 (patch) | |
tree | ce29bcefd75605890ffbc90f0a0ccd1e869bcc6d /moses/Phrase.cpp | |
parent | fbfe5890d13760a6610abaf2b1797dc1db5cc9f4 (diff) |
More options refactoring (OOV Handling this time).
Diffstat (limited to 'moses/Phrase.cpp')
-rw-r--r-- | moses/Phrase.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/moses/Phrase.cpp b/moses/Phrase.cpp index ad3a16837..b9776179e 100644 --- a/moses/Phrase.cpp +++ b/moses/Phrase.cpp @@ -114,24 +114,26 @@ Phrase Phrase::GetSubString(const Range &range, FactorType factorType) const return retPhrase; } -std::string Phrase::GetStringRep(const vector<FactorType> factorsToPrint) const +std::string +Phrase:: +GetStringRep(vector<FactorType> const& factorsToPrint, + AllOptions const* opts) const { - bool markUnknown = StaticData::Instance().GetMarkUnknown(); - + if (!opts) opts = &StaticData::Instance().options(); + bool markUnk = opts->unk.mark; util::StringStream strme; for (size_t pos = 0 ; pos < GetSize() ; pos++) { - if (markUnknown && GetWord(pos).IsOOV()) { - strme << StaticData::Instance().GetUnknownWordPrefix(); + if (markUnk && GetWord(pos).IsOOV()) { + strme << opts->unk.prefix; } strme << GetWord(pos).GetString(factorsToPrint, (pos != GetSize()-1)); - if (markUnknown && GetWord(pos).IsOOV()) { - strme << StaticData::Instance().GetUnknownWordSuffix(); + if (markUnk && GetWord(pos).IsOOV()) { + strme << opts->unk.suffix; } } - return strme.str(); } - + Word &Phrase::AddWord() { m_words.push_back(Word()); |