Abstract: Pseudo two-dimensional hidden Markov models (HMMs) are used to represent text elements, such as characters or words. Observation vectors for each text element are based on pixel maps obtained by optical scanning. A character is represented by a pseudo two-dimensional HMM having a number of superstates, with each superstate having at least one state. Text elements are compared with such models by using the Viterbi algorithm, first in connection with the states in each superstate, then the superstates themselves, to calculate the probability that a particular model represents the text element. Parameters for the models are generated by training routines. Probabilities can be adjusted to compensate for changes in scale, translations, slant, and rotation.An embodiment is also disclosed for identifying keywords in a body of text. A first pseudo two-dimensional HMM is created for the words that may appear in the text.