GithubHelp home page GithubHelp logo

neuralspell's Introduction

neuralspell

Spelling reveals a lot about humanity: it's messy, inconsistent, and self-contradictory. Despite all of this, people have mental heuristics for spelling and pronouncing new words. I want to see how well neural networks can learn those same heuristics.

The goal of this project is to train recurrent neural networks on two tasks:

  • Spelling: converting phonetic transcriptions to an English spelling.
  • Pronunciation: converting English spellings to phonetic transcriptions.

Results

After training for one epoch, here are some results:

Word Pronunciation Network Spelling Network Pronunciation
invader InveIdəɹ invader Invedəɹ
twelve twɛlv twelve twɛlv
evaluate IvæljueIt evaluate ɛvʌlueIt
guilty gIlti gilty gIlti

Usage

First, you should install and configure Go. Make sure your GOPATH is setup.

If you don't want to setup Go yourself, you can use the Docker image for Go. It has everything that you will need:

$ docker run -it golang:1.7 /bin/bash

Downloading the code

Next, download the code as follows:

$ go get -d -u github.com/unixpickle/neuralspell/...

The repository includes sub-directories for various commands. The train command is the first thing you will want to use. After that, you can use the eval command to run the network on a new word or phonetic transcription.

Training

$ cd $GOPATH/src/github.com/unixpickle/neuralspell/train
$ go run *.go

This will train a new network on the spelling task. Pressing Ctrl+C will gracefully stop training and save the result to a file called out_net. Make sure not to press Ctrl+C more than once. To train on the pronunciation task, add -task pronounce:

$ go run *.go -task pronounce

I recommend training for at least an hour per task. See -help for more information on training.

Feeding input

To evaluate the network on new inputs, you can use the eval command. Note that you must already have trained the network on the task at hand.

$ cd $GOPATH/src/github.com/unixpickle/neuralspell/eval
$ go run *.go -phonetics dɔg
Spelling: dog
$ go run *.go -spelling dog -task spell
Pronunciation: dag

If you have not trained the network, the command will probably take a long time to run. This is because, to decode the output of the network, eval uses a technique called prefix search decoding. If the network was not trained very much, prefix search decoding has to search a vast array of possible decodings.

How it works

The technical side of the project is fairly unoriginal. I use an architecture similar to one that might be used for neural speech recognition. In this architecture, a bidirectional-RNN "reads" the input and produces a labeling using Connectionist Temporal Classification.

There were other implementation routes I could have taken. I think it would be particularly interesting to have two "encoder" networks that convert spelling/phonetics to a universal vector representation, and then have two "decoder" networks turn said representation into spelling/phonetics.

neuralspell's People

Contributors

unixpickle avatar

Watchers

 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.