{"id":23828599,"url":"https://github.com/umarlypoeta/simple_chat_bot","last_synced_at":"2026-04-20T04:04:30.955Z","repository":{"id":248625523,"uuid":"829219456","full_name":"UmarlyPoeta/Simple_Chat_Bot","owner":"UmarlyPoeta","description":"This project combines a chat bot with voice recognition capabilities to create an interactive Q\u0026A system. The chat bot can recognize speech input, find the best match for a given question from a knowledge base, and provide an appropriate response. Additionally, it can learn new responses from the user.","archived":false,"fork":false,"pushed_at":"2024-07-16T02:16:37.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-02T13:18:56.817Z","etag":null,"topics":["begginer-project","difflib","json","python","pyttsx3","voice-recognition"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/UmarlyPoeta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-16T02:14:00.000Z","updated_at":"2024-07-26T19:26:40.000Z","dependencies_parsed_at":"2024-07-16T06:24:19.616Z","dependency_job_id":null,"html_url":"https://github.com/UmarlyPoeta/Simple_Chat_Bot","commit_stats":null,"previous_names":["umarlypoeta/simple_chat_bot"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UmarlyPoeta%2FSimple_Chat_Bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UmarlyPoeta%2FSimple_Chat_Bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UmarlyPoeta%2FSimple_Chat_Bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UmarlyPoeta%2FSimple_Chat_Bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UmarlyPoeta","download_url":"https://codeload.github.com/UmarlyPoeta/Simple_Chat_Bot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240115864,"owners_count":19750091,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["begginer-project","difflib","json","python","pyttsx3","voice-recognition"],"created_at":"2025-01-02T13:19:13.999Z","updated_at":"2026-04-20T04:04:30.922Z","avatar_url":"https://github.com/UmarlyPoeta.png","language":"Python","readme":"## Chat Bot and Voice Recognition\n\nThis project combines a chat bot with voice recognition capabilities to create an interactive Q\u0026A system. The chat bot can recognize speech input, find the best match for a given question from a knowledge base, and provide an appropriate response. Additionally, it can learn new responses from the user.\n\n### Features\n\n- **Speech Recognition:** Uses the `speech_recognition` library to convert spoken words into text.\n- **Text-to-Speech:** Uses the `pyttsx3` library to convert text responses back into speech.\n- **Knowledge Base:** Stores questions and answers in a JSON file.\n- **Learning Capability:** Can learn new responses from the user and update the knowledge base.\n\n### Installation\n\n1. **Clone the Repository:**\n\n   ```sh\n   git clone https://github.com/YourUsername/chat_bot_voice_recognition.git\n   cd chat_bot_voice_recognition\n   ```\n\n2. **Create and activate a virtual environment (optional but recommended):**\n\n   ```sh\n   python -m venv venv\n   source venv/bin/activate # On Windows use `venv\\Scripts\\activate`\n   ```\n\n3. **Install the dependencies:**\n\n   ```sh\n   pip install -r requirements.txt\n   ```\n\n### Dependencies\n\n- `speech_recognition`\n- `pyttsx3`\n- `json`\n- `difflib`\n\nYou can install these dependencies using the following command:\n\n```sh\npip install speechrecognition pyttsx3\n```\n\n### File Structure\n\n```sh\nchat_bot_voice_recognition/\n│\n├── voice_recognition.py   # Speech recognition module\n├── chat_bot.py            # Main chat bot script\n├── knowledge_base.json    # JSON file containing Q\u0026A\n└── README.md              # This README file\n```\n\n### Usage\n\n1. **Setup the Knowledge Base:**\n\n   Make sure `knowledge_base.json` is present in the root directory with the following structure:\n\n   ```json\n   {\n       \"questions\": [\n           {\n               \"question\": \"What is Python?\",\n               \"answer\": \"Python is a high-level, interpreted programming language known for its readability and versatility.\"\n           },\n           {\n               \"question\": \"Who developed Python?\",\n               \"answer\": \"Python was developed by Guido van Rossum and was first released in 1991.\"\n           }\n           // Add more questions and answers here\n       ]\n   }\n   ```\n\n2. **Run the Chat Bot:**\n\n   ```sh\n   python chat_bot.py\n   ```\n\n3. **Interact with the Chat Bot:**\n\n   - Speak into your microphone when prompted.\n   - The chat bot will recognize your speech, find the best match for your question in the knowledge base, and respond.\n   - If the bot doesn't know the answer, it will ask you for the correct response and learn it.\n\n### Code Explanation\n\n#### voice_recognition.py\n\nThis module handles all speech recognition tasks. It initializes the recognizer and microphone, provides methods to list available microphones, set a specific microphone, and recognize speech.\n\n#### chat_bot.py\n\nThis script loads the knowledge base, initializes the speech recognizer and text-to-speech engine, and contains the main loop for interacting with the user. It processes the user's speech input, finds the best match for their question, and responds appropriately. If the bot doesn't know the answer, it asks the user to provide it and updates the knowledge base accordingly.\n\n### Example Knowledge Base\n\nHere is an expanded example of `knowledge_base.json`:\n\n```json\n{\n    \"questions\": [\n        {\n            \"question\": \"What is Python?\",\n            \"answer\": \"Python is a high-level, interpreted programming language known for its readability and versatility.\"\n        },\n        {\n            \"question\": \"Who developed Python?\",\n            \"answer\": \"Python was developed by Guido van Rossum and was first released in 1991.\"\n        },\n        {\n            \"question\": \"What is a function in Python?\",\n            \"answer\": \"A function in Python is a block of reusable code that performs a specific task.\"\n        },\n        {\n            \"question\": \"How do you define a function in Python?\",\n            \"answer\": \"You define a function in Python using the 'def' keyword followed by the function name and parentheses.\"\n        },\n        {\n            \"question\": \"What is a list in Python?\",\n            \"answer\": \"A list in Python is a collection of items that are ordered and changeable.\"\n        },\n        {\n            \"question\": \"How do you create a list in Python?\",\n            \"answer\": \"You create a list in Python by placing comma-separated values inside square brackets, like this: my_list = [1, 2, 3, 4].\"\n        }\n        // Add more questions and answers here\n    ]\n}\n```\n\n### Contributions\n\nContributions are welcome! If you have suggestions or improvements, feel free to open an issue or submit a pull request.\n\n### License\n\nThis project is licensed under the MIT License.\n\n---\n\nFeel free to customize and expand this README to better suit your project's needs.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumarlypoeta%2Fsimple_chat_bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fumarlypoeta%2Fsimple_chat_bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fumarlypoeta%2Fsimple_chat_bot/lists"}