A U niversal D ependencies Conversion Pipeline for a P enn-format Constituency Treebank (2020)

Abstract: The topic of this paper is a rule-based pipeline for converting constituency treebanks based on the Penn Treebank format to Universal Dependencies (UD). We describe an Icelandic constituency treebank, its annotation scheme and the UD scheme. The conversion is discussed, the methods used to deliver a fully automated UD corpus and complications involved. To show its applicability to corpora in different languages, we extend the pipeline and convert a Faroese constituency treebank to a UD corpus. The result is an open-source conversion tool, published under an Apache 2.0 license, applicable to a Penn-style treebank for conversion to a UD corpus, along with the two new UD corpora.

## introduction the universal dependencies (ud) project @xcite in version 2.6 consists of 163 treebanks in 92 languages and its standardized annotation scheme makes it an appealing option when creating a treebank. different methods are available to create a ud treebank, ranging from manual parsing to manual correction of automatic parsing. a ud treebank can also be automatically converted from an existing treebank, which uses a different annotation scheme, as in the present work. we describe a conversion pipeline for a constituency treebank, the icelandic parsed historical corpus (icepahc; @xcite @xcite . we also apply the pipeline to a smaller corpus, the faroese parsed historical corpus @xcite @xcite , which contains texts in another language but uses the same annotation scheme. 1 with minimal modifications to the pipeline, the conversion is unaffected by linguistic differences in the corpora, which underlines the possibility of using it for other corpora, which use the same scheme. the conversion uses nltk @xcite as a base and it is specific to the annotation scheme of icepahc, which itself is based on the penn parsed corpora of historical english (ppche; @xcite . some conversion tools are already available for converting a constituency treebank to the ud scheme, e.g. the pystanforddependencies tool 2 and the lth constituentto-dependency conversion tool for penn-style treebanks @xcite . 3 both tools convert a treebank in the penn treebank format to a dependency format. the annotation scheme of the ppche is based on the penn treebank scheme but the two are not similar enough to be used unaltered with the pre-existing software, so the conversion between the two schemes was deemed to be impractical. therefore, our conversion tool takes as input an unaltered icepahc file and delivers its ud-annotated counterpart. both icepahc and farpahc are open-source, published under a cc by 4.0 license, and we maintain that policy, publishing the conversion tool under an apache 2.0 license and the resulting ud corpora under a cc by-sa 4.0 license. the tool is reusable for corpora annotated in the same manner as the constituency treebanks and the source code is available on github. 4 the resulting corpora will be included in the next version of ud, version 2.7, to be released on november 15, 2020. the paper is structured as follows. section 2 describes icepahc and its annotation scheme and section 3 compares ppche and ud. section 4 describes the conversion itself, and its stages, i.e. how the files are prepared for the converter (4.1), how the pos tags and morphological features are mapped (4.2), and how the relational information of heads and dependency are extracted from the icepahc format (4.3). section 5 discusses the farpahc conversion, section 6 considers further use of the converter and the ud treebanks and section 7 concludes. ## the icelandic parsed historical corpus icepahc is a one-million-word, diachronic corpus, which includes texts from the 12 th to 21 st centuries @xcite . the trees in the corpus have been manually corrected according to the ppche annotation scheme, which uses labeled bracketing in the same way as the penn treebank. some minor adjustments were made to adapt the annotation scheme to icelandic grammar. the pos tagset used is based on the one particular to the ppche, with minor changes to adapt it to icelandic grammar. the manual icepahc annotation process is built on a number of automatic pre-processing steps involving available natural language processing tools for icelandic, including pos tagging and shallow parsing in icenlp @xcite , and the lemmatizer @xcite . the icepahc scheme splits sentences into matrix clauses and marks their phrases. the phrases and their tokens are marked according to the tagset, which consists of 43 tags and their function tags. 5 moreover, every token's lemma is displayed along with traces and empty phrases. figure 1 is an original example from icepahc where we show a matrix clause (ip-mat) with a subject (np-sbj), a main verb (vb) in the past tense (d), indicative mood (i), i.e. vbdi, an indirect object (np-ob2), a direct object (np-ob1) and a prepositional phrase (pp); the sentence is glossed and translated in (1). this rich annotation scheme makes the conversion to a dependency-based scheme possible. the practicality of using a historical (diachronic) corpus for conversion to a descriptive dependency corpus for icelandic hinges on the fact that icelandic has changed much less than many other european languages over the last thousand years, syntax included @xcite . this fact by itself supports the use of icepahc in the conversion. however, even though icelandic has changed less than some other languages, it has in fact gone through various syntactic changes. these include changes from ov to vo word order, the emergence of the first position expletive það 'it, there' and decreased use of certain types of empty arguments (see @xcite for an overview). ## the ppche and ud annotation schemes the ppche and ud annotation schemes reflect two different ways of parsing a sentence. while the ppche scheme denotes phrases by using brackets, the ud scheme connects each token to a single head @xcite . every sentence in ud has a root and each dependent relationship a label, but neither are marked in the ppche scheme. an obvious difference between the two schemes is how information on a sentence's annotation is displayed. figure 2 displays the dependency-based counterpart to the icepahc sentence in figure 1 . comparing the two, we see that the ppche format focuses on phrases while the ud format, which is delivered in conll-u format, lists all tokens in a sentence and gives information on them. the conll-u format consists of ten fields, or columns, as outlined below. id form lemma upos xpos feats head deprel deps misc 1 húsbaendurnir húsbóndi noun ns-n @xmath0... 2 nsubj _ @xmath1... 0 root _ @xmath2... 2 iobj _ @xmath3... 2 obj _ @xmath4... 7 case _ @xmath5... 7 amod _ @xmath6... 2 obl _ @xmath7. . punct . _ 2 punct _ . • the 1st, 2nd, and 3rd columns contain the word index (id), the word form (form), and the lemma (lemma), respectively. ## the conversion our method of converting icepahc to a ud corpus mainly consists of three steps. the first step involves text cleanup, i.e. removing information not critical to ud. next is the actual conversion, extracting information on the words and phrase structure and delivering it according to the conll-u format. lastly, various post-processing is done on the conll-u output files, in order to meet ud format standards. the converter and its resulting treebank have not been evaluated formally but numerous sentences have been checked manually while developing the converter. systematic evaluation will be carried out in future work. ## extension: converting a faroese treebank the goal of this project is not to produce a one-shot converter for a specific treebank, but a reusable tool, applicable to treebanks in a similar format. icelandic and faroese share a number of linguistic properties that make constituency grammar annotation using the same scheme possible. to demonstrate the reusability of the tool, it was adapted to the faroese parsed historical corpus (farpahc) foot_7 which uses the same annotation scheme as icepahc. it consists of three new testament translations, i.e. one from the 19 th century and two from the 20 th century, 53,000 words in total. the 19 th century text has not been included in the converted ud treebank yet. its orthography deviates in many ways from modern spelling; even though the text was modernized for farpahc, we decided that before we would add it to the converted treebank, more work on fixing inconsistencies would be needed. a few minor additions were needed for the conversion to be possible, which shows the utility of the conversion pipeline. the annotation process for farpahc is the same as that for icepahc; both of them have been manually corrected according to the ppche annotation scheme, with some changes to adapt it to icelandic and faroese grammar. the tagset used in farpahc is for the most part the same as in icepahc, which is possible because of the similarities in the languages' grammars. the main difference in the annotation scheme between the two corpora is that lemmas are not shown in farpahc. an example of a parsed sentence in farpahc is shown in figure 4 , which shows a matrix clause (ip-mat) with a direct object (np-ob1), an auxiliary verb (hvpi), a subject (np-sbj), a main verb in the past participle (vbn) and two prepositional phrases (pp); the sentence is glossed and translated in (4). since the two treebanks share an annotation scheme and a tagset, farpahc was converted using the methods described in section 4 with only three modifications. first, the script used to fix various annotation errors in icepahc was not used as it did not apply to farpahc. no such errors were encountered and such a script was therefore unnecessary. second, since farpahc does not include information on lemmas, neither does the resulting ud corpus. third, morphological features for farpahc were extracted in a different manner. the conversion from icepahc relies on an icelandic high-accuracy pos tagger for additional information on tokens but no such tagger exists for faroese. thus, no third-party software was used for feature extraction and all information was retrieved from the pos tags themselves. every component in a tag was mapped to a corresponding morphological feature using handwritten rules, which does not provide all possible features for a given token but does provide more details than solely the tag. these rules can then be built upon if the conversion pipeline is extended for another language with a similar tagset. the conversion results in a new faroese ud corpus of 40,000 words to be included in the next ud release. figure 5 shows the sentence from figure 4 after having been converted to conll-u. as mentioned, lemmas are not shown, with the exception of the punctuation mark, fewer morphological features are shown and no additional tags are shown in the misc column. in other respects, all grammatical information represented in the converted icelandic ud corpus is also represented in the faroese one. id form lemma upos xpos feats head deprel deps misc 1 hetta _ det d-a @xmath8... 4 obl _ @xmath9. . punct . _ 4 punct _ _ figure 5: a sentence converted to ud from farpahc. ## future development and use icepahc currently consists of about one million words but 75,000 additional words were annotated in this project by kristján rúnarsson in accordance with the icepahc scheme @xcite . this is done to increase the weight of modern icelandic in the corpus. these additions, which contain genres not found previously in icepahc -parliamentary speeches and sports news texts taken from the icelandic gigaword corpus @xcite -will be converted to the ud scheme using the conversion tool described in this paper, making for a close to 1.1 million word corpus. not only does this enlarge the corpus, but also increases the ratio of modern texts in it. a possible improvement to the faroese ud treebank is adding information on lemmas. since farpahc does not include lemmas, a faroese lemmatizer would have to be used. a few lemmatizers are available for this task @xcite @xcite , which would have to be evaluated further in regards to their feasibility. compatibility between the current project and the icepahc and farpahc corpora means that various possibilities exist for future interlinking of projects that make use of the two resources. firstly, by using the conversion tool for both an icelandic and a faroese treebank, we have shown that cross-lingual use is possible. secondly, with the possibility of user customization, e.g. specifying language-specific rules and parameters, the converter may be applied -with necessary modifications -to various other constituency treebanks to produce new ud corpora for a wide range of languages. these include corpora of historical greek @xcite , historical portuguese @xcite and middle low german @xcite , in addition to ppche. finally, the conversion tool can also be used to convert output from automatic parsers which use the icepahc annotation scheme, e.g. iceneuralparsingpipeline @xcite , to ud format. since the original corpus would be automatically created, the ud format output would have to be manually corrected before adding it to the icelandic ud corpus. ## conclusion in this paper, we have described a rule-based conversion pipeline applicable to the icelandic parsed historical corpus and the faroese parsed historical corpus, which results in corpora annotated according to universal dependencies. the pipeline is used for converting the two treebanks, delivering a 1 million word icelandic ud corpus and a 40,000 word faroese ud corpus. the icelandic corpus will consequently be among the largest of its type. we have discussed the benefits of a ud-based corpus for icelandic and faroese and why icepahc is a good candidate for building the conversion on. the process of converting sentences was described and the methodology behind it, extracting information needed for a ud corpus by using both information included in the icepahc annotation scheme and a state-of-the-art pos tagger for icelandic. we also discussed some challenges faced because of the different annotation scheme of the original treebank and ud and how these were dealt with. we demonstrated the conversion pipeline's applicability to different languages by converting a faroese constituency treebank to a ud corpus using the pipeline. lastly, we discussed further possibilities in using the converter and the ud corpora with available language resources along with the 75,000 word addition to icepahc, which will be converted using the pipeline and added to the icelandic ud corpus. the benefits of an icelandic universal dependencies corpus are significant, as the ud annotation scheme offers a standard parsing framework across different languages. the information that is annotated in icepahc is a superset of what is required by the ud scheme and this makes conversion between the two formats a feasible approach to creating a ud treebank for icelandic. furthermore, the open-source policy of icepahc as well as the global ud project is important and therefore maintained in this project. the conversion tool is released under an apache 2.0 license on github foot_8 and the two ud corpora are included in the next release of ud under a cc by-sa 4.0 license.