code: def build_word_entry(word_index, graph_word):
      word_entry = {
          ID: word_index,
          TEXT: graph_word.word if graph_word.word else None,
          LEMMA: graph_word.lemma if graph_word.lemma else None,
          UPOS: graph_word.coarseTag if graph_word.coarseTag else None,
          XPOS: graph_word.pos if graph_word.pos else None,
          FEATS: java_protobuf_requests.features_to_string(
              graph_word.conllUFeatures
          ),
          DEPS: None,
          NER: graph_word.ner if graph_word.ner else None,
          MISC: None,
          START_CHAR: None,  # TODO: fix this?  one problem is the text positions
          END_CHAR: None,  #   might change across all of the sentences
          # presumably python will complain if this conflicts
          # with one of the constants above
          "is_mwt": graph_word.isMWT,
          "is_first_mwt": graph_word.isFirstMWT,
          "mwt_text": graph_word.mwtText,
          "mwt_misc": graph_word.mwtMisc,
      }
      # TODO: do "before" as well
      word_entry[MISC] = space_after_to_misc(graph_word.after)
      if graph_word.conllUMisc:
          word_entry[
              MISC
          ] = java_protobuf_requests.substitute_space_misc(
              graph_word.conllUMisc, word_entry[MISC]
          )
      return word_entry
  
imports: import argparse
  import copy
  import os
  import re
  import sys
  from stanza.models.common.utils import misc_to_space_after, space_after_to_misc
  from stanza.protobuf import SsurgeonRequest, SsurgeonResponse
  from stanza.server import java_protobuf_requests
  from stanza.utils.conll import CoNLL
  from stanza.models.common.doc import ID, TEXT, LEMMA, UPOS, XPOS, FEATS, HEAD, DEPREL, DEPS, MISC, START_CHAR, END_CHAR, NER, Word, Token, Sentence
label_desc: Use image node_id 8 for calling a global function with example usage: build_word_entry(word_index, graph_word) and returns: word_entry