def search(self, search_string): """ return: collection (list) int of offsets in original string where substring can be found """ if not self.meta_index or not self.lcp: raise ValueError else: search_string = search_string if not self.force_unicode else unicode(search_string, 'utf-8', 'replace') sa_i = self.meta_index.index_search(search_string) return sa_utils.lcp_scan(self.lcp, self.meta_index.suffix_array, search_string, sa_i) if sa_i >= 0 else []
def search(self, search_string): """ return: collection (list) int of offsets in original string where substring can be found """ if not self.sa or not self.lcp: raise ValueError else: search_string = search_string if not self.force_unicode else unicode(search_string, 'utf-8', 'replace') sa_i = sa_utils.binary_search(self.corpus_str, self.sa, search_string) return sa_utils.lcp_scan(self.lcp, self.sa, search_string, sa_i) if sa_i >= 0 else []
def search(self, search_string): """ return: collection (list) int of offsets in original string where substring can be found """ if not self.meta_index or not self.lcp: raise ValueError else: search_string = search_string if not self.force_unicode else unicode( search_string, 'utf-8', 'replace') sa_i = self.meta_index.index_search(search_string) return sa_utils.lcp_scan(self.lcp, self.meta_index.suffix_array, search_string, sa_i) if sa_i >= 0 else []