MCPcopy Create free account
hub / github.com/tensorflow/tfjs / staticRegexReplace_

Function staticRegexReplace_

tfjs-core/src/ops/string/static_regex_replace.ts:45–54  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

43 * @doc {heading: 'Operations', subheading: 'String'}
44 */
45function 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
56export const staticRegexReplace = /* @__PURE__ */ op({staticRegexReplace_});

Callers

nothing calls this directly

Calls 2

convertToTensorFunction · 0.90
runKernelMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…