InitializeTableFromTextFile

public final class InitializeTableFromTextFile

Initializes a table from a text file.

It inserts one key-value pair into the table for each line of the file. The key and value is extracted from the whole line content, elements from the split line based on `delimiter` or the line number (starting from zero). Where to extract the key and value from a line is specified by `key_index` and `value_index`.

- A value of -1 means use the line number(starting from zero), expects `int64`. - A value of -2 means use the whole line content, expects `string`. - A value >= 0 means use the index (starting at zero) of the split line based on `delimiter`.

Nested Classes

class InitializeTableFromTextFile.Options Optional attributes for InitializeTableFromTextFile

Public Methods

static InitializeTableFromTextFile
create ( Scope scope, Operand <?> tableHandle, Operand <String> filename, Long keyIndex, Long valueIndex, Options... options)
Factory method to create a class wrapping a new InitializeTableFromTextFile operation.
static InitializeTableFromTextFile.Options
delimiter (String delimiter)
static InitializeTableFromTextFile.Options
offset (Long offset)
static InitializeTableFromTextFile.Options
vocabSize (Long vocabSize)

Inherited Methods

Public Methods

public static InitializeTableFromTextFile create ( Scope scope, Operand <?> tableHandle, Operand <String> filename, Long keyIndex, Long valueIndex, Options... options)

Factory method to create a class wrapping a new InitializeTableFromTextFile operation.

Parameters
scope current scope
tableHandle Handle to a table which will be initialized.
filename Filename of a vocabulary text file.
keyIndex Column index in a line to get the table `key` values from.
valueIndex Column index that represents information of a line to get the table `value` values from.
options carries optional attributes values
Returns
  • a new instance of InitializeTableFromTextFile

public static InitializeTableFromTextFile.Options delimiter (String delimiter)

Parameters
delimiter Delimiter to separate fields in a line.

public static InitializeTableFromTextFile.Options offset (Long offset)

public static InitializeTableFromTextFile.Options vocabSize (Long vocabSize)

Parameters
vocabSize Number of elements of the file, use -1 if unknown.