A discrete hidden Markov model for the recognition of handwritten Farsi words