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 <hieu@hoang.co.uk>2013-04-26 15:20:49 +0400
committerHieu Hoang <hieu@hoang.co.uk>2013-04-26 15:20:49 +0400
commitb448c6285a5e7cb45549dc11d77969a695a969cd (patch)
tree3b48c48c3cd5f330a46562e0fdab1aebbc5273b7 /moses/Phrase.cpp
parent75c85acd5e81e741345a41371010b25769b9f4b2 (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.cpp11
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