diff options
author | Hieu Hoang <hieu@hoang.co.uk> | 2013-04-26 15:20:49 +0400 |
---|---|---|
committer | Hieu Hoang <hieu@hoang.co.uk> | 2013-04-26 15:20:49 +0400 |
commit | b448c6285a5e7cb45549dc11d77969a695a969cd (patch) | |
tree | 3b48c48c3cd5f330a46562e0fdab1aebbc5273b7 /moses/Phrase.cpp | |
parent | 75c85acd5e81e741345a41371010b25769b9f4b2 (diff) |
make scfg work with factored input. Strip factors from source that are not part of phrase-table input factors
Diffstat (limited to 'moses/Phrase.cpp')
-rw-r--r-- | moses/Phrase.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/moses/Phrase.cpp b/moses/Phrase.cpp index 98e7bb5a4..a19c1fb5e 100644 --- a/moses/Phrase.cpp +++ b/moses/Phrase.cpp @@ -342,6 +342,17 @@ void Phrase::FinalizeMemPool() { } +void Phrase::OnlyTheseFactors(const FactorMask &factors) +{ + for (unsigned int currFactor = 0 ; currFactor < MAX_NUM_FACTORS ; currFactor++) { + if (!factors[currFactor]) { + for (size_t pos = 0; pos < GetSize(); ++pos) { + SetFactor(pos, currFactor, NULL); + } + } + } +} + TO_STRING_BODY(Phrase); // friend |