Ltarlin1/Final Project

From LING073
Revision as of 06:51, 5 May 2017 by Ltarlin1 (talk | contribs)

Jump to: navigation, search

The Problem

For my final project, I decided to create an autoglosser that would automatically convert the universal dependency files we worked with in class into visual form in Latex. There is a Latex package called tikz-dependency that allows for quick input of sentences and its corresponding dependencies, but it still requires the user to manually select each dependency. Therefore, my code automatically generates Latex code that fits the expected format for the tikz-dependency package and therefore can easily be displayed in a graph, as in the following example image:

Dependency tree of "Everyone in this class works on a different language.


Previous Work

As discussed in the above section, the tikz-dependency package uses the tikz interface to facilitate the graph-making process. The syntax of a dependency in this format is strikingly similar to that which we saw in class (i.e. #4->6) because both refer to the "from word" and the "to word" using offset from the beginning of the sentence.

Theoretically, I would be able to also convert input files in the conllu format (as well as the CG format we worked with in class) to appropriate Latex code, but I do not fully understand this format yet. I will continue to learn about the conllu format and hopefully have it up and running in a few days.

Users

This tool would be useful for linguists who want to speed up the visual-making process when working with universal dependencies. It does not have much of an application outside the technical linguistics domain because generating the input files to my program requires knowledge of universal dependencies.

The Solution

My autoglosser parses each line of the CG file and separates it into the relevant portions--the words that make up the sentence, the other word that it depends on, and the type of dependence relationship. The other information belonging to that word, such as part of speech, are included in the parse but ignored at this point.

Therefore, a CG file like the one we looked at in class

"<The>"
	"The" det def sp @det #1->4
"<quick>"
	"quick" adj sint @amod #2->4
"<brown>"
	"brown" adj @amod #3->4
"<fox>"
	"fox" n sg @nsubj #4->5
"<jumps>"
	"jump" vblex pres p3 sg @root #5->0
"<over>"
	"over" pr @case #6->9
"<the>"
	"the" det def sp @det #7->9
"<lazy>"
	"lazy" adj sint @amod #8->9
"<dog>"
	"dog" n sg @obl #9->5
"<in>"
	"in" pr @case #10->13
"<the>"
	"the" det def sp @det #11->13
"<green>"
	"green" adj sint @amod #12->13
"<fields>"
	"field" n pl @obl #13->5
"<.>"
	"." sent

is turned into something like this:

words = ['The', 'quick', 'brown', 'fox', 'jumps', 'over', 'the', 'lazy', 'dog', 'in', 'the', 'green', 'fields', '.']

info = [
['"The"', 'det', 'def', 'sp', '@det', '#1->4'], 
['"quick"', 'adj', 'sint', '@amod', '#2->4'], 
['"brown"', 'adj', '@amod', '#3->4'], 
['"fox"', 'n', 'sg', '@nsubj', '#4->5'], 
['"jump"', 'vblex', 'pres', 'p3', 'sg', '@root', '#5->0'], 
['"over"', 'pr', '@case', '#6->9'], 
['"the"', 'det', 'def', 'sp', '@det', '#7->9'], 
['"lazy"', 'adj', 'sint', '@amod', '#8->9'], 
['"dog"', 'n', 'sg', '@obl', '#9->5'], 
['"in"', 'pr', '@case', '#10->13'], 
['"the"', 'det', 'def', 'sp', '@det', '#11->13'], 
['"green"', 'adj', 'sint', '@amod', '#12->13'], 
['"field"', 'n', 'pl', '@obl', '#13->5'], 
['"."', 'sent']]

more stuff here

Evaluation

it works, i promise