def save(self, attribute): """ Saves the suffix array for `attribute` to the corresponding files. """ array = self.arrays[attribute] array.set_basepath(self.basepath + "." + attribute) array.save()
def save(self, attribute): """ Saves the suffix array for `attribute` to the corresponding files. """ array = self.arrays[attribute] array.set_basepath(self.basepath + "." + attribute) array.save()
def load(self, attribute): """ Load an attribute from the corresponding index files. If the attribute is of the form `a1+a2` and the corresponding file does not exist, creates a new suffix array fusing the arrays for attributes `a1` and `a2`. """ if self.arrays.has_key(attribute): return self.arrays[attribute] verbose("Loading corpus files for attribute \"%s\"." % attribute) array = SuffixArray() path = self.basepath + "." + attribute array.set_basepath(path) try: array.load() except IOError, err: # If attribute is composed, fuse the corresponding suffix arrays. if '+' in attribute: attr1, attr2 = attribute.rsplit('+', 1) verbose("Fusing suffix arrays for %s and %s..." % (attr1, attr2)) array = fuse_suffix_arrays(self.load(attr1), self.load(attr2)) array.set_basepath(path) array.build_suffix_array() array.save() else: raise err
def load(self, attribute): """ Load an attribute from the corresponding index files. If the attribute is of the form `a1+a2` and the corresponding file does not exist, creates a new suffix array fusing the arrays for attributes `a1` and `a2`. """ if self.arrays.has_key(attribute): return self.arrays[attribute] verbose("Loading corpus files for attribute \"%s\"." % attribute) array = SuffixArray() path = self.basepath + "." + attribute array.set_basepath(path) try: array.load() except IOError, err: # If attribute is composed, fuse the corresponding suffix arrays. if '+' in attribute: attr1, attr2 = attribute.rsplit('+', 1) verbose("Fusing suffix arrays for %s and %s..." % (attr1, attr2)) array = fuse_suffix_arrays(self.load(attr1), self.load(attr2)) array.set_basepath(path) array.build_suffix_array() array.save() else: raise err
def load(self, attribute): if self.arrays.has_key(attribute): return self.arrays[attribute] verbose("Loading corpus files for attribute \"%s\"." % attribute) array = SuffixArray() path = self.basepath + "." + attribute array.set_basepath(path) try: array.load() except IOError, err: # If attribute is composed, fuse the corresponding suffix arrays. if '+' in attribute: attr1, attr2 = attribute.rsplit('+', 1) array = fuse_suffix_arrays(self.load(attr1), self.load(attr2)) array.set_basepath(path) array.build_suffix_array() array.save() else: raise err
def load(self, attribute): if self.arrays.has_key(attribute): return self.arrays[attribute] verbose("Loading corpus files for attribute \"%s\"." % attribute) array = SuffixArray() path = self.basepath + "." + attribute array.set_basepath(path) try: array.load() except IOError, err: # If attribute is composed, fuse the corresponding suffix arrays. if '+' in attribute: attr1, attr2 = attribute.rsplit('+', 1) array = fuse_suffix_arrays(self.load(attr1), self.load(attr2)) array.set_basepath(path) array.build_suffix_array() array.save() else: raise err
def save(self, attribute): array = self.arrays[attribute] array.set_basepath(self.basepath + "." + attribute) array.save()
def save(self, attribute): array = self.arrays[attribute] array.set_basepath(self.basepath + "." + attribute) array.save()