code: def get_sentences_html(
      doc: stanza.Document, language: str, visualize_xpos: bool = False
  ) -> List[str]:
      """
      Returns a list of HTML strings representing the dependency visualizations of a given stanza document.
      One HTML string is generated per sentence of the document object. Converts the stanza document object
      to a spaCy doc object and generates HTML with displaCy.
  
      @param doc: a stanza document object which can be generated with an NLP pipeline.
      @param language: the two letter language code for the document e.g. "en" for English.
      @param visualize_xpos: A toggled option to use xpos tags for part-of-speech labels instead of upos.
  
      @return: a list of HTML strings which visualize the dependencies of the doc object.
      """
      USE_FINE_GRAINED = False if not visualize_xpos else True
      html_strings, sentences_to_visualize = [], []
      nlp = spacy.blank(
          "en"
      )  # blank model - we don't use any of the model features, just the visualization
      for sentence in doc.sentences:
          words, lemmas, heads, deps, tags = [], [], [], [], []
          if is_right_to_left(
              language
          ):  # order of words displayed is reversed, dependency arcs remain intact
              sentence_len = len(sentence.words)
              for word in reversed(sentence.words):
                  words.append(word.text)
                  lemmas.append(word.lemma)
                  deps.append(word.deprel)
                  if visualize_xpos and word.xpos:
                      tags.append(word.xpos)
                  else:
                      tags.append(word.upos)
                  if (
                      word.head == 0
                  ):  # spaCy head indexes are one-off from Stanza's
                      heads.append(sentence_len - word.id)
                  else:
                      heads.append(sentence_len - word.head)
          else:  # left to right rendering
              for word in sentence.words:
                  words.append(word.text)
                  lemmas.append(word.lemma)
                  deps.append(word.deprel)
                  if visualize_xpos and word.xpos:
                      tags.append(word.xpos)
                  else:
                      tags.append(word.upos)
                  if word.head == 0:
                      heads.append(word.id - 1)
                  else:
                      heads.append(word.head - 1)
          if USE_FINE_GRAINED:
              stanza_to_spacy_doc = Doc(
                  nlp.vocab,
                  words=words,
                  lemmas=lemmas,
                  heads=heads,
                  deps=deps,
                  tags=tags,
              )
          else:
              stanza_to_spacy_doc = Doc(
                  nlp.vocab,
                  words=words,
                  lemmas=lemmas,
                  heads=heads,
                  deps=deps,
                  pos=tags,
              )
          sentences_to_visualize.append(stanza_to_spacy_doc)
  
      for (
          line
      ) in (
          sentences_to_visualize
      ):  # render all sentences through displaCy
          html_strings.append(
              displacy.render(
                  line,
                  style="dep",
                  options={
                      "compact": True,
                      "word_spacing": 30,
                      "distance": 100,
                      "arrow_spacing": 20,
                      "fine_grained": USE_FINE_GRAINED,
                  },
                  jupyter=False,
              )
          )
      return html_strings
  
imports: import os
  import argparse
  import stanza
  import sys
  from stanza.server.semgrex import Semgrex
  from stanza.models.common.constant import is_right_to_left
  import spacy
  from spacy import displacy
  from spacy.tokens import Doc
  from IPython.display import display, HTML
  import typing
  from typing import List, Tuple, Any
  from utils import find_nth, round_base
label_desc: Use image node_id 1 for calling a global function with example usage: get_sentences_html(doc, language, visualize_xpos) and returns: html_strings