code: def create_token(token, attributes, vocabs):
      """Map for a token a selected subset of attributes to indices.
  
      Input example: CoNLL 09 representation for a token.
        ['Ms.', 'ms.', 'ms.', 'NNP', '_', '2', 'TITLE]
      Output example: Indices as defined in self._attributes, e.g., [word form,
        part-of-speech tag, and head].
        [1025, 3, 1]
  
      Args:
        token: CoNLL token attributes.
        attributes: selected attributes.
        vocabs: dictionary of vocabs.
  
      Returns:
        List of attribute ids for a token, e.g. [1025, 3] with word id and pos id.
  
      Raises:
        ValueError: CoNLL attribute requested but not covered by mapping.
      """
      selected_attributes = []
      for attribute in attributes:
          index = attribute.value
          if attribute == CoNLLAttributes.FORM:
              selected_attributes.append(
                  vocabs["forms"].get(token[index], UNKNOWN_ID)
              )
          elif attribute == CoNLLAttributes.XPOS:
              selected_attributes.append(
                  vocabs["xpos"].get(token[index], UNKNOWN_ID)
              )
          elif attribute == CoNLLAttributes.HEAD:
              selected_attributes.append(int(token[index]))
          else:
              raise ValueError(
                  "CoNLL index %s not covered by mapping."
                  % str(attribute.name)
              )
      return selected_attributes
  
file_path: flax/examples/nlp_seq/input_pipeline.py
imports: import codecs
  import collections
  import enum
  import tensorflow
label_desc: Use image node_id 2 for calling a global function with example usage: create_token(token, attributes, vocabs) and returns: selected_attributes