tft.sanitized_vocab_filename

tft.sanitized_vocab_filename(
    filename=None,
    prefix=None
)

Generates a sanitized filename either from the given filename or the scope.

If filename is specified, provide a sanitized version of the given filename. Otherwise generate a filename from the current scope. Note that it is the callers responsibility to ensure that filenames are unique across calls within a given preprocessing function.

Args:

  • filename: A filename with non-alpha characters replaced with underscores and spaces to hyphens.
  • prefix: Prefix to use for the name of the vocab file, if filename is not given.

Returns:

A valid filename.

Raises:

  • ValueError: If neither filename and prefix are specified, or if both are specified.