Transform: String Formatter¶
-
class
gretel_client.transformers.transformers.format.
Format
(config: gretel_client.transformers.transformers.format.FormatConfig)¶ -
config_class
¶ alias of
FormatConfig
-
-
class
gretel_client.transformers.transformers.format.
FormatConfig
(labels: List[str] = None, minimum_score: Optional[float] = None, pattern: Union[str, re.Pattern] = None, replacement: str = None)¶ Modify the contents of a string by specifying a regular expression that matches sub-strings and a replacement character for any characters that match. Generally, this is useful for removing special or un-needed chars from a field or value
- Parameters
pattern – A regex string to match characters against
replacement – A string to replace each matching character / string with
Example to remove non-numerical chars:
config = FormatConfig(pattern=r"[^\d]", replacement="")