1git clone https://github.com/NikiPshg/Grapheme-to-Phoneme-G2P-with-Stress.git
2cd Grapheme-to-Phoneme-G2P-with-Stresspip install -r requiremenst.txt1from G2P_lexicon import g2p_en_lexicon
2
3# Initialize the G2P converter
4g2p = g2p_en_lexicon()
5# Convert a word to phonemes
6text = "text, numbers, and some strange symbols !№;% 21"
7phonemes = g2p(text, with_stress=False)
8['T', 'EH', 'K', 'S', 'T', ' ', ',', ' ',
9'N', 'AH', 'M', 'B', 'ER', 'Z',' ', ',', ' ',
10'AE', 'N', 'D', ' ', 'S', 'AH', 'M', ' ',
11'S', 'T', 'R', 'EY', 'N', 'JH',' ',
12'S', 'IH', 'M', 'B', 'AH', 'L', 'Z',' ',
13'T', 'W', 'EH', 'N', 'IY', ' ', 'W', 'AH', 'N']