Towards a S wahili U niversal D ependency Treebank: Leveraging the Annotations of the H elsinki Corpus of S wahili (2023)

Abstract: Dependency annotation can be a laborious process for under-resourced languages. However, in some cases, other resources are available. We investigate whether we can leverage such resources in the case of Swahili: We use the Helsinki Corpus of Swahili for creating a Universal Depedencies treebank for Swahili. The Helsinki Corpus of Swahili provides word-level annotations for part of speech tags, morphological features, and functional syntactic tags. We train neural taggers for these types of annotations, then use those models to annotate our target corpus, the Swahili portion of the OPUS Global Voices Corpus. Based on those annotations, we then manually create constraint grammar rules to annotate the target corpus for Universal Dependencies. In this paper, we describe the process, discuss the annotation decisions we had to make, and we evaluate the approach.

## introduction swahili is the most-widely spoken bantu language with an estimated 16 million native speakers @xcite and 50-100 million l2 speakers. swahili serves as a national language of tanzania, kenya, uganda, and the drc, is a working language of the african union, and serves as lingua franca for the east african community. while not a typical under-resourced language in general, there are no syntactic treebanks available for swahili. since dependency annotation is a costly endeavor and requires experts in the syntactic framework as well as in the language, we investigate whether we can leverage existing resources to automate the creation of a treebank as much as possible. we investigate an approach where we use the helsinki corpus of swahili @xcite and its annotations as a starting point. we then create automatic taggers for the word-level annotation based on this corpus. after applying these taggers to our target corpus, the swahili section of the global voices corpus @xcite , we use a rule-based approach to convert the word-level annotation to universal dependency (ud) annotations @xcite . the word-level annotations available in the helsinki corpus of swahili consist of part of speech (pos) tags, based on a pos tagset that has more fine grained information than the universal dependency part of speech tagset. additionally, the corpus contains morphological features and functional syntactic tags, which are based on a constraint grammar framework. in the process of converting the morphological and syntactic information into the universal dependency framework, we encountered challenges based on the fact that little work has been done on ud annotations for bantu languages. we will discuss some of these cases along with the annotation decisions we have made. the treebank, all rules and code are available at https://git.steimel. info/ksteimel/swh_udt . the treebank will be included in the next release of ud. the remainder of this paper is structured as follows: section 2 reports on related work, section 3 gives an overview of the system used for converting the annotations, and section 4 describes the corpora we use. in section 5, we describe the wordlevel annotations, and in section 6, we describe the rules for the dependency annotation. section 7 looks into the quality of our annotations, and section 8 concludes. ## related work: nlp approaches for swahili political and economic significance promote research on swahili making it one of the more well-studied bantu languages in natural language processing. rule-based systems, data driven approaches, and unsupervised methods have been adopted for swahili. @xcite presents the first research into morphological analysis of swahili. the swatwol morphological analyzer uses a finite-state two level morphology @xcite ) to tag words. a constraint grammar system is used to disambiguate when multiple analyses are provided by the finite statesystem @xcite . these components are combined together into the swahili language manager (salama) @xcite . the salama system is extended to include a shallow constraint grammar parser and a deeper grammarbased dependency parser. though the dependency parser in salama would appear invaluable to the present work, the parser is not freely available and the dependency structure is not provided as part of the helsinki corpus of swahili @xcite . @xcite develop a similar finite state morphological analyzer for swahili. however, their approach involves using an online crowd-sourced dictionary (kamusi.org) to ensure wide lexical coverage. using corpora developed by rule-based methods, de @xcite adopt a data driven approach instead. they train part of speech taggers on the helsinki corpus of swahili @xcite , which was built using the salama language manager system described above. they use a variety of different off the shelf taggers including a hidden markov model (tnt), svms (svmtool), memory-based taggers (mbt) and a maximum entropy model tagger (mxpost). the best performance is achieved with the maximum entropy model, though all models reach an accuracy of more than 90%. the maximum entropy model does particularly well with out-ofvocabulary words. swahili has also been the focus of research on unsupervised morpheme discovery. @xcite use a string-edit-distance (sed) heuristic to learn the morphology of swahili. this heuristic goes through all pairs of words in a corpus and creates an alignment between the pairs using edit distance with specific penalties for substitution, addition and deletion. then, finite-state automata describing pairs of related strings are collapsed together with aligned sequences of characters mapping onto the same state. this process iterates; the finite state automata produced combine with other automata. in the end, the places where the fsa diverges are morpheme boundaries. the authors report high performance when compared to other unsupervised morpheme discovery heuristics such helsinki corpus of swahili global voices corpus word-level neural taggers word-level tagged gvc tag clean up rules dependency creation rules cleaned word-level gvc automatic dependency annotations sampled word-level gvc manual dependency annotations figure 1: diagram of the steps involved in creating the universal dependency treebank for swahili. recently, researchers have developed corpora for question answering and emotion classification in swahili @xcite . in addition, a transformer model for swahili has been developed @xcite . ## system overview since no dependency treebank is available, we create the dependency trees automatically, using the annotations in the helsinki corpus of swahili. this corpus contains syntactic information in the form of word-level constraint grammar labels, which need to be converted into universal dependency annotations. for this conversion, we use a number of neural tagging models, post-processing rules, and dependency arc creation rules. the smaller higher-quality, manually annotated, portion of the treebank undergoes a similar series of steps but before dependency creation rules are applied, a portion of the treebank is sampled. this sample is then manually annotated. figure 1 displays the different steps and resources involved in the process. word gloss pos syntax lemma msd afisa officer n @subj afisa 9/6-sg elimu education n @<p elimu 9/10-sg alisimama stand v @fmainvintr simama sub-@xmath0: tags for a single sentence in the hcs. id word lemma ud pos hcs pos morph. features 1 afisa afisa noun n @xmath1 ## corpora the corpus situation for swahili is somewhat difficult. we use both the helsinki corpus of swahili (hcs) @xcite and the swahili section of the global voices corpus (gvc) (tiedemann, 2012) in this work. because of licensing limitations, we are unable to annotate the helsinki corpus of swahili with dependencies and redistribute it. for this reason, we leverage the wordlevel annotations of this corpus to create a pos tagger using the helsinki corpus of swahili pos tagset, a pos tagger for ud pos tags, a morphological analyzer, and a word-level constraintgrammar syntactic tagger. we then use these taggers to annotate the swahili portion of the global voices corpus on the word level. in a final step, we create universal dependency annotations based on all of these annotations via a rule-based approach. the texts contained in the helsinki corpus of swahili are primarily from legislative assemblies, a collection of stories, and news articles. in terms of annotations, the helsinki corpus of swahili is a silver standard corpus created by the salama finite state transducer and disambigua-tor @xcite . in the corpus, each word is annotated with its lemma, pos tag, a series of morphological tags, and a functional syntactic tag (constraint grammar) describing the word's role in the sentence are included for each word. ## creating word-level annotations our ultimate goal is the creation of a universal dependency treebank for swahili. as a first step, we need to annotate the global voices corpus (gvc) for word-level information, based on which we can then apply the rules that will construct the dependency annotations. we trained word-level neural tagging models using a sample of 789 691 words, corresponding to 35 925 sentences, from the helsinki corpus of swahili (hcs). a common neural architecture was used for the following word-level tagging models: ud pos tags, language specific pos tags from the hcs, morphological features, and functional syntactic tags. this architecture consists of a two layer bidirectional gru-lstm using learned character and word embeddings. because of the large number of morphological tags, we developed a second architecture that models individual morphological features as single tags. this model is very similar in design to the other neural tagging architecture. however, instead of using argmax to predict a single tag, this model predicts all tags that exceed a threshold (0.5) after a sigmoid activation. we then automatically tagged the global voices corpus (gvc) with these neural models. from the automatically tagged gvc data, 150 short sen-tences (length 8-30 words) and 30 longer sentences (length 20-50 words) were randomly sampled for manual annotation. then, the rule system was applied to the remainder of the gvc to create the ud annotations. integrating swahili into the universal dependency framework required us to make annotation decisions regarding tokenization, conversion of part of speech tags, handling of particular constructions in swahili. we detail these decisions below. tokenization when tokenizing, we took special consideration to ensure that demonyms with hyphens were not separated, but compounds were split apart. demonyms such as those shown in following ud guidelines, compounds of coordinating conjunctions and pronouns are separated into their component tokens. for example, naye is separated into na yeye (eng.: and he/she) and nasi is separate into na sisi (eng: and you all). converting pos tags to ud the pos tags for the helsinki corpus of swahili are relatively close to universal dependency pos tags. in general, the conversion is a many-to-one mapping: the helsinki corpus tags annotate a number of distinctions that are not featured in universal dependencies. additionally, all pos tags reserved for punctuation in the helsinki corpus of swahili tagset (i.e., colon, hyphen, etc.) are mapped to punct. in some cases, additional information was required to determine the appropriate universal dependency tag. for example, in hcs, exclam is typically used for interjections such as jamani (eng.: hey there). however, it is also used for exclamation marks. for those cases, we assign punct. both relative pronouns and verbs with relative markers received the helsinki pos tags rel-li or rel-li-vyo. in such cases, we use the functional syntactic tag assigned to the word for disambiguation: if the word has a verbal functional tag, then we assign the ud tag v. in all other cases, we assign pron. morphological features unlike the conversion of pos tags, which is a relatively straightforward process, morphological tag extraction is considerably more complex. morphological features in universal dependency consist of attribute-value pairs. these are represented in the conll-u format with attributes separated from their associated values by '=' and each pair is separated by '|'. the universal dependency annotation guidelines @xcite provide morphological features to accommodate noun classes in bantu languages. these features are indicated using different values for the nounclass attribute. however, these features are not sufficient since verbs can have multiple noun class markers indicating the noun class of the subject, object, and relative head. for example, the word aliyoitumia has markers indicating noun class, person, and number for the subject, object, and relative head, see the analysis in example (1). to address this issue, we use layered morphological features. for person, number, and nounclass, additional subtypes such as rel, subj, and obj are added. until recently, this was not a documented possibility in universal dependencies, however other treebanks have established these layered features as a precedent. one example is the basque universal dependency treebank @xcite . though subtypes are not described in the documentation of the conversion process @xcite , this treebank includes verbs with multiple number features using subtypes to indicate the type. unlike the basque universal dependency treebank, we do not use subtypes with the case of the agreeing element indicated for swahili. rather, the subtypes simply specify the function of the agreeing element. for example, where the basque corpus uses number[nom], the swahili corpus uses number @xcite . the basque option is not usable for swahili as swahili does not have overt case, and adopting a covert case analysis for all languages like swahili does not follow the principles of universal dependency. ## conclusion our work is concerned with creating a universal dependency treebank for swahili leveraging the annotations in the helsinki corpus of swahili. we show that we can train neural taggers to annotate ud pos tags, language specific pos tags, morphological tags, as well as functional syntactic tags, and that we can use those annotations on a new corpus to create regular expression rules to derive a dependency annotation. the results are not perfect: for about 30% of the sentences, our methods do not create fully connected trees. but our annotations can be improved in the future. it is, of course, possible to add more rules to our framework to cover more cases. however, any new rule will be very specific and will thus only improve a very small number of cases. we consequently argue that additional improvement should come from training a robust parser and manually correcting the parse trees. we are planning to investigate robust parsing methods that will provide reliable parses when trained on the available annotations.