Remove all the punctuations by replacing with `space`. Args: text (str): The text to be processed. Example:: "This is. example !" -> "This is example "
(self, text)
| 59 | self.puncs_regular_exp = re.compile(rf"(\s*[{re.escape(self._puncs)}]+\s*)+") |
| 60 | |
| 61 | def strip(self, text): |
| 62 | """Remove all the punctuations by replacing with `space`. |
| 63 | |
| 64 | Args: |
| 65 | text (str): The text to be processed. |
| 66 | |
| 67 | Example:: |
| 68 | |
| 69 | "This is. example !" -> "This is example " |
| 70 | """ |
| 71 | return re.sub(self.puncs_regular_exp, " ", text).rstrip().lstrip() |
| 72 | |
| 73 | def strip_to_restore(self, text): |
| 74 | """Remove punctuations from text to restore them later. |
no outgoing calls