mindspore.dataset.text.RegexReplace
- class mindspore.dataset.text.RegexReplace(pattern, replace, replace_all=True)[source]
Replace a part of UTF-8 string tensor with given text according to regular expressions.
See https://unicode-org.github.io/icu/userguide/strings/regexp.html for supported regex pattern.
Note
RegexReplace is not supported on Windows platform yet.
- Parameters
- Raises
- Supported Platforms:
CPU
Examples
>>> pattern = 'Canada' >>> replace = 'China' >>> replace_op = text.RegexReplace(pattern, replace) >>> text_file_dataset = text_file_dataset.map(operations=replace_op)