code: def test_aligned_tags():
      pred_words = [
          "Apply",
          "some",
          "sunscreen",
          "unless",
          "you",
          "can",
          "not",
      ]
      gold_words = [
          "Apply",
          "some",
          "sun",
          "screen",
          "unless",
          "you",
          "cannot",
      ]
      gold_tags = [
          "VERB",
          "DET",
          "NOUN",
          "NOUN",
          "SCONJ",
          "PRON",
          "VERB",
      ]
      annots = {"words": gold_words, "tags": gold_tags}
      vocab = Vocab()
      predicted = Doc(vocab, words=pred_words)
      example1 = Example.from_dict(predicted, annots)
      aligned_tags1 = example1.get_aligned("TAG", as_string=True)
      assert aligned_tags1 == [
          "VERB",
          "DET",
          "NOUN",
          "SCONJ",
          "PRON",
          "VERB",
          "VERB",
      ]
      # ensure that to_dict works correctly
      example2 = Example.from_dict(predicted, example1.to_dict())
      aligned_tags2 = example2.get_aligned("TAG", as_string=True)
      assert aligned_tags2 == [
          "VERB",
          "DET",
          "NOUN",
          "SCONJ",
          "PRON",
          "VERB",
          "VERB",
      ]
  
imports: import pytest
  from spacy.tokens import Doc
  from spacy.training.example import Example
  from spacy.util import to_ternary_int
  from spacy.vocab import Vocab
label_desc: Use image node_id 5 for calling a global function with example usage: test_aligned_tags() without return types