algorithms.strings

Source code: algorithms/strings.seq

algorithms.strings.filter_overlaps(v: Generator[int], n: int)
algorithms.strings.rfilter_overlaps(v: Generator[int], n: int)
algorithms.strings.string_search_slow(text: str, pattern: str)

Return a list containing the non-overlapping position of each index the pattern is found.

algorithms.strings.rstring_search_slow(text: str, pattern: str)

Return a list containing the non-overlapping position of each index the pattern is found from right to left.

algorithms.strings.string_search_rabin_karp(text: str, pattern: str, prime: int = 645419)

Return a list containing the position of each index the pattern is found.

algorithms.strings.computeLPArray(pattern: str, len_pat: int)

Return a list containing the length of the maximum matching proper prefix of the pattern[0, 1, …, i]

algorithms.strings.string_search_KMP(text: str, pattern: str)

Knuth-Morris-Pratt algorithm Return a list containing the position of each index the pattern is found.

algorithms.strings.replace_interleave(self, new: str, maxcount: int)

Returns a string inserting the ‘new’ string everywhere.

algorithms.strings.replace_delete_substring(self, old: str, new: str, maxcount: int)

Returns a string deleting any instances of the ‘old’ string in self and replaceing it with the ‘new’ string.