code: def get_phrases(filename):
      tree = ET.parse(filename)
      fragments = []
  
      root = tree.getroot()
      body = None
      for child in root:
          if child.tag == "{http:///uima/cas.ecore}Sofa":
              body = child.attrib["sofaString"]
          elif (
              child.tag
              == "{http:///de/aitools/ie/uima/type/arguana.ecore}Fact"
          ):
              fragments.append(
                  ArguanaSentimentDatum(
                      begin=int(child.attrib["begin"]),
                      end=int(child.attrib["end"]),
                      rating="1",
                  )
              )
          elif (
              child.tag
              == "{http:///de/aitools/ie/uima/type/arguana.ecore}Opinion"
          ):
              if child.attrib["polarity"] == "negative":
                  rating = "0"
              elif child.attrib["polarity"] == "positive":
                  rating = "2"
              else:
                  raise ValueError(
                      "Unexpected polarity found in {}".format(filename)
                  )
              fragments.append(
                  ArguanaSentimentDatum(
                      begin=int(child.attrib["begin"]),
                      end=int(child.attrib["end"]),
                      rating=rating,
                  )
              )
  
      phrases = [
          SentimentDatum(
              fragment.rating, body[fragment.begin : fragment.end]
          )
          for fragment in fragments
      ]
      # phrases = [phrase.replace("\n", " ") for phrase in phrases]
      return phrases
  
file_path: stanza/stanza/utils/datasets/sentiment/process_arguana_xml.py
imports: from collections import namedtuple
  import glob
  import os
  import sys
  import xml.etree.ElementTree
  from stanza.models.classifiers.data import SentimentDatum
  import stanza.utils.datasets.sentiment.process_utils
label_desc: Use image node_id 1 for calling a global function with example usage: get_phrases(filename) and returns: phrases