X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=TCImplementation.cpp;h=1a29f2524eccf74a394c02aed5b62bf4c54bb252;hb=443151511a86083b21c1c06eb610f86b3aed35be;hp=a8303d8be74b7251ba2171dda41cda9f27c4499a;hpb=b472b8a9abdb1695994b4b23963de98c361dc66b;p=SXSI%2FTextCollection.git diff --git a/TCImplementation.cpp b/TCImplementation.cpp index a8303d8..1a29f25 100644 --- a/TCImplementation.cpp +++ b/TCImplementation.cpp @@ -19,6 +19,7 @@ *****************************************************************************/ #include "TCImplementation.h" +//#define DEBUG_MEMUSAGE #ifdef DEBUG_MEMUSAGE #include "HeapProfiler.h" // FIXME remove #endif @@ -35,26 +36,28 @@ using std::vector; using std::pair; using std::make_pair; using std::map; - +using std::string; namespace SXSI { // Save file version info -const uchar TCImplementation::versionFlag = 4; +const uchar TCImplementation::versionFlag = 8; /** * Constructor inits an empty dynamic FM-index. * Samplerate defaults to TEXTCOLLECTION_DEFAULT_SAMPLERATE. */ -TCImplementation::TCImplementation(uchar * bwt, ulong length, unsigned samplerate_, unsigned numberOfTexts_, ulong maxTextLength_) +TCImplementation::TCImplementation(uchar * bwt, ulong length, unsigned samplerate_, + unsigned numberOfTexts_, ulong maxTextLength_, ulong numberOfSamples_, + CSA::DeltaVector & notIndexed, const string & niText, char tsType) : n(length), samplerate(samplerate_), alphabetrank(0), sampled(0), suffixes(0), suffixDocId(0), numberOfTexts(numberOfTexts_), maxTextLength(maxTextLength_), Doc(0) { makewavelet(bwt); // Deletes bwt! bwt = 0; - + // Make sampling tables - maketables(); + maketables(numberOfSamples_, tsType, notIndexed, niText); } bool TCImplementation::EmptyText(DocId k) const @@ -63,10 +66,12 @@ bool TCImplementation::EmptyText(DocId k) const return false; // Empty texts are not indexed } -uchar* TCImplementation::GetText(DocId k) const +uchar * TCImplementation::GetText(DocId k) const { assert(k < (DocId)numberOfTexts); - TextPosition i = k; + + return textStorage->GetText(k); +/* TextPosition i = k; string result; // Reserve average string length to avoid reallocs @@ -87,10 +92,11 @@ uchar* TCImplementation::GetText(DocId k) const res[i] = '\0'; for (ulong j = 0; j < i; ++j) res[i-j-1] = result[j]; - return res; + return res;*/ } + /* - * Not supported + * Substring queries are supported via the pointer returned by TextStorage::GetText uchar* TCImplementation::GetText(DocId k, TextPosition i, TextPosition j) const { assert(k < (DocId)numberOfTexts); @@ -105,6 +111,8 @@ uchar* TCImplementation::GetText(DocId k, TextPosition i, TextPosition j) const return Substring(i + start, j-i+1); }*/ + + /****************************************************************** * Existential queries */ @@ -524,30 +532,7 @@ TextCollection::document_result TCImplementation::Contains(uchar const * pattern // We want unique document indentifiers, using std::set to collect them std::set resultSet; - - // Check each occurrence - for (; sp <= ep; ++sp) - { - TextPosition i = sp; - uchar c = alphabetrank->access(i); - while (c != '\0' && !sampled->access(i)) - { - i = C[c]+alphabetrank->rank(c,i)-1; // LF-mapping - c = alphabetrank->access(i); - } - if (c == '\0') - { - // Rank among the end-markers in BWT - unsigned endmarkerRank = alphabetrank->rank(0, i) - 1; - resultSet.insert(Doc->access(endmarkerRank)); - } - else - { - DocId di = (*suffixDocId)[sampled->rank1(i)-1]; - assert((unsigned)di < numberOfTexts); - resultSet.insert(di); - } - } + EnumerateDocuments(resultSet, sp, ep); // Convert std::set to std::vector TextCollection::document_result result(resultSet.begin(), resultSet.end()); @@ -566,39 +551,18 @@ TextCollection::document_result TCImplementation::Contains(uchar const * pattern // We want unique document indentifiers, using std::set to collect them std::set resultSet; - - // Check each occurrence - for (; sp <= ep; ++sp) - { - TextPosition i = sp; - uchar c = alphabetrank->access(i); - while (c != '\0' && !sampled->access(i)) - { - i = C[c]+alphabetrank->rank(c,i)-1; // LF-mapping - c = alphabetrank->access(i); - } - if (c == '\0') - { - // Rank among the end-markers in BWT - unsigned endmarkerRank = alphabetrank->rank(0, i) - 1; - DocId docId = Doc->access(endmarkerRank); - if (docId >= begin && docId <= end) - resultSet.insert(docId); - } - else - { - DocId docId = (*suffixDocId)[sampled->rank1(i)-1]; - assert((unsigned)docId < numberOfTexts); - if (docId >= begin && docId <= end) - resultSet.insert(docId); - } - } + EnumerateDocuments(resultSet, sp, ep, begin, end); // Convert std::set to std::vector TextCollection::document_result result(resultSet.begin(), resultSet.end()); return result; } + +/** + *** +* * FIXME Lessthan or equal + */ TextCollection::document_result TCImplementation::LessThan(uchar const * pattern) const { TextPosition m = strlen((char *)pattern); @@ -625,6 +589,50 @@ TextCollection::document_result TCImplementation::LessThan(uchar const * pattern return EnumerateEndmarkers(sp, ep, begin, end); } + +TextCollection::document_result TCImplementation::KMismaches(uchar const * pattern, unsigned k) const +{ + TextPosition m = strlen((char *)pattern); + if (m == 0) + return TextCollection::document_result(); // empty result set + + suffix_range_vector ranges; + kmismatches(ranges, pattern, 0, n-1, m, k); + std::set resultSet; + + for (suffix_range_vector::iterator it = ranges.begin(); it != ranges.end(); ++it) + // Iterate through docs in [sp,ep]: + EnumerateDocuments(resultSet, (*it).first, (*it).second); + + // Convert std::set to std::vector + TextCollection::document_result result(resultSet.begin(), resultSet.end()); + return result; +} + +TextCollection::document_result TCImplementation::KErrors(uchar const * pattern, unsigned k) const +{ + TextPosition m = strlen((char *)pattern); + if (m == 0) + return TextCollection::document_result(); // empty result set + + suffix_range_vector ranges; + ulong *dd = new ulong[m+1]; + for (ulong i=0;i resultSet; + for (suffix_range_vector::iterator it = ranges.begin(); it != ranges.end(); ++it) + // Iterate through docs in [sp,ep]: + EnumerateDocuments(resultSet, (*it).first, (*it).second); + + // Convert std::set to std::vector + TextCollection::document_result result(resultSet.begin(), resultSet.end()); + return result; +} + + /** * Full result set queries */ @@ -640,34 +648,7 @@ TextCollection::full_result TCImplementation::FullContains(uchar const * pattern full_result result; result.reserve(ep-sp+1); // Try to avoid reallocation. - - // Report each occurrence - for (; sp <= ep; ++sp) - { - TextPosition i = sp; - TextPosition dist = 0; - uchar c = alphabetrank->access(i); - while (c != '\0' && !sampled->access(i)) - { - i = C[c]+alphabetrank->rank(c,i)-1; - c = alphabetrank->access(i); - ++ dist; - } - if (c == '\0') - { - // Rank among the end-markers in BWT - unsigned endmarkerRank = alphabetrank->rank(0, i) - 1; - DocId docId = Doc->access(endmarkerRank); - result.push_back(make_pair(docId, dist)); - } - else - { - TextPosition textPos = (*suffixes)[sampled->rank1(i)-1] + dist; - DocId docId = (*suffixDocId)[sampled->rank1(i)-1]; - - result.push_back(make_pair(docId, textPos)); - } - } + EnumeratePositions(result, sp, ep); return result; } @@ -684,39 +665,46 @@ TextCollection::full_result TCImplementation::FullContains(uchar const * pattern full_result result; result.reserve(ep-sp+1); // Try to avoid reallocation. + EnumeratePositions(result, sp, ep, begin, end); + + return result; +} - // Report each occurrence - for (; sp <= ep; ++sp) - { - TextPosition i = sp; - TextPosition dist = 0; - uchar c = alphabetrank->access(i); - while (c != '\0' && !sampled->access(i)) - { - i = C[c]+alphabetrank->rank(c,i)-1; - c = alphabetrank->access(i); - ++ dist; - } - if (c == '\0') - { - // Rank among the end-markers in BWT - unsigned endmarkerRank = alphabetrank->rank(0, i) - 1; - - // End-marker that we found belongs to the "preceeding" doc in collection: - DocId docId = Doc->access(endmarkerRank); - if (docId >= begin && docId <= end) - result.push_back(make_pair(docId, dist)); - } - else - { - TextPosition textPos = (*suffixes)[sampled->rank1(i)-1] + dist; - DocId docId = (*suffixDocId)[sampled->rank1(i)-1]; +TextCollection::full_result TCImplementation::FullKMismatches(uchar const * pattern, unsigned k) const +{ + TextPosition m = strlen((char *)pattern); + if (m == 0) + return TextCollection::full_result(); // empty result set - if (docId >= begin && docId <= end) - result.push_back(make_pair(docId, textPos)); - } - } - + suffix_range_vector ranges; + ulong count = kmismatches(ranges, pattern, 0, n-1, m, k); + + TextCollection::full_result result; + result.reserve(count); // avoid reallocation. + for (suffix_range_vector::iterator it = ranges.begin(); it != ranges.end(); ++it) + // Iterate through docs in [sp,ep]: + EnumeratePositions(result, (*it).first, (*it).second); + return result; +} + +TextCollection::full_result TCImplementation::FullKErrors(uchar const * pattern, unsigned k) const +{ + TextPosition m = strlen((char *)pattern); + if (m == 0) + return TextCollection::full_result(); // empty result set + + suffix_range_vector ranges; + ulong *dd = new ulong[m+1]; + for (unsigned i=0;isave(file); + textStorage->Save(file); fflush(file); } @@ -778,8 +767,13 @@ void TCImplementation::Save(FILE *file) const * * Throws a std::runtime_error exception on i/o error. * For more info, see TCImplementation::Save(). + * + * index_mode_t is defined in TextCollection.h and + * defaults to both the index and "naive" text. + * + * Note: Samplerate can not be changed during load. */ -TCImplementation::TCImplementation(FILE *file, unsigned samplerate_) +TCImplementation::TCImplementation(FILE *file, index_mode_t im, unsigned samplerate_) : n(0), samplerate(samplerate_), alphabetrank(0), sampled(0), suffixes(0), suffixDocId(0), numberOfTexts(0), maxTextLength(0), Doc(0) { @@ -805,16 +799,24 @@ TCImplementation::TCImplementation(FILE *file, unsigned samplerate_) throw std::runtime_error("TCImplementation::Load(): file read error (bwt end position)."); alphabetrank = static_sequence::load(file); + if (im == index_mode_text_only) { delete alphabetrank; alphabetrank = 0; } + sampled = static_bitsequence::load(file); + if (im == index_mode_text_only) { delete sampled; sampled = 0; } suffixes = new BlockArray(file); + if (im == index_mode_text_only) { delete suffixes; suffixes = 0; } suffixDocId = new BlockArray(file); + if (im == index_mode_text_only) { delete suffixDocId; suffixDocId = 0; } if (std::fread(&(this->numberOfTexts), sizeof(unsigned), 1, file) != 1) throw std::runtime_error("TCImplementation::Load(): file read error (numberOfTexts)."); if (std::fread(&(this->maxTextLength), sizeof(ulong), 1, file) != 1) throw std::runtime_error("TCImplementation::Load(): file read error (maxTextLength)."); - Doc = static_sequence::load(file); + Doc = new ArrayDoc(file); //static_sequence::load(file); + if (im == index_mode_text_only) { delete Doc; Doc = 0; } + + textStorage = TextStorage::Load(file); // FIXME Construct data structures with new samplerate //maketables(); @@ -825,7 +827,95 @@ TCImplementation::TCImplementation(FILE *file, unsigned samplerate_) /** * Rest of the functions follow... */ +ulong TCImplementation::searchPrefix(uchar const *pattern, ulong i, ulong *sp, ulong *ep) const +{ + int c; + while (*sp<=*ep && i>=1) + { + c = (int)pattern[--i]; + *sp = C[c]+alphabetrank->rank(c,*sp-1); + *ep = C[c]+alphabetrank->rank(c,*ep)-1; + } + if (*sp<=*ep) + return *ep - *sp + 1; + else + return 0; +} + + +ulong TCImplementation::kmismatches(suffix_range_vector &result, uchar const *pattern, ulong sp, ulong ep, ulong j, unsigned k) const +{ + if (sp>ep) return 0; + if (j == 0) + { + result.push_back(std::make_pair(sp,ep)); + return ep-sp+1; + } + int c; + ulong spnew; + ulong epnew; + int knew; + ulong sum=0; + if (k==0) + { + sum = searchPrefix(pattern, j, &sp, &ep); + if (sp<=ep) + result.push_back(std::make_pair(sp, ep)); + return sum; + } + vector chars = alphabetrank->accessAll(sp, ep); + for (vector::iterator it = chars.begin(); it != chars.end(); ++it) + { + if (*it == 0) + continue; // skip '\0' + c = *it; + spnew = C[c]+alphabetrank->rank(c,sp-1); + epnew = C[c]+alphabetrank->rank(c,ep)-1; + if (c!=pattern[j-1]) knew = (int)k-1; else knew = k; + if (knew>=0) sum += kmismatches(result, pattern, spnew, epnew, j-1, knew); + } + return sum; +} +//first call kerrors(pattern,1,n,m+k,k,d,m), where d[i]=i +ulong TCImplementation::kerrors(suffix_range_vector &result, uchar const *pattern, ulong sp, ulong ep, ulong j, unsigned k, ulong const *d, ulong m) const +{ + ulong sum=0; + if (d[m]<=k) // range of suffixes with at most k-errors found + { + if (sp<=ep) + result.push_back(std::make_pair(sp, ep)); + sum += (sp<=ep)?ep-sp+1:0ul; + } + if (sp>ep || j==0) + return sum; + ulong *dnew = new ulong[m+1]; + int c; + ulong spnew; + ulong p,lowerbound; + ulong epnew; + vector chars = alphabetrank->accessAll(sp, ep); + for (vector::iterator it = chars.begin(); it != chars.end(); ++it) + { + if (*it == 0) + continue; // skip '\0' + c = *it; + spnew = C[c]+alphabetrank->rank(c,sp-1); + epnew = C[c]+alphabetrank->rank(c,ep)-1; + if (spnew>epnew) continue; + dnew[0]=m+k-j+1; + lowerbound=k+1; + for (p=1; p<=m; p++) { + dnew[p]=myminofthree(d[p]+1,dnew[p-1]+1,(c==pattern[m-p])?d[p-1]:(d[p-1]+1)); + if (dnew[p]bwtEndPos = i; } +#ifdef DEBUG_MEMUSAGE + std::cerr << "heap usage before BWT traverse: " << HeapProfiler::GetHeapConsumption()/(1024*1024) << " / " << HeapProfiler::GetMaxHeapConsumption()/(1024*1024) << " Mbytes, " << HeapProfiler::GetHeapConsumption() << " / " << HeapProfiler::GetMaxHeapConsumption() << std::endl; + HeapProfiler::ResetMaxHeapConsumption(); +#endif + // Build up array for text starting positions - BlockArray* textStartPos = new BlockArray(numberOfTexts, Tools::CeilLog2(this->n)); - (*textStartPos)[0] = 0; +// BlockArray* textStartPos = new BlockArray(numberOfTexts, Tools::CeilLog2(this->n)); +// (*textStartPos)[0] = 0; // Mapping from end-markers to doc ID's: - uint *endmarkerDocId = new uint[numberOfTexts]; // FIXME Use BlockArray with static_sequence_wvtree_noptrs. - + unsigned logNumberOfTexts = Tools::CeilLog2(numberOfTexts); +// uint *endmarkerDocId = new uint[(numberOfTexts * logNumberOfTexts)/(8*sizeof(uint)) + 1]; + BlockArray *endmarkerDocId = new BlockArray(numberOfTexts, logNumberOfTexts); + + BlockArray* positions = new BlockArray(sampleLength, Tools::CeilLog2(this->n)); uint *sampledpositions = new uint[n/(sizeof(uint)*8)+1]; for (ulong i = 0; i < n / (sizeof(uint)*8) + 1; i++) sampledpositions[i] = 0; @@ -982,100 +1081,182 @@ void TCImplementation::maketables() ulong x,p=bwtEndPos; ulong sampleCount = 0; // Keeping track of text position of prev. end-marker seen - ulong posOfSuccEndmarker = n; + ulong posOfSuccEndmarker = n-1; DocId textId = numberOfTexts; ulong ulongmax = 0; ulongmax--; uint alphabetrank_i_tmp =0; - /** - * First pass: populate tables textStartPos and sampledpositions. - */ + // Text length = n + number of bytes not indexed. + TextStorageBuilder tsbuilder(n + niText.length()); + ulong tsb_i = n + niText.length(); // Iterator from text length to 0. + string::const_reverse_iterator nit_i = niText.rbegin(); // Iterator through non-indexed texts + for (ulong i=n-1;iGetPos(i) x=(i==n-1)?0:i+1; - if (x % samplerate == 0 && posOfSuccEndmarker - x > samplerate) { + uchar c = alphabetrank->access(p, alphabetrank_i_tmp); + + tsbuilder[--tsb_i] = c; // Build TextStorage + + if ((posOfSuccEndmarker - i) % samplerate == 0 && c != '\0') + { set_field(sampledpositions,1,p,1); + (*positions)[sampleCount] = p; sampleCount ++; } - uchar c = alphabetrank->access(p, alphabetrank_i_tmp); if (c == '\0') { - --textId; + unsigned prevTextId = textId; // Cache textId value. + --textId; + /** + * At first c == '\0' it holds that (prevTextId == numberOfTexts), thus, + * we have to search for the first text that is actually *indexed* + * to get correct prevTextId. + */ + if (prevTextId == numberOfTexts) + { + prevTextId = 0; + while (notIndexed.isSet(prevTextId)) + ++ prevTextId; + // Now prevTextId points to the first indexed Doc ID. + } + + /** + * Insert non-indexed texts + */ + while (notIndexed.isSet(textId)) + { + do { + tsbuilder[tsb_i] = *nit_i; + -- tsb_i; + ++ nit_i; + } while (nit_i != niText.rend() && *nit_i != '\0'); + + tsbuilder[tsb_i] = '\0'; + + if (textId == 0) + break; + --textId; + } // Record the order of end-markers in BWT: ulong endmarkerRank = alphabetrank_i_tmp - 1; - endmarkerDocId[endmarkerRank] = (textId + 1) % numberOfTexts; + //set_field(endmarkerDocId, logNumberOfTexts, endmarkerRank, (textId + 1) % numberOfTexts); + (*endmarkerDocId)[endmarkerRank] = prevTextId % numberOfTexts; // Store text length and text start position: if (textId < (DocId)numberOfTexts - 1) { - (*textStartPos)[textId + 1] = x; // x is the position of end-marker. - posOfSuccEndmarker = x; +// (*textStartPos)[textId + 1] = x; // x-1 is text position of end-marker. + + posOfSuccEndmarker = i; } - // LF-mapping from '\0' does not work with this (pseudo) BWT (see details from Wolfgang's thesis). - p = textId; // Correct LF-mapping to the last char of the previous text. + // LF-mapping from '\0' does not work with this (pseudo) BWT. + // Correct LF-mapping to the last char of the previous text: + p = textId - notIndexed.rank(textId); } else // Now c != '\0', do LF-mapping: p = C[c]+alphabetrank_i_tmp-1; } + while (textId > 0 && notIndexed.isSet(textId-1)) + { + do { + -- tsb_i; + tsbuilder[tsb_i] = *nit_i; + ++ nit_i; + } while (nit_i != niText.rend() && *nit_i != '\0'); + --textId; + } assert(textId == 0); - + assert(tsb_i == 0); + assert(nit_i == niText.rend()); + +#ifdef DEBUG_MEMUSAGE + std::cerr << "heap usage before tsbuilder init: " << HeapProfiler::GetHeapConsumption()/(1024*1024) << " / " << HeapProfiler::GetMaxHeapConsumption()/(1024*1024) << " Mbytes, " << HeapProfiler::GetHeapConsumption() << " / " << HeapProfiler::GetMaxHeapConsumption() << std::endl; + HeapProfiler::ResetMaxHeapConsumption(); +#endif + + textStorage = tsbuilder.InitTextStorage(tsType); + +#ifdef DEBUG_MEMUSAGE + std::cerr << "heap usage after tsbuilder init: " << HeapProfiler::GetHeapConsumption()/(1024*1024) << " / " << HeapProfiler::GetMaxHeapConsumption()/(1024*1024) << " Mbytes, " << HeapProfiler::GetHeapConsumption() << " / " << HeapProfiler::GetMaxHeapConsumption() << std::endl; + HeapProfiler::ResetMaxHeapConsumption(); +#endif + sampled = new static_bitsequence_rrr02(sampledpositions, n, 16); delete [] sampledpositions; - ulong sampleLength = sampled->rank1(n-1); assert(sampleCount == sampleLength); + assert(sampled->rank1(n-1) == sampleLength); + +#ifdef DEBUG_MEMUSAGE + std::cerr << "heap usage after sampled bit vector: " << HeapProfiler::GetHeapConsumption()/(1024*1024) << " / " << HeapProfiler::GetMaxHeapConsumption()/(1024*1024) << " Mbytes, " << HeapProfiler::GetHeapConsumption() << " / " << HeapProfiler::GetMaxHeapConsumption() << std::endl; + HeapProfiler::ResetMaxHeapConsumption(); +#endif // Suffixes store an offset from the text start position suffixes = new BlockArray(sampleLength, Tools::CeilLog2(maxTextLength)); suffixDocId = new BlockArray(sampleLength, Tools::CeilLog2(numberOfTexts)); - p=bwtEndPos; - textId = numberOfTexts; - - /** - * Second pass: populate tables suffixes and suffixDocId. - */ - for (ulong i=n-1;iaccess(p)) { - ulong j = sampled->rank1(p)-1; - - (*suffixDocId)[j] = DocIdAtTextPos(textStartPos, x); - - // calculate offset from text start: - (*suffixes)[j] = x - (*textStartPos)[(*suffixDocId)[j]]; + x = n + niText.length() - 2; + textId = numberOfTexts - 1; + posOfSuccEndmarker = x + 1; + for(ulong i = 0; i < sampleLength; i ++) { + // Find next sampled text position + while ((posOfSuccEndmarker - x) % samplerate != 0 + || notIndexed.isSet(textId)) // Loop over non-indexed + { + --x; + assert(x != ~0lu); + if (textStorage->IsEndmarker(x)) + { + posOfSuccEndmarker = x--; + -- textId; + } } + assert((*positions)[i] < n); + ulong j = sampled->rank1((*positions)[i]); - uchar c = alphabetrank->access(p, alphabetrank_i_tmp); - if (c == '\0') + assert(j != 0); // if (j==0) j=sampleLength; + + TextPosition textPos = (x==n-1)?0:x+1; + (*suffixDocId)[j-1] = textId; // textStorage->DocIdAtTextPos(textPos); + assert(textStorage->DocIdAtTextPos(textPos) == textId); + + assert((*suffixDocId)[j-1] < numberOfTexts); + // calculate offset from text start: + (*suffixes)[j-1] = textPos - textStorage->TextStartPos((*suffixDocId)[j-1]); + --x; + if (x != ~0lu && textStorage->IsEndmarker(x)) { - --textId; - // LF-mapping from '\0' does not work with this (pseudo) BWT (see details from Wolfgang's thesis). - p = textId; // Correct LF-mapping to the last char of the previous text. + posOfSuccEndmarker = x--; + -- textId; } - else // Now c != '\0', do LF-mapping: - p = C[c]+alphabetrank_i_tmp-1; } - assert(textId == 0); - delete textStartPos; + delete positions; + +#ifdef DEBUG_MEMUSAGE + std::cerr << "heap usage after sampled arrays: " << HeapProfiler::GetHeapConsumption()/(1024*1024) << " / " << HeapProfiler::GetMaxHeapConsumption()/(1024*1024) << " Mbytes, " << HeapProfiler::GetHeapConsumption() << " / " << HeapProfiler::GetMaxHeapConsumption() << std::endl; + HeapProfiler::ResetMaxHeapConsumption(); +#endif #ifdef DEBUG_MEMUSAGE std::cerr << "max heap usage before Doc: " << HeapProfiler::GetMaxHeapConsumption()/(1024*1024) << " Mbytes" << std::endl; HeapProfiler::ResetMaxHeapConsumption(); #endif - alphabet_mapper * am = new alphabet_mapper_none(); - static_bitsequence_builder * bmb = new static_bitsequence_builder_brw32(16); // FIXME samplerate? - Doc = new static_sequence_wvtree_noptrs(endmarkerDocId, numberOfTexts, bmb, am, true); - delete bmb; + /*alphabet_mapper * am = new alphabet_mapper_none(); + static_bitsequence_builder * bmb = new static_bitsequence_builder_rrr02(32); // FIXME samplerate? + Doc = new static_sequence_wvtree_noptrs(endmarkerDocId, numberOfTexts, logNumberOfTexts, bmb, am, true); + delete bmb;*/ // delete [] endmarkerDocId; // already deleted in static_sequence_wvtree_noptrs! + Doc = new ArrayDoc(endmarkerDocId); + #ifdef DEBUG_MEMUSAGE std::cerr << "max heap usage after Doc: " << HeapProfiler::GetMaxHeapConsumption()/(1024*1024) << " Mbytes" << std::endl; #endif