UNIVERSAL DEPENDENCIES
> loading UD module…
What Are Universal Dependencies?
Universal Dependencies (UD) is “a framework for consistent annotation of grammar (parts of speech, morphological features, and syntactic dependencies) across different human languages” (UD). Grammar categories can be labeled with the same codes for part of speech and dependency relations, allowing for computers to better process patterns and predictiability through training.
One of the most important parts of NLP is the pre-processing of the language data, otherwise the outputs you get, no matter how good your statistical methods are, will be ineffective.
The standard labeling on how words in a sentence relate to each other makes
it easier to compare different languages and to train Natural Language Processing (NLP) systems
for parsing, tagging, and understanding text.
Why Universal Dependencies Matter
- Cross-linguistic comparability: UD uses a shared inventory of tags and relations, so the same kinds of structures are labeled consistently across different languages.
- Stable grammatical categories: The core parts-of-speech and dependency labels stay the same, even when languages differ in word order or morphology.
- Addresses Theories of Typology and Language Packaging: UD gives NLP systems a common input format for all languages, which is crucial for training parsers and comparing performance across languages and treebanks.
What Universal Dependencies Consist Of
1. Part-of-Speech (POS) tagging
Each word in a sentence is assigned a universal POS tag (such as NOUN, VERB, ADJ), which makes basic grammatical categories comparable across languages.
2. Morphological features
UD adds features such as Number=Sing, Tense=Past, or Person=3, which describe grammatical information associated with each token.
3. Dependency relations
Words are connected by labeled relations like nsubj (nominal subject), obj (object), amod (adjectival modifier), etc. These labels describe how words depend on each other.
4. Dependency trees
The sentence is represented as a tree, where each word has a head and possibly dependents. This tree structure encodes the overall syntactic organization of the sentence and is used by parsers.
5. UD resources and documentation
UD is maintained as a collaborative project with many annotated treebanks and detailed guidelines. The official website documents the tagset, relations, examples, and language-specific projects.
Applying UD: My Text Classification Project for Ling 370
> click to expand project notes…
How I used a UD Treebank in Python
I was able to build onto two UD Tree banks from the UD website in order to further expand the data to classify whether a sentence was written in German or Swiss-German.
Exemplified below is a tree bank tagged and parsed with UD. This was part of the Swiss-German data I used for my project.
# sent_id = s3
# text = Und drum bin i ou froh, wenn d Lüt bi mir es Oug zuedrücke.
1 Und _ CCONJ KON _ 6 advmod _ _
2 drum _ ADV PAV _ 6 obl _ _
3 bin _ AUX VAFIN _ 6 cop _ _
4 i _ PRON PPER _ 6 nsubj _ _
5 ou _ ADV ADV _ 6 advmod _ _
6 froh _ ADJ ADJD _ 0 root _ SpaceAfter=No
7 , _ PUNCT $, _ 6 punct _ _
8 wenn _ SCONJ KOUS _ 15 mark _ _
9 d _ DET ART _ 10 det _ _
10 Lüt _ NOUN NN _ 15 nsubj _ _
11 bi _ ADP APPR _ 12 case _ _
12 mir _ PRON PPER _ 15 obl _ _
13 es _ DET ART _ 14 det _ _
14 Oug _ NOUN NN _ 15 obj _ _
15 zuedrücke _ VERB VVFIN _ 6 ccomp _ SpaceAfter=No
16 . _ PUNCT $. _ 6 punct _ _
I used TF-IDF Character N-grams for configuring how the sentences are turned into numbers (vectorized). I specified the model to focus on n-grams that are 2-5 letters in length. I wanted to include 2-letter words/n-grams because they are meaningful in Swiss-German,and are not meaningful in German. I ignored n-grams that only show up once in our sentences, and I limited the sentences to having only 3000 features since it was a small data set. This was good for pattern recognition and, most likely, standard idioms!
-
Goal:
To get the model to classify the differences between Swiss-German and German sentences. -
Model:
I used Logistic Regression to build upon parsed, tokenized, POS tagged conllU files from UD.Results:
From this project, I learned the importance of pre-processing language data with all the correct UD features, and the effective outcomes possible. The model proved to be 100% accurate a predicting whether a sentence was written in Swiss-German or German. UD parsing and pos-tagging was a key factor that led to the effectiveness of the model, along with the character-n grams holding the correct weights for each language, allowing the model to correctly distingush between the two. Logistic Regression was best for this task due to the extreme difference in syntax of Swiss-German vs German.Explore Universal Dependencies (Reference)
> open external resource…
Official documentation, guidelines, and treebanks can be found at:
https://universaldependencies.org> end of UD module.