Code Monkey home page Code Monkey logo

language-modeling's Introduction

Language Modeling

This is machine learning model that is trained to predict next word in the sequence. Model is defined in keras and then converted to tensorflowjs model using tfjs_converter.

Dependencies

To install all dependencies at once use:

pip3 install -r requirements.txt

Usage

First create necessary directories or else you will get an error.

mkdir model/checkpoint
mkdir web/dist/web_model

Once you have your dependencies installed via pip, train the model by running :

python3 train.py

After training you can either use the model by running :

python3 test.py

After running test.py your output should be :

Enter atleast 3 words:
welcome to new

indexes of last  3 words        : [4402, 5, 35]

prediction indexes      : [92, 1, 2645, 1491, 189, 1762, 207, 362, 2261, 1727]


1 - welcome to new york
2 - welcome to new <unk>
3 - welcome to new york-based
4 - welcome to new england
5 - welcome to new products
6 - welcome to new jersey
7 - welcome to new debt
8 - welcome to new loans
9 - welcome to new hampshire
10 - welcome to new ventures

or by converting the model to tensorflow js model by running :

tensorflowjs_converter --input_format=keras /model/model.h5 /web/dist/web_model

Then Read the README.md in /web directory

language-modeling's People

Contributors

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