"Suart is a chatbot designed to analyze your text files. You can input a file and ask questions about specific keywords from the content. Suart will provide the most relevant answers based on the text."
To import the necessary packages into your local environment and ensure they are available in your .venv (virtual environment), you need to follow these steps:
- Create a Virtual Environment (if you haven't already): Open your terminal and navigate to your project directory. Then create a virtual environment by running:
- Activate the Virtual Environment: After creating the virtual environment, activate it. The command differs based on your operating system:
On Windows:
Note: You might require to install some extra library features like 'punkt', Just give a command,
- Once everything is setup then, go to terminal
- Access your application:
Open your web browser and navigate to http://127.0.0.1:5000/asking . You should see your chatbot interface. When you type a message and click "Send", it will send the input to the Flask backend, which will process it and return a response to be displayed in the chatbox.
-
Data File: The Data.txt file contains human-readable text data that serves as the foundation for the project.
-
Main Code: The entire functionality is encapsulated in the main.py file, which drives the project.
-
API Setup: Flask is used to create a simple API, making it easy to interact with the backend.
-
API Endpoint: The primary route, http://127.0.0.1:5000/asking, triggers the process. Upon accessing this route, the Data.txt file is read and processed into tokens.
-
Tokenization: Using NLTK, the text data is split into unique word tokens, which enable efficient searching.
-
User Interaction: A web template, created with HTML, is displayed to the user. The HTML file includes a script to collect user input and send a GET request to a secondary API endpoint.
-
Search Endpoint: The route http://127.0.0.1:5000/question/ accepts user input as a string. It searches the Data.txt file for the first occurrence of the input token and returns the corresponding statement.
-
Output: The matched statement is displayed to the user. 🎉
Happy Coding! 💻