It appears that you've defined "levenshtein_automata" as a method on your DFA class, but you did not reference the class instance in your call by prefixing "self". Instead, you're trying to call a globally defined function named "levenshtein_automata" -- which because it is not defined, is throwing a NameError.<div>
<br></div><div>Try changing line 145 to the below and see if that resolves the issue:</div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><br></span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "> lev = self.levenshtein_automata(word, k).to_dfa() ######### line 145 ##########</span></div>