Git Product home page Git Product logo

transly's Introduction

Code style License Maintenance versions

Transly

Transly is a sequence to sequence Bi-directional LSTM Encoder-Decoder model that's trained on the CMU pronouncing dictionary, IIT Bombay English-Hindi Parallel Corpus and IIT Kharagpur transliteration corpus.

The pronunciation module in Transly can predict pronunciation of any given word (with an American accent of course!)

Take any word of any language - just transliterate the word in English (all capitals) and you are good to go. Be it a new or old, seen or unseen, sensible or insensible word - Transly can catch'em all!

Another module in Transly is the transliteration module. It currently supports Hindi to English and English to Hindi transliterations.

Pre-trained models can be found inside the respective trained_models folders. New models can also be trained on custom data.

Installation

Use the package manager pip to install transly

pip install transly

Usage

Pronunciation

Using the pre-trained pronunciation model

import transly.pronunciation as tp

# let's try a hindi word
# the prediction accent would be American
QUERY = 'MAKAAN'
a = tp.load_model(model_path='cmu')
a.infer(QUERY, separator=" ")

Training a new model on custom data

from transly.seq2seq.config import SConfig
from transly.seq2seq.version0 import Seq2Seq

config = SConfig(training_data_path=training_data_path, input_mode='character_level', output_mode='word_level')
s2s = Seq2Seq(config)
s2s.fit()
s2s.save_model(path_to_model=model_path, model_file_name=model_file_name)

Transliteration

Hindi to English

Using the pre-trained model

import transly.transliteration as tl

QUERY = 'नहीं'
a = tl.load_model(model_path='hi2en')
a.infer(QUERY)

English to Hindi

Using the pre-trained model

import transly.transliteration as tl

QUERY = 'NAHI'
a = tl.load_model(model_path='en2hi')
a.infer(QUERY)

Training a new model on custom data

from transly.seq2seq.config import SConfig
from transly.seq2seq.version0 import Seq2Seq

config = SConfig(training_data_path=training_data_path)
s2s = Seq2Seq(config)
s2s.fit()
s2s.save_model(path_to_model=model_path, model_file_name=model_file_name)

Training data file should be a csv with two columns, the input and the output

Input Output
AA AA1
AABERG AA1 B ER0 G
AACHEN AA1 K AH0 N
AACHENER AA1 K AH0 N ER0

License

The Python code in this module is distributed with Apache License 2.0

transly's People

Contributors

gitnik17 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.