Your question is Method Name Similarity to Class Name. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Liftoff code analysis tools need to identify methods whose names are sufficiently similar to their containing classes. Implement a function that determines whether a methodName is close to a className according to the following definition.
Normalize both names by removing every non-alphanumeric character and converting all letters to lowercase. The method is considered close when the Levenshtein edit distance between the normalized names is at most 2. One edit is one insertion, deletion, or substitution of a single character. Transpositions count as two edits.
methodName and className.True if their normalized Levenshtein distance is at most 2; otherwise return False.def is_close_method(methodName, className):