A Computational Grammar of Sinhala

A Computational Grammar for a language is a very useful resource for carrying out various language processing tasks for that language such as Grammar checking, Machine Translation and Question Answering. As is the case in most South Indian Languages, Sinhala is a highly inflected language with three gender forms and two number forms among other grammatical features. While piecemeal descriptions of Sinhala grammar is reported in the literature, no comprehensive effort to develop a context-free grammar (CFG) has been made that has been able to account for any significant coverage of the language. This paper describes the development of a feature-based CFG for non-trivial sentences in Sinhala. The resulting grammar covers a significant subset of Sinhala as described in a well-known grammar book. A parser for producing the appropriate parse tree(s) of input sentences was also developed using the NLTK toolkit. The grammar also detects and so rejects ungrammatical sentences. Two hundred sample sentences taken from primary grade Sinhala grammar books were used to test the grammar. The grammar accounted for 60% of the coverage over these sentences.