A mathematical expression recognizing device comprises a character
recognition unit which recognizes characters in a document image, a
dictionary storing a pair of evaluation scores for each type of word, the
score showing the possibility of belonging to the text and that of
belonging to the mathematical expression, an evaluation unit which
obtains the evaluation scores showing the possibility of belonging to the
text and that of belonging to the mathematical expression for each of the
words included in the recognized characters with reference to the
dictionary, and a mathematical expression detecting unit which searches
for an optimal path connecting words by selecting one of the text and the
mathematical expression based on a formative grammar and the evaluation
scores showing the possibility of belonging to the text and that of
belonging to the mathematical expression for each of the words, thereby
detecting characters belonging to the mathematical expression.