An algorithm for computing the edit-distance between two words
The problem is that both "bo0k" and "bouk" are one character different from "book", and no other metric will give you a way to distinguish between them.
What you will need to do is change the scoring: Instead of counting a different character as an edit distance of 1, you could give it a higher score if it's a different character class (ie a digit instead of a letter). That way you will get a different score for your examples.
You might have to adapt the other scores as well, though, so that replacement / insertion / deletion are still consistent.
I am trying to write Python code that takes a word as an input (e.g. book), and outputs the most similar word with similarity score. 
I have tried different off-the-shelf edit-distance algorithms like cosine, Levenshtein and others, but these cannot tell the degree of differences. For example, (book, bouk) and (book,bo0k). I am looking for an algorithm that can gives different scores for these two examples. I am thinking about using fastText or BPE, however they use cosine distance. 
Is there any algorithm that can solve this?