Handwriting recognition with extraction of letter fragments