Skip to content
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

[FEATURE] <Implementing a AI chatbot to asist > #91

Closed
1 task done
divyalakshmi0 opened this issue Oct 27, 2024 · 9 comments
Closed
1 task done

[FEATURE] <Implementing a AI chatbot to asist > #91

divyalakshmi0 opened this issue Oct 27, 2024 · 9 comments
Labels
enhancement New feature or request gssoc GirlScript Summer Of Code gssoc-ext hacktoberfest hacktoberfest-accepted level3 GirlScript Summer Of Code - 35 points status: ready for dev You can asked for this issue to be assigned (if not already assigned)

Comments

@divyalakshmi0
Copy link

Is this feature already requested?

  • I have checked "open" and "closed" issues, and this is not a duplicate.

Problem or Missing Functionality

No response

Feature Description

I suggest adding ai to help user find books

Screenshots

No response

Would you like to work on this feature?

Yes

Implementation Plan

No response

@divyalakshmi0 divyalakshmi0 added the status: awaiting triage Waiting for maintainers to verify (please do not start work on this yet) label Oct 27, 2024
Copy link

👋 Thank you @divyalakshmi0 for raising an issue! We’re thrilled to have your input as we work to make this project even better. Our team will review it shortly, so stay tuned! Meanwhile, make sure your issue gets noticed, don’t forget to star the repo 🌟 and follow @ajaynegi45 for even more project insights!

@ajaynegi45 ajaynegi45 added enhancement New feature or request hacktoberfest-accepted hacktoberfest status: ready for dev You can asked for this issue to be assigned (if not already assigned) gssoc GirlScript Summer Of Code gssoc-ext level3 GirlScript Summer Of Code - 35 points and removed status: awaiting triage Waiting for maintainers to verify (please do not start work on this yet) labels Oct 27, 2024
@ajaynegi45
Copy link
Owner

I want to know how you implement it

@Tanisha0708
Copy link
Contributor

@divyalakshmi0 i would like to workk on this issue. please assign me this issue

@ajaynegi45
Copy link
Owner

@divyalakshmi0 i would like to workk on this issue. please assign me this issue

I want to know the implementation

@Tanisha0708
Copy link
Contributor

@ajaynegi45 i would like to implement in ds and using jdbc for this issue so that we can easily add the books while returning and remove books while issue with storing book info .. while chatbot will help in assisting about book .

@Tanisha0708
Copy link
Contributor

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class ChatbotApplication {

public static void main(String[] args) {
    ChatbotService chatbotService = new ChatbotService();
    
    // Simulate user input and interaction
    Scanner scanner = new Scanner(System.in);
    System.out.println("Welcome to the Library Chatbot! Type your queries:");
    
    while (true) {
        System.out.print("You: ");
        String userInput = scanner.nextLine();
        
        if (userInput.equalsIgnoreCase("exit")) {
            System.out.println("Chatbot: Goodbye!");
            break;
        }
        
        String response = chatbotService.processQuery(userInput);
        System.out.println("Chatbot: " + response);
    }
    
    scanner.close();
}

}

// Service to handle chatbot queries
class ChatbotService {
private final List books;

public ChatbotService() {
    this.books = loadBooks();
}

public String processQuery(String query) {
    if (query.toLowerCase().contains("find book")) {
        String keyword = query.replace("find book", "").trim();
        return findBooksByKeyword(keyword);
    }
    return "I'm here to help you find books. Try asking me to 'find book <title or keyword>'.";
}

private String findBooksByKeyword(String keyword) {
    List<Book> foundBooks = books.stream()
            .filter(book -> book.getTitle().toLowerCase().contains(keyword.toLowerCase()))
            .collect(Collectors.toList());
    
    if (foundBooks.isEmpty()) {
        return "No books found with that keyword.";
    }
    
    return foundBooks.stream()
            .map(Book::getTitle)
            .collect(Collectors.joining(", "));
}

private List<Book> loadBooks() {
    List<Book> books = new ArrayList<>();
    books.add(new Book("Effective Java", "Joshua Bloch", "Programming"));
    books.add(new Book("Java: The Complete Reference", "Herbert Schildt", "Programming"));
    books.add(new Book("Head First Java", "Kathy Sierra", "Programming"));
    books.add(new Book("Python Crash Course", "Eric Matthes", "Programming"));
    books.add(new Book("Automate the Boring Stuff with Python", "Al Sweigart", "Programming"));
    books.add(new Book("Fluent Python", "Luciano Ramalho", "Programming"));
    return books;
}

}

// Book entity class
class Book {
private String title;
private String author;
private String genre;

public Book(String title, String author, String genre) {
    this.title = title;
    this.author = author;
    this.genre = genre;
}

public String getTitle() {
    return title;
}

}

I want to know how you implement it

@Tanisha0708
Copy link
Contributor

here is the basic starting of code using java .

@skdas20
Copy link

skdas20 commented Nov 1, 2024

I'll develop the bot with DL4J and integrate it with spring, please assign this to me

@Tanisha0708
Copy link
Contributor

@ajaynegi45 please assign me this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request gssoc GirlScript Summer Of Code gssoc-ext hacktoberfest hacktoberfest-accepted level3 GirlScript Summer Of Code - 35 points status: ready for dev You can asked for this issue to be assigned (if not already assigned)
Projects
None yet
Development

No branches or pull requests

4 participants