mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 11:25:40 +03:00
vw corner cases when looking inside factors
This commit is contained in:
parent
90f6f4d4a7
commit
2a58011d37
@ -71,6 +71,12 @@ protected:
|
||||
if (m_targetFactors.size() != 1)
|
||||
UTIL_THROW2("You can only use factor-positions when a single target-side factor is defined.");
|
||||
const std::string &fullFactor = word.GetFactor(m_targetFactors[0])->GetString().as_string();
|
||||
|
||||
// corner cases: at sentence beginning/end, we don't have the correct factors set up
|
||||
// similarly for UNK
|
||||
if (fullFactor == BOS_ || fullFactor == EOS_ || fullFactor == UNKNOWN_FACTOR)
|
||||
return fullFactor;
|
||||
|
||||
std::string subFactor(m_factorPositions.size(), 'x'); // initialize string with correct size and placeholder chars
|
||||
for (size_t i = 0; i < m_factorPositions.size(); i++)
|
||||
subFactor[i] = fullFactor[m_factorPositions[i]];
|
||||
|
Loading…
Reference in New Issue
Block a user