Text this: Algorithm for an A* stack search HMM word spotter