From 73f2592edc0c8f510029e4834acd899751c85862 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Fri, 20 Sep 2013 20:01:03 +0200 Subject: loo --- extractor/grammar_extractor.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'extractor/grammar_extractor.cc') diff --git a/extractor/grammar_extractor.cc b/extractor/grammar_extractor.cc index 8050ce7b..1fbdee5b 100644 --- a/extractor/grammar_extractor.cc +++ b/extractor/grammar_extractor.cc @@ -3,11 +3,13 @@ #include #include #include +#include #include "grammar.h" #include "rule.h" #include "rule_factory.h" #include "vocabulary.h" +#include "data_array.h" using namespace std; @@ -32,10 +34,10 @@ GrammarExtractor::GrammarExtractor( vocabulary(vocabulary), rule_factory(rule_factory) {} -Grammar GrammarExtractor::GetGrammar(const string& sentence) { +Grammar GrammarExtractor::GetGrammar(const string& sentence, const unordered_set blacklisted_sentence_ids, const shared_ptr source_data_array) { vector words = TokenizeSentence(sentence); vector word_ids = AnnotateWords(words); - return rule_factory->GetGrammar(word_ids); + return rule_factory->GetGrammar(word_ids, blacklisted_sentence_ids, source_data_array); } vector GrammarExtractor::TokenizeSentence(const string& sentence) { -- cgit v1.2.3 From d32361ce37f794ae92f852ae2c7c3e6ef440ff07 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Wed, 13 Nov 2013 20:27:52 +0100 Subject: fix --- extractor/grammar_extractor.cc | 2 +- extractor/grammar_extractor.h | 2 +- extractor/rule_factory.cc | 2 +- extractor/rule_factory.h | 2 +- extractor/sampler.cc | 2 +- extractor/sampler.h | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'extractor/grammar_extractor.cc') diff --git a/extractor/grammar_extractor.cc b/extractor/grammar_extractor.cc index 1fbdee5b..487abcaf 100644 --- a/extractor/grammar_extractor.cc +++ b/extractor/grammar_extractor.cc @@ -34,7 +34,7 @@ GrammarExtractor::GrammarExtractor( vocabulary(vocabulary), rule_factory(rule_factory) {} -Grammar GrammarExtractor::GetGrammar(const string& sentence, const unordered_set blacklisted_sentence_ids, const shared_ptr source_data_array) { +Grammar GrammarExtractor::GetGrammar(const string& sentence, const unordered_set& blacklisted_sentence_ids, const shared_ptr source_data_array) { vector words = TokenizeSentence(sentence); vector word_ids = AnnotateWords(words); return rule_factory->GetGrammar(word_ids, blacklisted_sentence_ids, source_data_array); diff --git a/extractor/grammar_extractor.h b/extractor/grammar_extractor.h index 6c0aafbf..ae407b47 100644 --- a/extractor/grammar_extractor.h +++ b/extractor/grammar_extractor.h @@ -45,7 +45,7 @@ class GrammarExtractor { // Converts the sentence to a vector of word ids and uses the RuleFactory to // extract the SCFG rules which may be used to decode the sentence. - Grammar GetGrammar(const string& sentence, const unordered_set blacklisted_sentence_ids, const shared_ptr source_data_array); + Grammar GetGrammar(const string& sentence, const unordered_set& blacklisted_sentence_ids, const shared_ptr source_data_array); private: // Splits the sentence in a vector of words. diff --git a/extractor/rule_factory.cc b/extractor/rule_factory.cc index e52019ae..6ae2d792 100644 --- a/extractor/rule_factory.cc +++ b/extractor/rule_factory.cc @@ -101,7 +101,7 @@ HieroCachingRuleFactory::HieroCachingRuleFactory() {} HieroCachingRuleFactory::~HieroCachingRuleFactory() {} -Grammar HieroCachingRuleFactory::GetGrammar(const vector& word_ids, const unordered_set blacklisted_sentence_ids, const shared_ptr source_data_array) { +Grammar HieroCachingRuleFactory::GetGrammar(const vector& word_ids, const unordered_set& blacklisted_sentence_ids, const shared_ptr source_data_array) { Clock::time_point start_time = Clock::now(); double total_extract_time = 0; double total_intersect_time = 0; diff --git a/extractor/rule_factory.h b/extractor/rule_factory.h index c7332720..df63a9d8 100644 --- a/extractor/rule_factory.h +++ b/extractor/rule_factory.h @@ -72,7 +72,7 @@ class HieroCachingRuleFactory { // Constructs SCFG rules for a given sentence. // (See class description for more details.) - virtual Grammar GetGrammar(const vector& word_ids, const unordered_set blacklisted_sentence_ids, const shared_ptr source_data_array); + virtual Grammar GetGrammar(const vector& word_ids, const unordered_set& blacklisted_sentence_ids, const shared_ptr source_data_array); protected: HieroCachingRuleFactory(); diff --git a/extractor/sampler.cc b/extractor/sampler.cc index d332dd90..963afa7a 100644 --- a/extractor/sampler.cc +++ b/extractor/sampler.cc @@ -12,7 +12,7 @@ Sampler::Sampler() {} Sampler::~Sampler() {} -PhraseLocation Sampler::Sample(const PhraseLocation& location, unordered_set blacklisted_sentence_ids, const shared_ptr source_data_array) const { +PhraseLocation Sampler::Sample(const PhraseLocation& location, const unordered_set& blacklisted_sentence_ids, const shared_ptr source_data_array) const { vector sample; int num_subpatterns; if (location.matchings == NULL) { diff --git a/extractor/sampler.h b/extractor/sampler.h index 30e747fd..de450c48 100644 --- a/extractor/sampler.h +++ b/extractor/sampler.h @@ -23,7 +23,7 @@ class Sampler { virtual ~Sampler(); // Samples uniformly at most max_samples phrase occurrences. - virtual PhraseLocation Sample(const PhraseLocation& location, const unordered_set blacklisted_sentence_ids, const shared_ptr source_data_array) const; + virtual PhraseLocation Sample(const PhraseLocation& location, const unordered_set& blacklisted_sentence_ids, const shared_ptr source_data_array) const; protected: Sampler(); -- cgit v1.2.3