CRF learning for OCR