Skip to content

Convert English to IPA using Python3 module eng_to_ipa

Notifications You must be signed in to change notification settings

vpnry/english-to-ipa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

to-ipa.py

Convert English text to IPA using python3 and Python module eng_to_ipa

Install

  • System requirements: python3, and module eng_to_ipa
  • On Ubuntu, install Python3 with:
sudo apt install python3

And eng_to_ipa module:

pip3 install eng_to_ipa

Usase

  • In Terminal CLI:
# insert IPA paragraphs follows English paragraphs
python3 to-ipa.py input.txt 1

# insert IPA transcription next to each word
python3 to-ipa.py input.txt 0
  • For function call:
toIPA("input.txt", 1) # insert IPA paragraphs follows English paragraphs
toIPA("input.txt", 0) # insert IPA transcription next to each word

Example

In Terminal, run this command:

python3 to-ipa.py input.txt 1
  • Input file input.txt content:
Adapted from https://en.m.wikipedia.org/wiki/Computer
A computer is a machine that can be instructed to carry out sequences of arithmetic or logical operations automatically via computer programming. 

Modern computers have the ability to follow generalized sets of operations, called programs. These programs enable computers to perform an extremely wide range of tasks.

We should get this output file:

  • Output file _ipa_input.txt (in current directory)
[1] Adapted from https://en.m.wikipedia.org/wiki/Computer

[1] əˈdæptɪd frəm https://en.m.wikipedia.org/wiki/computer*

[2] A computer is a machine that can be instructed to carry out sequences of arithmetic or logical operations automatically via computer programming.

[2] ə kəmˈpjutər ɪz ə məˈʃin ðət kən bi ˌɪnˈstrəktɪd tɪ ˈkɛri aʊt ˈsikwənsɪz əv ˌɛrɪθˈmɛtɪk ər ˈlɑʤɪkəl ˌɑpərˈeɪʃənz ˌɔtəˈmætɪkli ˈviə kəmˈpjutər ˈproʊˌgræmɪŋ.

[3] 

[3] 

[4] Modern computers have the ability to follow generalized sets of operations, called programs. These programs enable computers to perform an extremely wide range of tasks.

[4] ˈmɑdərn kəmˈpjutərz hæv ðə əˈbɪləˌti tɪ ˈfɑloʊ ˈʤɛnərəˌlaɪzd sɛts əv ˌɑpərˈeɪʃənz, kɔld ˈproʊˌgræmz. ðiz ˈproʊˌgræmz ɪˈneɪbəl kəmˈpjutərz tɪ pərˈfɔrm ən ɪkˈstrimli waɪd reɪnʤ əv tæsks.

About

Convert English to IPA using Python3 module eng_to_ipa

Topics

Resources

Stars

Watchers

Forks

Languages