Git Product home page Git Product logo

text-to-ipa's Introduction

text-to-ipa JS Version License: GPL v3

Text to IPA converter in JavaScript

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 converter-form.js and 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.

Getting Started

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.

Deploying

  1. 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>
  1. Point the TextToIPA Object to the CMU IPA Dictionary like such:
window.onload = TextToIPA.loadDict('./ipadict.txt');
  1. Set up a UI for the converter in the webpage. Here's an example:
<div id="js-text-to-ipa-form">

  <ul style="list-style-type: none;">
    <li><textarea id="ipa-in" placeholder="Write text here!" rows="4" cols="50"></textarea></li>
    <li class="button"><button type="button" id="js-ipa-submit" onClick="ConverterForm.convert('ipa-in', 'ipa-out', 'ipa-err')">Convert!</button></li>
    <li><textarea readonly id="ipa-out" placeholder="aʊtpʊt gəʊz hɪə!" rows="4" cols="50"></textarea></li>
  </ul>

  <ul style="list-style-type: none;">
    <li><noscript><p>This converter will not work unless Javascript is enabled.</p></noscript></li>
    <li>
      <div id="ipa-err">
        <p>Errors will go here if you make any. (This will be overwritten!)</p>
      </div>
    </li>
  </ul>
</div>

See examples for more.

Example

For a styled and better looking version instead of one that has no CSS you can test it on my website here

Basic Usage

This converter will simply look up each word in the CMU to IPA dictionary, and pop out the resulting phonetic text.

License

GPL

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.

Acknowledgements

CMU IPA Dictionary

text-to-ipa's People

Contributors

surrsurus avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.