Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Convert English text into the Phonetics using Python

  • Last Updated : 11 Oct, 2020

In this article, we are going to see how to convert English text into the International Phonetic Alphabet. We are going to use the eng-to-ipa module to convert into phonetic.

Installation: Run this code into your terminal.

pip install eng-to-ipa 

Let’s understands this module step-by-step:

1. Import this module and use convert() method to convert a string into phonetics.

Syntax: eng_to_ipa.convert(str)

Parameter:

  • str: the text to be converted

Returns: IPA string

Python3




import eng_to_ipa as p
  
  
p.convert("Hello Geeks")

Output:

'hɛˈloʊ giks'

2. Using ipa_list() instead of convert() it returns the list of each word as a list of all its possible transcriptions.

Syntax: eng_to_ipa.ipa_list(str)

Parameter:

  • str: the text to be converted

Return: list of all its possible transcriptions.

Python3




p.ipa_list("Yes i am geeks, How are you")

Output:

[[‘jɛs’], [‘aɪ’], [‘eɪɛm’, ‘æm’], [‘giks,’], [‘haʊ’], [‘ɑr’, ‘ər’], [‘ju’]]

3. The get_rhymes() methods return a list of rhymes for a word or set of words.

Syntax: eng_to_ipa.get_rhymes(str)

Parameter:

  • str: the text to be rhymed

Returns: list of rhymes for a word or set of words.

Python3




p.get_rhymes("Geeks")

Output:

['antiques',
 'batiks',
 'beeks',
 "belgique's",
 'bespeaks',
 'boutiques',
 'cheeks',
 "creek's",
 'creeks',
 'critiques',
 "deak's",
 'eakes',...
 ......
 ..


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!