Adds a suffix to the suffix tree. Args: suffix (str): The suffix to add. index (int): The starting index of the suffix in the original text.
(self, suffix: str, index: int)
| 32 | self._add_suffix(suffix, i) |
| 33 | |
| 34 | def _add_suffix(self, suffix: str, index: int) -> None: |
| 35 | """ |
| 36 | Adds a suffix to the suffix tree. |
| 37 | |
| 38 | Args: |
| 39 | suffix (str): The suffix to add. |
| 40 | index (int): The starting index of the suffix in the original text. |
| 41 | """ |
| 42 | node = self.root |
| 43 | for char in suffix: |
| 44 | if char not in node.children: |
| 45 | node.children[char] = SuffixTreeNode() |
| 46 | node = node.children[char] |
| 47 | node.is_end_of_string = True |
| 48 | node.start = index |
| 49 | node.end = index + len(suffix) - 1 |
| 50 | |
| 51 | def search(self, pattern: str) -> bool: |
| 52 | """ |
no test coverage detected