class_docstr: Predictor for the :class:`~allennlp.models.BiaffineDependencyParser` model.
docstr: Returns
  -------
  A JSON dictionary render-able by Hierplane for the given tree.
docstr_tok: ["Returns","--","--","--","-","A","JSON","dictionary","render-able","by","Hierplane","for","the","given","tree","."]
code: def _build_hierplane_tree(words, heads, tags, pos):
      """
      Returns
      -------
      A JSON dictionary render-able by Hierplane for the given tree.
      """
  
      word_index_to_cumulative_indices = {}
      cumulative_index = 0
      for i, word in enumerate(words):
          word_length = len(word) + 1
          word_index_to_cumulative_indices[i] = (
              cumulative_index,
              cumulative_index + word_length,
          )
          cumulative_index += word_length
  
      def node_constuctor(index):
          children = []
          for next_index, child in enumerate(heads):
              if child == index + 1:
                  children.append(node_constuctor(next_index))
  
          # These are the icons which show up in the bottom right
          # corner of the node.
          attributes = [pos[index]]
          start, end = word_index_to_cumulative_indices[index]
  
          hierplane_node = {
              "word": words[index],
              # The type of the node - all nodes with the same
              # type have a unified colour.
              "nodeType": tags[index],
              # Attributes of the node.
              "attributes": attributes,
              # The link between  the node and it's parent.
              "link": tags[index],
              "spans": [{"start": start, "end": end}],
          }
          if children:
              hierplane_node["children"] = children
          return hierplane_node
  
      # We are guaranteed that there is a single word pointing to
      # the root index, so we can find it just by searching for 0 in the list.
      root_index = heads.index(0)
      hierplane_tree = {
          "text": " ".join(words),
          "root": node_constuctor(root_index),
          "nodeTypeToStyle": NODE_TYPE_TO_STYLE,
          "linkToPosition": LINK_TO_POSITION,
      }
      return hierplane_tree
  
file_path: magnitude/pymagnitude/third_party/allennlp/predictors/biaffine_dependency_parser.py
imports: from __future__ import absolute_import
  from allennlp.common.util import JsonDict, sanitize
  from allennlp.data import DatasetReader, Instance
  from allennlp.models import Model
  from allennlp.predictors.predictor import Predictor
  from allennlp.data.tokenizers.word_splitter import SpacyWordSplitter
label_desc: Use image node_id 6 for calling the BiaffineDependencyParserPredictor obj's underlying member method code with example usage: obj._build_hierplane_tree(words, heads, tags, pos) and returns: hierplane_tree, hierplane_node