I'm looking for a basic phoneme-grapheme alignment algorithm which can be called in Python from a machine running OS X. So far the only implementations I've been able to find are part of larger C++ libraries (here and here) which seem like they would be overkill to install, especially given the added difficulty of getting them running on an OS X machine.

Does anyone know of a good standalone P2G implementation written in Python? Maybe something living in a git gist somewhere?

1 Answer 1


I figured I'd post an answer in case it helped anyone else in the future. I wound up installing Jiampojamarn's m2m-aligner, callable via the terminal, and it works great. I used this to preprocess all of grapheme/phoneme pairs in the CMU Pronunciation Dictionary prior to runtime, and saved the results in a custom GraphemePhonemeAlignment Python class.

One trick for anyone trying to get the m2m-aligner working on OSX: I had to delete the lgcc_s requirement from the makefile in order to get the make command to work. After that, the program ran like a charm.

  • 1
    I ended up writing my own aligner in Python and it picked up inconsistencies in the CMU dictionary. Message me if anyone wants Commented Jan 20, 2023 at 7:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.