111 lines
3.2 KiB
Markdown
111 lines
3.2 KiB
Markdown
# Elise2Bot - A Rule-Based Chat Bot
|
|
|
|

|
|
|
|
Elise2Bot is a simple rule-based chatbot inspired by the elise psychotherapist model. It engages in text-based conversations with users, offering responses based on predefined rules and patterns. This README provides an overview of the bot, its features, and instructions for running and customizing it.
|
|
|
|
## Features
|
|
|
|
- Keyword-based matching: Elise2Bot identifies keywords in user input and selects appropriate responses based on predefined rules.
|
|
- Pattern transformation: The bot applies rule-based transformations to user input to create contextually relevant responses.
|
|
- Memory queue: Elise2Bot maintains a memory queue to keep track of previous user inputs, enhancing the conversation's continuity.
|
|
- Fuzzy keyword matching: The bot employs the FuzzyWuzzy library to find the closest keyword in user input, allowing for more robust keyword recognition.
|
|
|
|
## Getting Started
|
|
|
|
### Prerequisites
|
|
|
|
Before running Elise2Bot, ensure you have the following installed:
|
|
|
|
- Python 3.x
|
|
- Required Python libraries (install them using `pip`):
|
|
- `fuzzywuzzy`
|
|
- `python-Levenshtein`
|
|
- `PyYAML`
|
|
- `rich`
|
|
|
|
### Installation
|
|
|
|
1. Clone this repository to your local machine:
|
|
|
|
```shell
|
|
git clone https://github.com/yourusername/elise2-bot.git
|
|
```
|
|
|
|
2. Navigate to the project directory:
|
|
|
|
```shell
|
|
cd elise-bot
|
|
```
|
|
|
|
3. Run the chatbot:
|
|
|
|
```shell
|
|
python main.py
|
|
```
|
|
|
|
### Usage
|
|
|
|
1. Start a conversation with Elise2Bot by typing a message after the prompt.
|
|
|
|
```
|
|
You: Hello, Elise!
|
|
```
|
|
|
|
2. Elise2Bot will respond based on predefined rules and patterns.
|
|
|
|
```
|
|
ELISE: Hi there! How can I help you?
|
|
```
|
|
|
|
3. Continue the conversation, and the bot will engage with you based on the context.
|
|
|
|
4. To exit the conversation, simply type 'quit.'
|
|
|
|
|
|
### Customization
|
|
|
|
You can customize Elise2Bot by modifying the YAML configuration file (`elise_rules.yaml`) to add new rules, keywords, and responses. Refer to the [Configuration](#configuration) section below for details on the YAML format.
|
|
|
|
## Configuration
|
|
|
|
The bots behavior is defined in the `elise_rules.yaml` configuration file. This file contains keywords and rules for generating responses. You can customize the bots responses by editing this file.
|
|
|
|
Example YAML configuration:
|
|
|
|
```yaml
|
|
keywords:
|
|
hello: 3
|
|
hi: 3
|
|
my: 2
|
|
# ... other keywords ...
|
|
|
|
rules:
|
|
hello:
|
|
- pattern: "hello*"
|
|
response: "Hi there! How can I help you?"
|
|
- pattern: "hello again*"
|
|
response: "Hello once more! What else is on your mind?"
|
|
# ... other rules ...
|
|
```
|
|
|
|
### Keywords
|
|
|
|
- The `keywords` section defines keywords used for matching user input. Each keyword is associated with a weight that determines its relevance in matching.
|
|
|
|
### Rules
|
|
|
|
- The `rules` section defines patterns and responses for the bot. Patterns are used to match user input, and responses are provided when a pattern is matched.
|
|
|
|
## License
|
|
|
|
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
|
|
|
|
## Acknowledgments
|
|
|
|
- Special thanks to the authors of the original elise psychotherapist model for inspiration.
|
|
|
|
## Contributing
|
|
|
|
Contributions are welcome! If you'd like to enhance or improve Elise2Bot, please open an issue or submit a pull request.
|