* Replace the match of a `pattern` in `input` with `rewrite`. * * ```js * const result = tf.string.staticRegexReplace( * ['format this spacing better'], ' +', ' '); * result.print(); // ['format this spacing better'] * ``` * @param input: A Tensor of type string. The text to
( input: Tensor | TensorLike, pattern: string, rewrite: string, replaceGlobal=true)
| 43 | * @doc {heading: 'Operations', subheading: 'String'} |
| 44 | */ |
| 45 | function staticRegexReplace_( |
| 46 | input: Tensor | TensorLike, pattern: string, rewrite: string, |
| 47 | replaceGlobal=true): Tensor { |
| 48 | |
| 49 | const $input = convertToTensor(input, 'input', 'staticRegexReplace', |
| 50 | 'string'); |
| 51 | const attrs: StaticRegexReplaceAttrs = {pattern, rewrite, replaceGlobal}; |
| 52 | return ENGINE.runKernel(StaticRegexReplace, {x: $input}, |
| 53 | attrs as unknown as NamedAttrMap); |
| 54 | } |
| 55 | |
| 56 | export const staticRegexReplace = /* @__PURE__ */ op({staticRegexReplace_}); |
nothing calls this directly
no test coverage detected
searching dependent graphs…