1. A method implemented in a computer infrastructure, comprising: reviewing an input text to detect spelling errors in one or more words by detecting space-deletion errors and space-insertion errors; calculating a variable cost distance of letters associated with the one or more words; determining a best candidate solution for correcting the spelling errors based on the variable cost distance; and correcting the spelling errors using the best candidate solution, wherein: the detecting space-deletion errors comprises choosing a sequence of letters with a maximum marginal probability via an A* lattice search and m-grams probability estimation; and the detecting space-insertion errors comprises generating all possible combinations between words in an input phrase.