{"id":24374,"library":"pyphonetics","title":"Pyphonetics","description":"A Python 3 library for phonetic encoding algorithms including Soundex, Metaphone, Double Metaphone, and others. Current version is 0.5.3, with infrequent releases.","status":"active","version":"0.5.3","language":"python","source_language":"en","source_url":"https://github.com/Lilykos/pyphonetics","tags":["phonetics","soundex","metaphone","encoding","nlp"],"install":[{"cmd":"pip install pyphonetics","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Standard import path.","symbol":"Soundex","correct":"from pyphonetics import Soundex"},{"note":"Standard import path.","symbol":"Metaphone","correct":"from pyphonetics import Metaphone"},{"note":"Spelling exactly 'DoubleMetaphone' (no space).","symbol":"DoubleMetaphone","correct":"from pyphonetics import DoubleMetaphone"},{"note":"Standard import path.","symbol":"FuzzySoundex","correct":"from pyphonetics import FuzzySoundex"}],"quickstart":{"code":"from pyphonetics import Soundex\nsoundex = Soundex()\nprint(soundex.phonetics('example'))","lang":"python","description":"Encode a word using Soundex phonetic algorithm."},"warnings":[{"fix":"Update code to expect a string or use `from pyphonetics import Soundex; code = soundex.phonetics('word')` and treat as string.","message":"The `phonetics` function returns a tuple in older versions but now returns a string; check return type.","severity":"deprecated","affected_versions":"<=0.5.2"},{"fix":"Always convert input to uppercase before passing: `soundex.phonetics(word.upper())`","message":"Case sensitivity: the library expects uppercase input for some algorithms; inconsistent behavior may occur.","severity":"gotcha","affected_versions":"all"},{"fix":"Check the return type: for DoubleMetaphone, use `result = dm.phonetics(word); primary, secondary = result`.","message":"In version 0.5.0, the `phonetics` method was changed from returning a list/generator to returning a string for single results; DoubleMetaphone changed to return a tuple.","severity":"breaking","affected_versions":">=0.5.0"},{"fix":"Sanitize input to only contain letters (A-Z) before encoding.","message":"The library does not support non-alphabetic characters well; numbers or punctuation may cause errors or silent failures.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use `from pyphonetics import Soundex` directly.","cause":"Incorrect import: `import pyphonetics` then `pyphonetics.Soundex()`.","error":"AttributeError: module 'pyphonetics' has no attribute 'Soundex'"},{"fix":"Avoid using `phonetics` as a variable name.","cause":"Overwriting the `phonetics` function variable name, e.g., `phonetics = 'foo'`.","error":"TypeError: 'str' object is not callable"},{"fix":"Strip non-alphabetic characters: `re.sub(r'[^A-Za-z]', '', word)`.","cause":"Input contains numbers or special characters.","error":"ValueError: The word must contain only letters"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}