Code Monkey home page Code Monkey logo

chatbot-nltk's Introduction

Python contextual chatbot with voice recognition.

Major packages used

  • Speech Recognition
  • PyTorch
  • Pyttsx
  • NLTK

Project requirements

  • Python 3.7-3.9 (Pytorch limitation)

Installation Process

First clone this git repository or download zip

  git clone https://github.com/shz-code/chatbot-nltk.git

Create a new virtual environment(Use Conda/ Virtual Environment) Learn More.

*If virtual environment is not installed on your machine install it using below command.

  pip install virtualenv

Activate virtualenv

   virtualenv env
  .\env\Scripts\activate  

Run pip to install all the dependencies

  pip install -r requirements.txt

Train your model based on intents.json

It will create data.pth which is the model data.

  py .\nlp_pipeline\train.py

If you get an error during the first run, you also need to install nltk.tokenize.punkt:

Run this once in your terminal:

  python
  >>> import nltk
  >>> nltk.download('punkt')

Finally start main.py

  py main.py

Features

  • Users can chat or speak with the bot.
  • The bot can generate answers based on pre-defined conditions or it will generate answer trained from intents.json data.

Customize

You can easily feed more data or customize the model by adding or modifying intents.json file.

For example

{
  "intents": [
    {
      "tag": "new-tag",
      "patterns": [
        "all the question patterns related to that tag",
        "question 1",
        "question 2"
      ],
      "responses": [
        "all the response patterns related to that tag",
        "response 1",
        "response 2"
      ]
    },
    ...
  ]
}

NB: You need to train your model again if you have modified the intents.json file. Run train.py file to train your chatbot. If you see no changes happening than delete the old data.pth file and train again.

Acknowledgements

chatbot-nltk's People

Contributors

shz-code avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 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.