Electronic Grammars and Reproducible Research

Abstract

Classes.LangClass.SFSTOutput(sFormat, ExtraArg) This SFSTOutput() function is defined for the class AlternativeContexts, which encodes a set of alternative phonological contexts forming part of the environment of such a phonological rule (or a phonologically determined allomorph); for example, the context of a long vowel or a vowel plus consonant. The function is called with an argument list specifying (among other things) a format. The only format this particular function knows about is called AsRegex; any other format is referred by the ‘else’ clause to a superclass of AlternativeContexts (here AbstractClasses.LangClass). Given this AsRegex argument, the function needs to output the alternatives in the format which SFST expects for a regular expression, namely a parenthesized list with list members separated by the character ‘|’. Since outputting of lists with various delimiters is a common task, the details of outputting the list (such as the need to output the separator character after every member of the list except the last) is here delegated to a more generic function, SFSTOutputList(), which takes as additional arguments (parameters) the character which starts the list (here an open parenthesis), the separator character (‘|’), and the character which marks the end of the list (a close parenthesis). This SFSTOutputList() function is not shown here; it is defined on an abstract superclass of AlternativesContext. The XML elements which constitute the alternatives (represented by X, Y and Z in the quoted comment) will be recursively output by SFSTOutput() functions defined on whatever classes these individual contexts belong to. For example, suppose a part of the grammar contains the following XML element (which happens to define a set of alternative contexts in Bangla26): (5) <Ln:AlternativesContext> 26 This example is for expository purposes. From a theoretical perspective, it could be better treated as a context consisting of a single natural class, namely the vowels /i/, /u/ and /a:/. Electronic Grammaticography Electronic Grammars and Reproducible Research 230 <Ln:SimpleContextTerminal> <Ln:refPhoneme idref="I"/> </Ln:SimpleContextTerminal> <Ln:SimpleContextTerminal> <Ln:refPhoneme idref="U"/> </Ln:SimpleContextTerminal> <Ln:SimpleContextTerminal> <Ln:refPhoneme idref="AA"/> </Ln:SimpleContextTerminal> </Ln:AlternativesContext> When this snippet of XML is read by the converter, its elements will be converted into objects of the corresponding classes in the converter. The outermost element is an AlternativeContexts, and when the converter outputs this in the SFST format, the SFSTOutput() function in (4) will be called. It will then call the SFSTOutputList() function with the appropriate arguments; this function in turn calls the SFSTOutput() functions for the list members, namely for the simple contexts, which in turn output their information. For SFST, it happens that the simple contexts need only tell the phonemes27 to output themselves in the SFST format, completing the process. The resulting SFST code would look like this:

Extracted Key Phrases

Cite this paper

@inproceedings{Maxwell2012ElectronicGA, title={Electronic Grammars and Reproducible Research}, author={Mike Maxwell}, year={2012} }