From 0a53f7eca74c165b5ce1c238f1999ddf1febea55 Mon Sep 17 00:00:00 2001 From: Paul Baltescu Date: Fri, 1 Feb 2013 16:11:10 +0000 Subject: Second working commit. --- extractor/intersector.h | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'extractor/intersector.h') diff --git a/extractor/intersector.h b/extractor/intersector.h index 874ffc1b..f023cc96 100644 --- a/extractor/intersector.h +++ b/extractor/intersector.h @@ -13,8 +13,8 @@ using namespace std; using namespace tr1; -typedef boost::hash > vector_hash; -typedef unordered_map, vector, vector_hash> Index; +typedef boost::hash > VectorHash; +typedef unordered_map, vector, VectorHash> Index; class DataArray; class MatchingComparator; @@ -28,19 +28,31 @@ class Intersector { public: Intersector( shared_ptr vocabulary, - const Precomputation& precomputaiton, + shared_ptr precomputation, shared_ptr source_suffix_array, shared_ptr comparator, bool use_baeza_yates); + // For testing. + Intersector( + shared_ptr vocabulary, + shared_ptr precomputation, + shared_ptr source_suffix_array, + shared_ptr linear_merger, + shared_ptr binary_search_merger, + bool use_baeza_yates); + PhraseLocation Intersect( const Phrase& prefix, PhraseLocation& prefix_location, const Phrase& suffix, PhraseLocation& suffix_location, const Phrase& phrase); private: - vector Convert(const vector& old_phrase, - shared_ptr source_data_array); + void ConvertIndexes(shared_ptr precomputation, + shared_ptr data_array); + + vector ConvertPhrase(const vector& old_phrase, + shared_ptr data_array); void ExtendPhraseLocation(const Phrase& phrase, PhraseLocation& phrase_location); -- cgit v1.2.3