Merging word recognition with contour recognition