Generating Varied Training Corpora in R unyankore Using a Combined Semantic and Syntactic, Pattern-Grammar-based Approach (2020)

Abstract: Machine learning algorithms have been applied to achieve high levels of accuracy in tasks associated with the processing of natural language. However, these algorithms require large amounts of training data in order to perform efficiently. Since most Bantu languages lack the required training corpora because they are computationally under-resourced, we investigated how to generate a large varied training corpus in Runyankore, a Bantu language indigenous to Uganda. We found the use of a combined semantic and syntactic, pattern and grammar-based approach to be applicable to this purpose, and used it to generate one million sentences, both labelled and unlabelled, which can be applied as training data for machine learning algorithms. The generated text was evaluated in two ways: (1) assessing the semantics encoded in word embeddings obtained from the generated text, which showed correct word similarity; and (2) applying the labelled data to tasks such as sentiment analysis, which achieved satisfactory levels of accuracy.

## introduction the application of machine learning algorithms to natural language processing, generation, and understanding has led to the development of highly accurate systems for information extraction, text classification, summarization, question answering, machine translation, image and video captioning @xcite , and language learning (assessment, support, and analytics) @xcite . however, large training sets are critical to achieving high levels of accuracy, and, for some applications, creating these training sets is the most time-consuming and expensive part of applying machine learning algorithms @xcite . this has resulted in the absence, to a larger extent, of machine learning applications for the very under-resourced bantu languages. a possible solution to this problem is to generate large datasets that can then be used as training data. artificially creating more training data has been applied to speech @xcite , image @xcite , and text @xcite . our interest lies in textual data, specifically, a method for how to generate a large training corpus in runyankore, a bantu language indigenous to uganda. we posed the following questions: our aim was to generate very large corpora, both labelled and unlabelled, which could be used for sentiment and morphological analysis, and to assess word similarity, respectively. we found the use of a combined semantic and syntactic, pattern and grammar-based approach sufficient to generate one million runyankore sentences , both labelled and unlabelled, from a dictionary of terms categorized into their appropriate parts of speech. we used generation patterns to handle the phrasal structure that comprised: adjectives, adverbs, conjunctions, prepositions, nouns, and verbs. a context-free grammar (cfg) was used for verb conjugation in the simple present, present continuous, near future, remote past, near past, participial present continuous, and participial near future tenses; both primary and secondary negation; as well as the applicative, causative, and passive extensions. the evaluation of the generated text showed that it was correctly semantically related, and applicable to supervised machine learning tasks. the rest of this paper is arranged as follows: section 2 provides some basics on runyankore and its complex grammatical structure; section 3 discusses the existing approaches for generating large training corpora and their applicability to runyankore; section 4 details how we generated a large runyankore corpus and evaluated its level of variation, applicability, and word similarity; and we discuss the implications of this work in section 5 and conclude in section 6. ## brief background on runyankore runyankore is a bantu language spoken in the south-western part of uganda @xcite @xcite . it has an agglutinating morphology, where words are formed by adding affixes to their bases, and each affix carries meaning such as tense and aspect @xcite ) as shown in the example below. runyankore: ninkimumanya. ## generating large varied training corpora in runyankore from previous work on generating text in runyankore, it has been shown that noun semantics play a crucial role in noun pluralization @xcite , verb conjugation @xcite , and the generation of other grammatical units such as quantifiers @xcite . on the other hand, the syntactical structure of runyankore is also taken into account during noun pluralization @xcite and phonological conditioning @xcite . this, together with evidence for the use of a grammar engine (byamugisha et al., 2017a) and pattern-based generation @xcite in runyankore, are the basis for investigating the use of a combined semantic and syntactic, pattern-grammar-based approach to generate a runyankore corpus that is large enough and has sufficient variation to be used as training data.. given that there are supervised and unsupervised machine learning algorithms, we aimed to generate both labelled and unlabelled data, and focused on morphological analysis for the labels.. ## discussion we investigated how to solve the problem of the lack of training data in runyankore, and found several ways in which training data can be generated. we found the use of a combined semantic and syntactic, pattern-grammar-based approach to be applicable to the grammatical complexity and under-resourced state of runyankore. using this approach, we were able to generate one million labelled and unlabelled sentences in seven of runyankore's 14 tenses. this large dataset can be used in both supervised and unsupervised machine learning algorithms for various tasks as shown in our evaluation. the effort required to generate this dataset is significant, as explained in section 4.1. the grammatical aspects too are specific to runyankore's morphology. despite this, previous work has shown that the important text generation aspects-noun pluralization, verb conjugation, and pattern-based generation-can be generalized to other agglutinating bantu languages. for noun pluralization, a generic noun pluralizer exists for agglutinating bantu languages @xcite . verb conjugation using cfgs has also been shown to be possible for isizulu @xcite , another agglutinating bantu language. finally, the ability to bootstrap text generation patterns from one agglutinating bantu language to another was shown in @xcite . we therefore hypothesize that, with some tailoring, this approach may be generalizable to other bantu languages. interestingly, the results from word similarity evaluation in comparing the semantic categories of nouns in existing approaches for surface realization in runyankore @xcite and isizulu @xcite annotate nouns with their noun class (nc) in order to solve the problem of having the same class prefix in different classes (see classes 1, 3, and 18 in finally, while the results on sentiment analysis are not spectacular, our work is, to the best of our knowledge, the first sentiment analysis module for runyankore. additionally, the results from the word similarity evaluation also show that different sentiments can be distinguished (see the rungi and rofa examples in ## conclusion in this paper, we investigated how to generate a large and varied corpus to act as training data for a grammatically complex and computationally underresourced language, runyankore. we found the use of a combined semantic and syntactic, patterngrammar-based approach to be applicable to runyankore. using this approach, we were able to generate one million labelled and unlabelled sentences, that were evaluated as correctly encoding related word semantics, and performing well when applied to a supervised machine learning task, sentiment analysis. future work will involve identifying a qualitative evaluation for the dataset; manually labelling sentences from orumuri for sentiment, in order to have an independent dataset to evaluate sentiment analysis, and investigating how the labelled data can be used together with the word similarity results to determine the noun class of a noun.