class_docstr: Reads a file in the conllu Universal Dependencies format. Additionally,
  in order to make it easy to structure a model as predicting arcs, we add a
  dummy 'ROOT_HEAD' token to the start of the sequence.
  
  Parameters
  ----------
  token_indexers : ``Dict[str, TokenIndexer]``, optional (default=``{"tokens": SingleIdTokenIndexer()}``)
      The token indexers to be applied to the words TextField.
class_docstr_tok: ["Reads","a","file","in","the","conllu","Universal","Dependencies","format",".","Additionally",",","in","order","to","make","it","easy","to","structure","a","model","as","predicting","arcs",",","we","add","a","dummy","'ROOT_HEAD","'","token","to","the","start","of","the","sequence",".","Parameters","--","--","--","--","--","token_indexers",":","``","Dict","[","str",",","TokenIndexer","]","``",",","optional","(","default=","``","{","``","tokens","''",":","SingleIdTokenIndexer","(",")","}","``",")","The","token","indexers","to","be","applied","to","the","words","TextField","."]
docstr: Parameters
  ----------
  words : ``List[str]``, required.
      The words in the sentence to be encoded.
  upos_tags : ``List[str]``, required.
      The universal dependencies POS tags for each word.
  dependencies ``List[Tuple[str, int]]``, optional (default = None)
      A list of  (head tag, head index) tuples. Indices are 1 indexed,
      meaning an index of 0 corresponds to that word being the root of
      the dependency tree.
  
  Returns
  -------
  An instance containing words, upos tags, dependency head tags and head
  indices as fields.
docstr_tok: ["Parameters","--","--","--","--","--","words",":","``","List","[","str","]","``",",","required",".","The","words","in","the","sentence","to","be","encoded",".","upos_tags",":","``","List","[","str","]","``",",","required",".","The","universal","dependencies","POS","tags","for","each","word",".","dependencies","``","List","[","Tuple","[","str",",","int","]","]","``",",","optional","(","default","=","None",")","A","list","of","(","head","tag",",","head","index",")","tuples",".","Indices","are","1","indexed",",","meaning","an","index","of","0","corresponds","to","that","word","being","the","root","of","the","dependency","tree",".","Returns","--","--","--","-","An","instance","containing","words",",","upos","tags",",","dependency","head","tags","and","head","indices","as","fields","."]
code: def text_to_instance(
      self, words, upos_tags, dependencies=None  # type: ignore
  ):
      # pylint: disable=arguments-differ
      """
      Parameters
      ----------
      words : ``List[str]``, required.
          The words in the sentence to be encoded.
      upos_tags : ``List[str]``, required.
          The universal dependencies POS tags for each word.
      dependencies ``List[Tuple[str, int]]``, optional (default = None)
          A list of  (head tag, head index) tuples. Indices are 1 indexed,
          meaning an index of 0 corresponds to that word being the root of
          the dependency tree.
  
      Returns
      -------
      An instance containing words, upos tags, dependency head tags and head
      indices as fields.
      """
      fields = {}
  
      tokens = TextField(
          [Token(w) for w in words], self._token_indexers
      )
      fields["words"] = tokens
      fields["pos_tags"] = SequenceLabelField(
          upos_tags, tokens, label_namespace="pos"
      )
      if dependencies is not None:
          # We don't want to expand the label namespace with an additional dummy token, so we'll
          # always give the 'ROOT_HEAD' token a label of 'root'.
          fields["head_tags"] = SequenceLabelField(
              [x[0] for x in dependencies],
              tokens,
              label_namespace="head_tags",
          )
          fields["head_indices"] = SequenceLabelField(
              [int(x[1]) for x in dependencies],
              tokens,
              label_namespace="head_index_tags",
          )
  
      fields["metadata"] = MetadataField(
          {"words": words, "pos": upos_tags}
      )
      return Instance(fields)
  
file_path: magnitude/pymagnitude/third_party/allennlp/data/dataset_readers/universal_dependencies.py
imports: from __future__ import with_statement
  from __future__ import absolute_import
  import logging
  from conllu.parser import parse_line, DEFAULT_FIELDS
  from allennlp.common.file_utils import cached_path
  from allennlp.data.dataset_readers.dataset_reader import DatasetReader
  from allennlp.data.fields import Field, TextField, SequenceLabelField, MetadataField
  from allennlp.data.instance import Instance
  from allennlp.data.token_indexers import SingleIdTokenIndexer, TokenIndexer
  from allennlp.data.tokenizers import Token
  from io import open
label_desc: Use image node_id 3 for calling the UniversalDependenciesDatasetReader obj's underlying member method code with example usage: obj.text_to_instance(words, upos_tags, dependencies) and returns: Instance