def soundsLike(s1, s2): c = _MPCACHE s1 = clean(s1) s2 = clean(s2) try: m1 = c[s1] except KeyError: m1 = c[s1] = metaphone.metaphone(s1) try: m2 = c[s2] except KeyError: m2 = c[s2] = metaphone.metaphone(s2) return m1 == m2
def mphone(s): c = _MPCACHE s = clean(s) try: return c[s] except: m = c[s] = metaphone.metaphone(s) return m