Code Monkey home page Code Monkey logo

word_ordering's Introduction

Word Ordering: Can Neural Networks Put a Scramble of Words in Correct Order?

When learning a second language, one of the hardest challenges is likely to be familiar with the word order. Word order can be also important in machine translation because translation is, roughly speaking, a process that one arranges words of target language which are equivalent to source language in order. Probably you've done a word scramble game where you are to put shuffled words or letters in the original order. I think it's quite fun to see if neural networks can do it. Okay. Can you order the following words correctly?

can translation machine order also important be word in

Requirements

  • NumPy >= 1.11.1
  • TensorFlow == 1.2 (Probably 1.3 should work, too, though I didn't test it)
  • matplotlib
  • distance
  • tqdm

Model Architecture

I employ the Transformer which was introduced in the paper Attention Is All You Need. It's known to the state-of-the-art model in the machine translation task as of 2017. However, I don't know if it fits in this task the best. Actually, I think a simpler architecture may work. The figure below is borrowed from the paper.

File description

  • hyperparams.py includes all hyper parameters that are needed.
  • data_load.py contains functions regarding loading and batching data.
  • modules.py has all building blocks for encoder/decoder networks.
  • train.py contains the model and training code.
  • eval.py is for evaluation and inference.

Training

Training Loss and Accuracy

  • Training Loss

  • Training Accuracy

Evaluation

  • Run eval.py.

We take WER (Word Error Rate) as the metric. WER is computed as follows:

WER = Edit distance / Number of words

Total WER : 10731/23541=0.46

Check the results folder for details.

word_ordering's People

Contributors

kyubyong avatar

Watchers

John D. Pope avatar  avatar paper2code - bot 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.