-
-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Chatbot #537
base: main
Are you sure you want to change the base?
Added Chatbot #537
Conversation
…l of the paws project
removed unnecessary commented part.
…l-patch-3 Added CODE_OF_CONDUCT.md
…ModuleFile [FIX] - Module.css files removed and Tailwind CSS applied.
Added For Innovateninjas#316
Adds new favicon
Create greetings.yaml
Added Nearest NGO Info in Success Page
* R * now * G * FINALLLLL --------- Co-authored-by: Arnab Mondal <[email protected]>
This reverts commit 6ac264d.
modified: src/pages/user/UserRegistration.jsx
* added a happy recovery story page * updated * original Navbar.jsx
Co-authored-by: Arnab Mondal <[email protected]>
modified: src/pages/user/ReportIncidentPages/FeedbackForm/Feedback.jsx
Co-authored-by: Arnab Mondal <[email protected]>
This reverts commit 8fbb271.
…)" (Innovateninjas#529) This reverts commit 7333a69.
modified: src/App.jsx
…ninjas#527)" (Innovateninjas#529)" (Innovateninjas#530) This reverts commit 40fefe1.
* Updated Error Page. * new
Co-authored-by: Arnab Mondal <[email protected]>
WalkthroughThe recent changes introduce a chatbot named "Snapitizer" to the Paws platform, enhancing user engagement through natural language processing capabilities. The chatbot leverages a neural network model for intent recognition and utilizes a structured set of intents for dynamic interactions. Additionally, the implementation includes necessary documentation and utilities for easy customization and training, significantly improving the platform's responsiveness to user inquiries about animal welfare. Changes
Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (6)
- AI_CHATBOT_PAWS/README.md (1 hunks)
- AI_CHATBOT_PAWS/chat.py (1 hunks)
- AI_CHATBOT_PAWS/intents.json (1 hunks)
- AI_CHATBOT_PAWS/model.py (1 hunks)
- AI_CHATBOT_PAWS/nltk_utils.py (1 hunks)
- AI_CHATBOT_PAWS/train.py (1 hunks)
Additional context used
LanguageTool
AI_CHATBOT_PAWS/README.md
[uncategorized] ~3-~3: Possible missing comma found.
Context: ...it NLTK, pytorch
I have developed this bot
Feel free to update the intents.json ...(AI_HYDRA_LEO_MISSING_COMMA)
Ruff
AI_CHATBOT_PAWS/model.py
1-1:
torch
imported but unusedRemove unused import:
torch
(F401)
AI_CHATBOT_PAWS/train.py
2-2:
random
imported but unusedRemove unused import:
random
(F401)
Additional comments not posted (21)
AI_CHATBOT_PAWS/nltk_utils.py (3)
1-5
: LGTM!The imports and initialization are appropriate.
7-8
: LGTM!The
tokenize
function correctly uses NLTK's word_tokenize function.
11-12
: LGTM!The
stem
function correctly uses the PorterStemmer.AI_CHATBOT_PAWS/model.py (2)
5-11
: LGTM!The
NeuralNet
class and__init__
method are implemented correctly.
13-19
: LGTM!The
forward
method is implemented correctly.AI_CHATBOT_PAWS/chat.py (2)
24-26
: LGTM!The model loading and evaluation setup is correct.
48-53
: LGTM!The response generation logic is correct and handles cases where the model is not confident.
AI_CHATBOT_PAWS/train.py (4)
18-29
: LGTM!The data preprocessing logic is correct and efficient.
54-70
: LGTM!The dataset and dataloader setup is correct.
79-91
: LGTM!The model training loop is correct and efficient.
96-108
: LGTM!The model saving logic is correct.
AI_CHATBOT_PAWS/intents.json (10)
3-17
: LGTM!The patterns and responses for the
greeting
intent are appropriate and cover common greeting phrases.
18-26
: LGTM!The patterns and responses for the
goodbye
intent are appropriate and cover common goodbye phrases.
27-35
: LGTM!The patterns and responses for the
thanks
intent are appropriate and cover common phrases for expressing gratitude.
36-47
: LGTM!The patterns and responses for the
mission
intent are appropriate and provide clear information about the platform's mission.
48-57
: LGTM!The patterns and responses for the
hackathon
intent are appropriate and provide clear information about the hackathon.
60-69
: LGTM!The patterns and responses for the
features
intent are appropriate and provide clear information about the platform's features.
71-80
: LGTM!The patterns and responses for the
report_animal
intent are appropriate and provide clear information about reporting an injured animal.
82-90
: LGTM!The patterns and responses for the
volunteer
intent are appropriate and provide clear information about volunteering.
93-101
: LGTM!The patterns and responses for the
donate
intent are appropriate and provide clear information about donations.
104-123
: LGTM!The patterns and responses for the
awareness
andcontact
intents are appropriate and provide clear information about awareness campaigns and contact information.
# AI_CHATBOT | ||
It is an Ai chatbot developed using natural language toolkit NLTK, pytorch | ||
I have developed this bot | ||
Feel free to update the intents.json to make the domain of the chatbot wider. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improve documentation clarity and fix grammatical issue.
The documentation can be enhanced for better readability. Additionally, there is a missing comma after "pytorch".
- It is an Ai chatbot developed using natural language toolkit NLTK, pytorch
- I have developed this bot
+ It is an AI chatbot developed using the Natural Language Toolkit (NLTK) and PyTorch.
+ This bot has been developed to assist users.
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
# AI_CHATBOT | |
It is an Ai chatbot developed using natural language toolkit NLTK, pytorch | |
I have developed this bot | |
Feel free to update the intents.json to make the domain of the chatbot wider. | |
# AI_CHATBOT | |
It is an AI chatbot developed using the Natural Language Toolkit (NLTK) and PyTorch. | |
This bot has been developed to assist users. | |
Feel free to update the intents.json to make the domain of the chatbot wider. |
Tools
LanguageTool
[uncategorized] ~3-~3: Possible missing comma found.
Context: ...it NLTK, pytorch
I have developed this bot
Feel free to update the intents.json ...(AI_HYDRA_LEO_MISSING_COMMA)
def bag_of_words(tokenized_sentence, words): | ||
|
||
sentence_words = [stem(word) for word in tokenized_sentence] | ||
bag = np.zeros(len(words), dtype=np.float32) | ||
for idx, w in enumerate(words): | ||
if w in sentence_words: | ||
bag[idx] = 1 | ||
|
||
return bag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enhance readability and clarity.
Add a docstring for clarity and remove unnecessary blank lines.
+ def bag_of_words(tokenized_sentence, words):
+ """
+ Create a bag of words representation.
+
+ Args:
+ tokenized_sentence (list): Tokenized sentence.
+ words (list): List of words.
+
+ Returns:
+ numpy.ndarray: Bag of words representation.
+ """
sentence_words = [stem(word) for word in tokenized_sentence]
bag = np.zeros(len(words), dtype=np.float32)
for idx, w in enumerate(words):
if w in sentence_words:
bag[idx] = 1
return bag
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
def bag_of_words(tokenized_sentence, words): | |
sentence_words = [stem(word) for word in tokenized_sentence] | |
bag = np.zeros(len(words), dtype=np.float32) | |
for idx, w in enumerate(words): | |
if w in sentence_words: | |
bag[idx] = 1 | |
return bag | |
def bag_of_words(tokenized_sentence, words): | |
""" | |
Create a bag of words representation. | |
Args: | |
tokenized_sentence (list): Tokenized sentence. | |
words (list): List of words. | |
Returns: | |
numpy.ndarray: Bag of words representation. | |
""" | |
sentence_words = [stem(word) for word in tokenized_sentence] | |
bag = np.zeros(len(words), dtype=np.float32) | |
for idx, w in enumerate(words): | |
if w in sentence_words: | |
bag[idx] = 1 | |
return bag |
import torch | ||
import torch.nn as nn | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused import.
The torch
import is unused and should be removed.
- import torch
import torch.nn as nn
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
import torch | |
import torch.nn as nn | |
import torch.nn as nn | |
Tools
Ruff
1-1:
torch
imported but unusedRemove unused import:
torch
(F401)
while True: | ||
# sentence = "do you use credit cards?" | ||
sentence = input("You: ") | ||
if sentence == "quit": | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handle case-insensitive 'quit' command.
Currently, the 'quit' command is case-sensitive. Consider making it case-insensitive for better user experience.
- if sentence == "quit":
+ if sentence.lower() == "quit":
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
while True: | |
# sentence = "do you use credit cards?" | |
sentence = input("You: ") | |
if sentence == "quit": | |
break | |
while True: | |
# sentence = "do you use credit cards?" | |
sentence = input("You: ") | |
if sentence.lower() == "quit": | |
break |
import random | ||
import json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused import: random
.
The random
module is imported but not used in the code.
- import random
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
import random | |
import json | |
import json |
@@ -0,0 +1,108 @@ | |||
import numpy as np | |||
import random |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused import: random
.
The random
module is imported but not used in the code.
- import random
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
import random |
Tools
Ruff
2-2:
random
imported but unusedRemove unused import:
random
(F401)
Description
Adding a chatbot to Paws will significantly enhance user engagement and support by providing instant assistance and guidance on reporting injured animals.
The chatbot will facilitate seamless communication between users, NGOs, and animal hospitals, ensuring that reports are efficiently directed to the appropriate parties.
This feature will streamline the process of helping stray injured animals, making the platform more responsive and effective in addressing animal welfare concerns
Related Issue
Resolves #534 Issue
Screenshots / GIFs (if applicable)
[Attach any relevant screenshots or GIFs demonstrating the changes]
Checklist:
Additional Notes
[Add any additional notes or context about the changes made]
@itsekta, could you please approve this pull request
Summary by CodeRabbit
New Features
Documentation