1. A method of character recognition comprising: capturing, by a character-recognition system, a scan of a document; segmenting, by the character-recognition system, the scan into a sequence of character images; generating, by the character-recognition system, a sequence of identifiers based on the character images, wherein each identifier in the sequence of identifiers represents a particular character, and wherein the generating comprises: assigning an identifier to a first character image in the sequence of images; for each subsequent character image in the sequence of images, comparing the subsequent character image to one or more character images that precede the subsequent character image in the sequence of character images; for each subsequent character image that matches one of the previous character images based on the comparison, assigning the identifier that is assigned to the one character image to the subsequent image; and for each subsequent character image that does not match one of the previous character images based on the comparison, assigning a new identifier that is different from each identifier previously assigned; and obtaining, by the character-recognition system, text based on the sequence of identifiers, the obtaining comprising: comparing the sequence of identifiers to a plurality of identifier sequences, each identifier sequence corresponding to a sequence of characters; and identifying as the text a sequence of characters corresponding to an identifier sequence that matches the sequence of identifiers.