This comes with the core dictionary lookup and example frontend. This project assumes you will be running this translator in a browser of some sort.
text-to-ipa.js contains the main logic for loading the
ipadict.txt and looking up words, while
example-translator.html provide an interface.
Further reading on how this all takes place can be found inside the respective
.js files where extensive documentation can be found.
An example you can use is in the
example-translator.html file. Just download the repository and open up that file in a web browser.
This tool implies that the CMU-IPA Dictionary will be used. You can load any dictionary you want into this program, but the method to lookup words assumes it will be in the CMU format.
This was kind of a pain to get working, as most of the time was found looking for a good IPA dictionary which was ultimately found here. This dictionary is included with this repository by default.
- Include the following in the web page you want to deploy a converter to:
<script src="./text-to-ipa.js"></script> <script src="./converter-form.js"></script>
- Point the TextToIPA Object to the CMU IPA Dictionary like such:
window.onload = TextToIPA.loadDict('./ipadict.txt');
- Set up a UI for the converter in the webpage. Here's an example:
See examples for more.
For a styled and better looking version instead of one that has no CSS you can test it on my website here
This converter will simply look up each word in the CMU to IPA dictionary, and pop out the resulting phonetic text.
This code is released under the GNU GENERAL PUBLIC LICENSE. All works in this repository are meant to be utilized under this license. You are entitled to remix, remodify, and redistribute this program as you see fit, under the condition that all derivative works must use the GPL Version 3.