summaryrefslogtreecommitdiff
path: root/extractor/fast_intersector.cc
diff options
context:
space:
mode:
authorPaul Baltescu <pauldb89@gmail.com>2013-06-25 15:13:30 +0100
committerPaul Baltescu <pauldb89@gmail.com>2013-06-25 15:13:30 +0100
commitcd4dbb5c0b581efb0369330ea330f2b473628a96 (patch)
treeb6d41b64b75100954cccdd3ef2f4035e2c7fa837 /extractor/fast_intersector.cc
parent5794c0109902cf19a52cc8f1799353270ed9d85d (diff)
Reduce memory used by precomputation.
Diffstat (limited to 'extractor/fast_intersector.cc')
-rw-r--r--extractor/fast_intersector.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/extractor/fast_intersector.cc b/extractor/fast_intersector.cc
index a8591a72..5360c1da 100644
--- a/extractor/fast_intersector.cc
+++ b/extractor/fast_intersector.cc
@@ -20,10 +20,13 @@ FastIntersector::FastIntersector(shared_ptr<SuffixArray> suffix_array,
vocabulary(vocabulary),
max_rule_span(max_rule_span),
min_gap_size(min_gap_size) {
- Index precomputed_collocations = precomputation->GetCollocations();
- for (pair<vector<int>, vector<int>> entry: precomputed_collocations) {
- vector<int> phrase = ConvertPhrase(entry.first);
- collocations[phrase] = entry.second;
+ auto precomputed_collocations = precomputation->GetCollocations();
+ for (auto item: precomputed_collocations) {
+ vector<int> phrase = ConvertPhrase(item.first);
+ vector<int> location = item.second;
+ vector<int>& phrase_collocations = collocations[phrase];
+ phrase_collocations.insert(phrase_collocations.end(), location.begin(),
+ location.end());
}
}