German POS Tag Visualization Demo¶

This notebook demonstrates how to visualize German POS tags using BRAT-style annotations, with a focus on noun phrases and their components.

In [1]:
import warnings
import torch.serialization

# Suppress specific warnings
warnings.filterwarnings('ignore', category=FutureWarning, module='thinc.shims.pytorch')
warnings.filterwarnings('ignore', message='.*torch.cuda.amp.autocast.*')
In [2]:
import spacy
from brat_style import render_brat_style

# Load the German transformer model
dt = spacy.load("de_dep_news_trf")

# Example German text
text = "Der schnelle braune Fuchs springt über den faulen Hund."
render_brat_style(text, dt)
Der schnelle braune Fuchs springt über den faulen Hund .

Color Scheme¶

Noun Phrase Components (blue spectrum):

  • Nouns: Dark blue (#7fa2ff)
  • Adjectives: Light blue (#a7c7ff)
  • Attributive Pronouns: Similar to adjectives (#b2d0ff)
  • Articles: Very light blue (#c6d9ff)

Other Elements:

  • Substituting Pronouns: Light orange (#ffe4b5)
  • Verbs: Green (#8fb271)
  • Other: Light gray (#e8e8e8)
In [3]:
# Example with pronouns (both attributive and substituting)
text2 = "Meine Katze fängt eine Maus, die unter dem Tisch sitzt."
render_brat_style(text2, dt)
Meine Katze fängt eine Maus , die unter dem Tisch sitzt .
In [4]:
# Example with more complex pronoun usage
text3 = "Dieser Text zeigt, wie man verschiedene Pronomen verwendet."
render_brat_style(text3, dt)
Dieser Text zeigt , wie man verschiedene Pronomen verwendet .
In [ ]: