parameters: (tensor, mapping, default_value=-1, name=None)
return_statement: return table.lookup(tensor)
docstring: Maps `tensor` of strings into `int64` indices based on `mapping`.
  
    This operation converts `tensor` of strings into `int64` indices.
    The mapping is initialized from a string `mapping` tensor where each element
    is a key and corresponding index within the tensor is the value.
  
    Any entry in the input which does not have a corresponding entry in 'mapping'
    (an out-of-vocabulary entry) is assigned the `default_value`
  
    Elements in `mapping` cannot be duplicated, otherwise the initialization
    will throw a FailedPreconditionError.
  
    The underlying table must be initialized by calling
    `tf.tables_initializer.run()` once.
  
    For example:
  
    ```python
    mapping_strings = tf.constant(["emerson", "lake", "palmer"])
    feats = tf.constant(["emerson", "lake", "and", "palmer"])
    ids = tf.contrib.lookup.string_to_index(
        feats, mapping=mapping_strings, default_value=-1)
    ...
    tf.tables_initializer().run()
  
    ids.eval()  ==> [0, 1, -1, 2]
    ```
  
    Args:
      tensor: A 1-D input `Tensor` with the strings to map to indices.
      mapping: A 1-D string `Tensor` that specifies the mapping of strings to
        indices.
      default_value: The `int64` value to use for out-of-vocabulary strings.
        Defaults to -1.
      name: A name for this op (optional).
  
    Returns:
      The mapped indices. It has the same shape and tensor type (dense or sparse)
      as `tensor`.
docstring_summary: Maps `tensor` of strings into `int64` indices based on `mapping`.
docstring_tokens: Maps tensor of strings into int64 indices based on mapping .
function: def string_to_index(tensor, mapping, default_value=-1, name=None):
    """Maps `tensor` of strings into `int64` indices based on `mapping`.
  
    This operation converts `tensor` of strings into `int64` indices.
    The mapping is initialized from a string `mapping` tensor where each element
    is a key and corresponding index within the tensor is the value.
  
    Any entry in the input which does not have a corresponding entry in 'mapping'
    (an out-of-vocabulary entry) is assigned the `default_value`
  
    Elements in `mapping` cannot be duplicated, otherwise the initialization
    will throw a FailedPreconditionError.
  
    The underlying table must be initialized by calling
    `tf.tables_initializer.run()` once.
  
    For example:
  
    ```python
    mapping_strings = tf.constant(["emerson", "lake", "palmer"])
    feats = tf.constant(["emerson", "lake", "and", "palmer"])
    ids = tf.contrib.lookup.string_to_index(
        feats, mapping=mapping_strings, default_value=-1)
    ...
    tf.tables_initializer().run()
  
    ids.eval()  ==> [0, 1, -1, 2]
    ```
  
    Args:
      tensor: A 1-D input `Tensor` with the strings to map to indices.
      mapping: A 1-D string `Tensor` that specifies the mapping of strings to
        indices.
      default_value: The `int64` value to use for out-of-vocabulary strings.
        Defaults to -1.
      name: A name for this op (optional).
  
    Returns:
      The mapped indices. It has the same shape and tensor type (dense or sparse)
      as `tensor`.
    """
    table = index_table_from_tensor(
        mapping=mapping, default_value=default_value, name=name)
    return table.lookup(tensor)
function_tokens: def string_to_index ( tensor , mapping , default_value = - 1 , name = None ) : table = index_table_from_tensor ( mapping = mapping , default_value = default_value , name = name ) return table . lookup ( tensor )