KipsMomWFM
New Member
I'm creating a web app in PHP where people can try to translate words they need to learn for school.For example, someone needs to translate the Dutch word 'weer' to 'weather' in English, but unfortunately he types 'whether'. Because he almost typed the right word, I want to give him another try, with dots '\[code\].\[/code\]' on the places where he made a mistake:\[code\]Language A: weerLanguage B: weatherInput: whetherOutput: w..ther\[/code\]Or, for example\[code\]Language A: foutLanguage B: mistakeInput: mitakeOutput: mi.take\[/code\]Or:\[code\]Language A: echtLanguage B: genuineInput: genuinelyOutput: genuinely (almost good, shorten the word a little bit)\[/code\]But, if the input differs too much from the desired translation, I don't want to get output like \[code\]........\[/code\]I heard about Levenshtein distance and I think I need an algorithm that is much like that one, but I don't know how to place dots on the right place instead of echoing how many operations are to be done.So, how can I return the misspelled word with dots on the places where someone made a mistake?