Giter Club home page Giter Club logo

rarnn's Introduction

Recursive Application of Recurrent Neural Networks

A simple model for intent parsing that supports complex nested intents.

Model

The core of the model is a regular seq2seq/encoder-decoder model with attention. The attention model is from Luong et al.'s "Effective Approaches to Attention-based Neural Machine Translation" using dot-product based attention energies, with one important difference: there is no softmax layer, allowing attention to focus on multiple tokens at once. Instead a sigmoid layer is added to squeeze outputs between 0 and 1.

The encoder and decoder take one additional input context which represents the type of phrase, e.g. %setLightState. At the top level node the context is always %.

The encoder encodes the input sequence into a series of vectors using a bidirectional GRU. The decoder "translates" this into a sequence of phrase tokens, given the encoder outputs and current context, e.g. "turn off the office light" + %setLightState โ†’ [$on_off, $light].

Once the decoder has chosen tokens and alignments, the phrase tokens and selection of inputs are used as the context and inputs of the next iteration. This recurs until no more phrase tokens are found.

Data

Of course in order to parse a nested intent structure, we need nested intent training data. Examples are generated with a natural language templating language called Nalgene which produces both a flat string (input) and a parse tree (output). Templates define a number of %phrases and $values (leaf nodes) as well as filler ~synonyms. The generator takes a random walk down the tree to build each example. Here's a snippet from the grammar file:

%if
    ~if %condition then %sequence

%sequence
    ~please? %action
    ~please? %action ~also ~please? %action

%getSwitchState
    the $switch_name state
   
%getTemperature
    the temperature in the $room_name
    the $room_name temperature

%getPrice
    price of $asset
    $asset price

Author

Sean Robertson

@misc{Robertson2017,
    author = {Robertson, Sean},
    title = {Recursive Application of Recurrent Neural Networks},
    year = {2017},
    url = {https://github.com/spro/RARNN}
}

rarnn's People

Contributors

spro avatar

Watchers

James Cloos avatar um.hau avatar  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.