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:
authorRico Sennrich <rico.sennrich@gmx.ch>2014-03-21 14:53:15 +0400
committerRico Sennrich <rico.sennrich@gmx.ch>2014-03-21 15:12:24 +0400
commit45630a5851fad3bdd6953e88727e4b7c8d0c4c18 (patch)
treecd95a3175eb7fc4bb1027cf92d2fa880112b3fee /moses/ChartParser.cpp
parent1c6061e78174d09ea4a7a8125ee0df7f41d88ae5 (diff)
various optimizations to make CYK+ parser several times faster and eat less memory.
speed-up of decoding depends on how much time is spent in parser: 10-50% speed-up for string-to-tree systems observed (more on long sentences and with high max-chart-span). if you only use hiero or string-to-tree models (but none with source syntax), use compile-option --unlabelled-source for (small) efficiency gains.
Diffstat (limited to 'moses/ChartParser.cpp')
-rw-r--r--moses/ChartParser.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/moses/ChartParser.cpp b/moses/ChartParser.cpp
index 6a9ec2efb..b77a5c20c 100644
--- a/moses/ChartParser.cpp
+++ b/moses/ChartParser.cpp
@@ -181,8 +181,12 @@ void ChartParser::Create(const WordsRange &wordsRange, ChartParserCallback &to)
assert(decodeGraph.GetSize() == 1);
ChartRuleLookupManager &ruleLookupManager = **iterRuleLookupManagers;
size_t maxSpan = decodeGraph.GetMaxChartSpan();
+ size_t last = m_source.GetSize()-1;
+ if (maxSpan != 0) {
+ last = min(last, wordsRange.GetStartPos()+maxSpan);
+ }
if (maxSpan == 0 || wordsRange.GetNumWordsCovered() <= maxSpan) {
- ruleLookupManager.GetChartRuleCollection(wordsRange, to);
+ ruleLookupManager.GetChartRuleCollection(wordsRange, last, to);
}
}