Skip to content
This repository has been archived by the owner on Jul 6, 2021. It is now read-only.

This is machine learning model that is trained to predict next word in the sequence. Model is defined in keras and then converted to tensorflow-js model for the web, check the web implementation at

License

Notifications You must be signed in to change notification settings

rajveermalviya/language-modeling

Repository files navigation

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

About

This is machine learning model that is trained to predict next word in the sequence. Model is defined in keras and then converted to tensorflow-js model for the web, check the web implementation at

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published