Specification and Implementation of Input Methods Using Finite-State Transducers
Most input method frameworks proposed so far try to bridge the gap between an input method implementation, the text editor and the input events. In this paper, we propose to specify the implementation of input methods using a declarative approach using extended finite-state transducers. We implemented a finite-state model in Java that handles Unicode strings and events called Salsa. The class implementing the InputMethodListener interface bridges the gap between the transducer and the outside world. This class is parameterized by a Salsa transducer which defines the input method. The transition is traversed when the FST receives a character string corresponding to the left-projection. The associated event is fired and if it handled successfully, the FST sends as output the string on the right- projection. The Salsa language provides a textual syntax for specifying transducers. This language allows the factorization of transitions such that simple FST with few states but many transitions can be written economically. The language also allows the specification of classes of input (character classes or string classes). Strings are Unicode strings: the text specifying the transducer is UTF8. However, any character set can be specified as input or output using hexadecimal codes for specifying characters. Salsa comes with a compiler which reads a Salsa specification and builds a runtime representation of the transducer, and a Salsa runtime module which can be accessed through the Salsa runtime API. The class implementing the InputMethodListener interface bridges the gap between the transducer and the outside world. This class is parameterized by a Salsa transducer which defines the input method. Other applications of Salsa include the specification and implementation of context analysis, and the implementation of codeset converters for example. The overall architecture is pictured in Figure 1 below. The text editor has an Input Method which receives mouse and keyboard events and translate them into text or commands for the editor. These are passed to the Context Analyzer (optional) which selects the appropriate glyph to be displayed by the text widget. Both the Input Method and the Context Analyzer are driven by a set of rules which parametrize the interpreter of finite-state transducer.
Published in 2001.