Skip to content

A system to suggest the next word in a phrase based on the previous words using LSTM on TensorFlow

License

Notifications You must be signed in to change notification settings

brunocfnba/word-suggestion-tensorflow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Word suggestion using LSTM Recurrent Neural Network with TensorFlow

This code creates a simple system able to suggest the next word based on the previous words provided. It can also be used to create a specific text based on some other texts.

The system uses a LSTM (long short term) Recurrent Neural Network model to learn from a dataset with 100 questions extracted from a help desk system.

How to run the code

To prepare your data, ensure the dataset is on the same directory as your code and run prep_data.py. The prepared dataset and other supporting files will be generated.
To train the neural network, uncomment lines 96 and 97 from the get_word.py file and run it.
To use the neural network also run the get_word.py file calling the get_word function. Unless you need to retrain your network you can keep the training function commented out.

Files description

  • prep_data.py - generates the dictionary of words based on the dataset and also creates a pickle file where each phrase is a list object and each item of the list is word.
  • lstm_sentence_nn.py - creates the recurrent neural network model and perform all the network training process saving the trained model at the end of the process.
  • get_word.py - where you can use the model, provides the get_word function which creates a simple user experience in the console so you can test and play around with the trained model.

About

A system to suggest the next word in a phrase based on the previous words using LSTM on TensorFlow

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages