diff --git a/chatterbot/README.md b/chatterbot/README.md index 52c32dcd49..86ba33a432 100644 --- a/chatterbot/README.md +++ b/chatterbot/README.md @@ -8,36 +8,53 @@ Create and activate a [virtual environment](https://realpython.com/python-virtua $ python -m venv venv $ source venv/bin/activate (venv) $ python -m pip install -r requirements.txt +(venv) $ python -m spacy download en_core_web_sm ``` -Then you can navigate into the folder `source_code_final/` and train and start the interactive command-line interface chatbot by running `bot.py`: +Starting in `source_code_step_5/`, training is handled by a dedicated script, `trainer.py`, that reads from `chat.txt` and populates `db.sqlite3`. The interactive chatbot lives in `bot.py`: ```sh (venv) $ cd source_code_final +(venv) $ python trainer.py # (optional) retrain from chat.txt (venv) $ python bot.py ``` +A pretrained `db.sqlite3` is included in each step folder, so you can run `bot.py` right away without retraining. + After training, you'll see an interactive prompt that you can chat with: ```text > hi -🪴 Welcome, friend 🤗 -> thanks for the green welcome -🪴 I let you -> you let me be here? -🪴 It's a monsters! -> did you mean monstera? -🪴 The leafs that she had are getting dryer and dryer. But she’s also growing plenty of new ones -> who? -🪴 Do raindrops touch their leaves? -> very philosophical! -🪴 Lol -> ;) -🪴 I don't grow any crop at home -> no crops in pots -🪴 Ah, gotcha! +🪴 Hi! How's your day going so far? +> Do you talk to your plants? +🪴 I do! +> What do they like to hear? +🪴 Motivational speeches +> Do plants need sunlight? +🪴 Yes, most plants need sunlight to undergo photosynthesis, +which is how they make their own food. How's your indoor garden doing? ``` The bot will learn from the replies you give and improve its accuracy. You can quit the interactive prompt by typing any of the `exit_conditions` defined in `bot.py`. +## Folder Structure + You'll find the code for each step of the tutorial in a separate folder. The folders also include a SQLite database that contains the different phases of training at each step. Because of this, you can inspect the project at different stages and notice how it evolves when you add more data and interactions. + +- `source_code_step_1/` — minimal chatbot with no training +- `source_code_step_2/` — adds `ListTrainer` with a couple of sample exchanges +- `source_code_step_3/` — includes the WhatsApp `chat.txt` export +- `source_code_step_4/` — adds `cleaner.py` for preprocessing the chat export +- `source_code_step_5/` — splits training into `trainer.py` which trains on the cleaned chat data +- `source_code_step_6/` — adds a local LLM via `OllamaLogicAdapter` (requires Ollama) +- `source_code_final/` — same as step 6 + +## Using the Ollama integration (step 6 and final) + +Step 6 and the `source_code_final/` folder use ChatterBot's experimental [Ollama](https://ollama.com/) integration. To try it, [install Ollama](https://realpython.com/ollama/) on your system and pull a small model: + +```sh +$ ollama pull llama3.2:latest +``` + +Then run `bot.py` as usual. If you don't want to use Ollama, remove the `OllamaLogicAdapter` entry from the `logic_adapters` list in `bot.py`. diff --git a/chatterbot/requirements.txt b/chatterbot/requirements.txt index e34959c77e..413ba695f0 100644 --- a/chatterbot/requirements.txt +++ b/chatterbot/requirements.txt @@ -1,15 +1,50 @@ -ChatterBot==1.0.4 -chatterbot-corpus==1.2.0 -click==8.1.3 -joblib==1.1.0 -mathparse==0.1.2 -nltk==3.7 -Pint==0.19.2 -pymongo==3.12.3 -python-dateutil==2.7.5 -pytz==2022.2.1 -PyYAML==3.13 -regex==2022.9.11 -six==1.16.0 -SQLAlchemy==1.2.19 -tqdm==4.64.1 +annotated-doc==0.0.4 +annotated-types==0.7.0 +anyio==4.13.0 +blis==1.3.3 +catalogue==2.0.10 +certifi==2026.2.25 +charset-normalizer==3.4.7 +chatterbot==1.2.13 +click==8.3.2 +cloudpathlib==0.23.0 +confection==1.3.3 +cymem==2.0.13 +h11==0.16.0 +httpcore==1.0.9 +httpx==0.28.1 +idna==3.11 +jinja2==3.1.6 +markdown-it-py==4.0.0 +markupsafe==3.0.3 +mathparse==0.2.8 +mdurl==0.1.2 +murmurhash==1.0.15 +numpy==2.4.4 +ollama==0.6.1 +packaging==26.1 +preshed==3.0.13 +pydantic==2.13.2 +pydantic-core==2.46.2 +pygments==2.20.0 +python-dateutil==2.9.0.post0 +requests==2.33.1 +rich==15.0.0 +setuptools==82.0.1 +shellingham==1.5.4 +six==1.17.0 +smart-open==7.6.0 +spacy==3.8.13 +spacy-legacy==3.0.12 +spacy-loggers==1.0.5 +sqlalchemy==2.0.49 +srsly==2.5.3 +thinc==8.3.13 +tqdm==4.67.3 +typer==0.24.1 +typing-extensions==4.15.0 +typing-inspection==0.4.2 +urllib3==2.6.3 +wasabi==1.1.3 +weasel==1.0.0 +wrapt==2.1.2 diff --git a/chatterbot/source_code_final/bot.py b/chatterbot/source_code_final/bot.py index 7fbe51d93a..dd24be4e5b 100644 --- a/chatterbot/source_code_final/bot.py +++ b/chatterbot/source_code_final/bot.py @@ -1,15 +1,18 @@ -from chatterbot.trainers import ListTrainer -from cleaner import clean_corpus - from chatterbot import ChatBot -CORPUS_FILE = "chat.txt" - -chatbot = ChatBot("Chatpot") - -trainer = ListTrainer(chatbot) -cleaned_corpus = clean_corpus(CORPUS_FILE) -trainer.train(cleaned_corpus) +chatbot = ChatBot( + "Chatpot", + logic_adapters=[ + { + "import_path": "chatterbot.logic.BestMatch", + }, + { + "import_path": "chatterbot.logic.OllamaLogicAdapter", + "model": "llama3.2:latest", + "host": "http://localhost:11434", + }, + ], +) exit_conditions = (":q", "quit", "exit") while True: diff --git a/chatterbot/source_code_final/chat.txt b/chatterbot/source_code_final/chat.txt index b585737e91..dd585cc378 100644 --- a/chatterbot/source_code_final/chat.txt +++ b/chatterbot/source_code_final/chat.txt @@ -1,139 +1,139 @@ -9/15/22, 14:50 - Messages and calls are end-to-end encrypted. No one outside of this chat, not even WhatsApp, can read or listen to them. Tap to learn more. -9/15/22, 14:49 - Philipp: Hi Martin, Philipp here! -9/15/22, 14:50 - Philipp: I’m ready to talk about plants! -9/15/22, 14:51 - Martin: Oh that's great! -9/15/22, 14:52 - Martin: I've been waiting for a good convo about plants for a long time -9/15/22, 14:52 - Philipp: We all have. -9/15/22, 14:52 - Martin: Did you know they need water to grow? -9/15/22, 14:52 - Philipp: I always thought that love and music was more than enough -9/15/22, 14:53 - Philipp: But water makes sense -9/15/22, 14:53 - Martin: Do you talk to your plants? -9/15/22, 14:53 - Philipp: I do! -9/15/22, 14:53 - Philipp: Some of them even have names -9/15/22, 14:54 - Martin: What do they like to hear? -9/15/22, 14:54 - Philipp: Motivational speeches -9/15/22, 14:54 - Philipp: Or stories about plants that made it and are living outside now -9/15/22, 14:54 - Martin: Oohhh 🥲 -9/15/22, 14:54 - Martin: Are you training them for independence? -9/15/22, 14:56 - Philipp: Yeah! I want them to be strong and take care of themselves at some point -9/15/22, 14:56 - Martin: That's heroic! -9/15/22, 14:57 - Martin: Sounds like you're a great plant parent -9/15/22, 14:57 - Philipp: Do you have any plant care pro tips? -9/15/22, 14:58 - Martin: Ahh, idk i just leave them be... -9/15/22, 14:58 - Martin: They are doing ok but not great -9/15/22, 14:58 - Philipp: So they are independent already! -9/15/22, 14:58 - Martin: I guess one tip would be to get plants that don't need much :P -9/15/22, 14:58 - Philipp: Like plastic plants, for example? -9/15/22, 14:59 - Martin: Haha, yes! Get independent plants! -9/15/22, 14:59 - Martin: Plastic plants are the cream of the crop -9/15/22, 14:59 - Martin: I haven't graduated to plastic plants yet -9/15/22, 14:59 - Philipp: Cream of the crop? -9/15/22, 15:00 - Philipp: I don't know what this means -9/15/22, 15:01 - Martin: Crop is a cultivated plant that is grown on a large scale commercially, especially a cereal, fruit, or vegetable -9/15/22, 15:01 - Martin: The cream must be the best of the best -9/15/22, 15:01 - Martin: Or maybe just all of it blended together? ;p -9/15/22, 15:02 - Martin: I don't grow any crop at home -9/15/22, 15:02 - Martin: And no cream, in case you wondered -9/15/22, 15:03 - Philipp: Ah, gotcha! -9/15/22, 15:03 - Philipp: Let me show you something! -9/15/22, 15:04 - Martin: I let you -9/15/22, 15:06 - Philipp: -9/15/22, 15:06 - Martin: It's a monsters! -9/15/22, 15:07 - Martin: Monstera* (auto correct...) -9/15/22, 15:07 - Philipp: I’m currently running an experiment of keeping my Monstera on the balcony -9/15/22, 15:07 - Martin: A monstera and a fluffy little monster -9/15/22, 15:07 - Philipp: Haha, yeah, hard to tell which is which -9/15/22, 15:07 - Martin: How has it been going with the monstera on the balcony? -9/15/22, 15:08 - Martin: I've tried that too over the summer -9/15/22, 15:08 - Philipp: Pretty bad -9/15/22, 15:08 - Martin: Oh really? -9/15/22, 15:08 - Martin: What happened? -9/15/22, 15:08 - Philipp: Yeah -9/15/22, 15:08 - Philipp: I mean … it’s weird. -9/15/22, 15:08 - Philipp: The leafs that she had are getting dryer and dryer. But she’s also growing plenty of new ones -9/15/22, 15:09 - Philipp: It‘s like she’s changing her summer jacket to a winter jacket -9/15/22, 15:13 - Martin: Yeah something similar happened to ours -9/15/22, 15:14 - Martin: It had thrips over the winter, so we needed to get rid of them -9/15/22, 15:14 - Philipp: Ah, thrips are those tiny little beasts that eat your plants, aren't they? -9/15/22, 15:15 - Martin: Thought that the balcony time would help get rid of them -9/15/22, 15:15 - Martin: Yeah they are horrible, really cute and tiny and deadly -9/15/22, 15:16 - Martin: Most of the monstera's leaves died, but now there are new ones coming -9/15/22, 15:16 - Martin: I think it's the amount of light, they need different leaves for stronger sunlight -9/15/22, 15:17 - Philipp: Do you have any other approaches to get rid of tiny monsters? -9/15/22, 15:17 - Philipp: (Except putting the plant on the balcony) -9/15/22, 15:17 - Martin: Tiny monstera's? -9/15/22, 15:17 - Philipp: Handling tiny monsters to grow big monsteras -9/15/22, 15:17 - Martin: Haha -9/15/22, 15:17 - Martin: Well, no. Just the balcony. This worked best -9/15/22, 15:18 - Martin: We tried applying soapy water -9/15/22, 15:18 - Martin: Which is a suggestion -9/15/22, 15:18 - Martin: And it keeps them a bit in check, but you can't get totally rid of them -9/15/22, 15:18 - Philipp: 10/10 thrips don't like this simple trick 😅 -9/15/22, 15:18 - Philipp: Oh, okay -9/15/22, 15:18 - Philipp: 8/10 thrips don't like this simple trick -9/15/22, 15:18 - Martin: I really hope they're gone now 🤞 -9/15/22, 15:18 - Martin: Lol -9/15/22, 15:19 - Martin: It's depressing when lil monstera keeps making new leaves for them just to get infected 😢 -9/15/22, 15:19 - Philipp: Yeah, nature can be harsh -9/15/22, 15:20 - Martin: Ah yes, it's a slightly strange rendering of nature though, if it's about potted plants -9/15/22, 15:20 - Martin: I feel like they could handle it better out in the wild -9/15/22, 15:21 - Martin: Good that you're making yours strong enough to leave eventually! -9/15/22, 15:22 - Philipp: For the other plants, my words help them to grow -9/15/22, 15:22 - Philipp: Inside and outside -9/15/22, 15:22 - Martin: What are the magic words? -9/15/22, 15:23 - Martin: Wait, do you make *all* plants grow??? -9/15/22, 15:24 - Philipp: Grow hastily, grow healthily, grow heartily 🪄✨🌱 -9/15/22, 15:24 - Philipp: Do you not make all your plants grow? -9/15/22, 15:24 - Martin: :)) -9/15/22, 15:25 - Martin: What do you consider 'your plants'? -9/15/22, 15:28 - Philipp: Oh, now I understand! -9/15/22, 15:29 - Philipp: I only considered the plants that live in my apartment (or my balcony) as the plant-spell-receiving plants -9/15/22, 15:29 - Philipp: But maybe they share the words? -9/15/22, 15:30 - Martin: Do raindrops touch their leaves? -9/15/22, 15:30 - Martin: I'm sure they chat with the other plants if they can -9/15/22, 15:31 - Philipp: Yeah, I heard that trees communicate in the woods with their roots -9/15/22, 15:31 - Philipp: But thinking about that makes me feel bad that my plants are potted 😬 -9/15/22, 15:31 - Martin: 😢 -9/15/22, 15:32 - Martin: Yeah... -9/15/22, 15:32 - Martin: The trees use mushrooms mycelium in the ground that's hooked to their roots to chat -9/15/22, 15:32 - Martin: Pretty cool 😎 -9/15/22, 15:33 - Martin: So i also have a Pilea -9/15/22, 15:33 - Martin: And some basil plants -9/15/22, 15:33 - Philipp: Do you have a photo of the Pilea? I don't know how it looks -9/15/22, 15:34 - Martin: And a peace lily -9/15/22, 15:34 - Martin: https://en.m.wikipedia.org/wiki/Pilea_peperomioides -9/15/22, 15:47 - Philipp: Oh, the Pilea looks cool! -9/15/22, 15:47 - Philipp: The leaves are like small umbrellas -9/15/22, 15:48 - Philipp: Did you actually manage to keep a supermarket basil alive or did you grow it yourself? -9/15/22, 16:28 - Martin: that's quite a story! -9/15/22, 16:28 - Martin: my dad had a flowering basil last year and put the seeds from that one plant into seeding pots -9/15/22, 16:29 - Martin: so many of them came up that he had about two dining room tables full of basil plants, each in their own pots... -9/15/22, 16:29 - Martin: i got three of them, so they are second gen supermarket basils with lots of siblings :) -9/15/22, 20:58 - Philipp: I always thought supermarket basil was meant to die after a few days -9/15/22, 20:58 - Philipp: But it seems it was my subpar care -9/15/22, 20:59 - Philipp: Congratulations to your basil dynasty! -9/16/22, 06:11 - Martin: Thanks! -9/16/22, 06:12 - Martin: Kudos go mostly to my dad -9/16/22, 06:12 - Martin: But you can bring them through winter -9/16/22, 06:12 - Martin: If there's no thrip infestation... -9/16/22, 06:34 - Martin: -9/16/22, 06:34 - Martin: -9/16/22, 06:35 - Martin: -9/16/22, 06:35 - Martin: Morning view of most of my house plants -9/16/22, 09:44 - Philipp: Fingers crossed 🤞 -9/16/22, 09:45 - Philipp: Are the ones on top avocados? -9/16/22, 09:53 - Martin: Yes, there are a couple of seedlings that wanted to live -9/16/22, 09:54 - Martin: Two more on the balcony of a similar size -9/16/22, 09:54 - Martin: And another seed that's one it's way 🤷‍♂️ -9/16/22, 09:55 - Philipp: I heard that it’s not easy to raise an Avodaco! -9/16/22, 09:55 - Martin: I haven't even heard of Avodacos! -9/16/22, 09:56 - Philipp: Wait, weren’t we talking about avocados? -9/16/22, 09:56 - Martin: Ah yes avocados 🥑! -9/16/22, 09:57 - Martin: I was just joking, riffing based on your typo 😝 -9/16/22, 09:57 - Philipp: Ooh! I was wondering why there was a red line under that word -9/16/22, 09:57 - Martin: Do you think there are avotacos? 🥑🌮 -9/16/22, 09:57 - Philipp: But I like that term, too -9/16/22, 09:58 - Philipp: 😂 -9/16/22, 09:58 - Philipp: If this is not a common term, then I want to make it common! -9/16/22, 09:59 - Martin: Maybe growing an avotaco plant would be a plant symbiosis between an avocado tree and some corn plants? -9/16/22, 10:19 - Philipp: Sounds like the perfect experiment! +1/15/26, 14:50 - Messages and calls are end-to-end encrypted. No one outside of this chat, not even WhatsApp, can read or listen to them. Tap to learn more. +1/15/26, 14:49 - Philipp: Hi Martin, Philipp here! +1/15/26, 14:50 - Philipp: I’m ready to talk about plants! +1/15/26, 14:51 - Martin: Oh that's great! +1/15/26, 14:52 - Martin: I've been waiting for a good convo about plants for a long time +1/15/26, 14:52 - Philipp: We all have. +1/15/26, 14:52 - Martin: Did you know they need water to grow? +1/15/26, 14:52 - Philipp: I always thought that love and music was more than enough +1/15/26, 14:53 - Philipp: But water makes sense +1/15/26, 14:53 - Martin: Do you talk to your plants? +1/15/26, 14:53 - Philipp: I do! +1/15/26, 14:53 - Philipp: Some of them even have names +1/15/26, 14:54 - Martin: What do they like to hear? +1/15/26, 14:54 - Philipp: Motivational speeches +1/15/26, 14:54 - Philipp: Or stories about plants that made it and are living outside now +1/15/26, 14:54 - Martin: Oohhh 🥲 +1/15/26, 14:54 - Martin: Are you training them for independence? +1/15/26, 14:56 - Philipp: Yeah! I want them to be strong and take care of themselves at some point +1/15/26, 14:56 - Martin: That's heroic! +1/15/26, 14:57 - Martin: Sounds like you're a great plant parent +1/15/26, 14:57 - Philipp: Do you have any plant care pro tips? +1/15/26, 14:58 - Martin: Ahh, idk i just leave them be... +1/15/26, 14:58 - Martin: They are doing ok but not great +1/15/26, 14:58 - Philipp: So they are independent already! +1/15/26, 14:58 - Martin: I guess one tip would be to get plants that don't need much :P +1/15/26, 14:58 - Philipp: Like plastic plants, for example? +1/15/26, 14:59 - Martin: Haha, yes! Get independent plants! +1/15/26, 14:59 - Martin: Plastic plants are the cream of the crop +1/15/26, 14:59 - Martin: I haven't graduated to plastic plants yet +1/15/26, 14:59 - Philipp: Cream of the crop? +1/15/26, 15:00 - Philipp: I don't know what this means +1/15/26, 15:01 - Martin: Crop is a cultivated plant that is grown on a large scale commercially, especially a cereal, fruit, or vegetable +1/15/26, 15:01 - Martin: The cream must be the best of the best +1/15/26, 15:01 - Martin: Or maybe just all of it blended together? ;p +1/15/26, 15:02 - Martin: I don't grow any crop at home +1/15/26, 15:02 - Martin: And no cream, in case you wondered +1/15/26, 15:03 - Philipp: Ah, gotcha! +1/15/26, 15:03 - Philipp: Let me show you something! +1/15/26, 15:04 - Martin: I let you +1/15/26, 15:06 - Philipp: +1/15/26, 15:06 - Martin: It's a monsters! +1/15/26, 15:07 - Martin: Monstera* (auto correct...) +1/15/26, 15:07 - Philipp: I’m currently running an experiment of keeping my Monstera on the balcony +1/15/26, 15:07 - Martin: A monstera and a fluffy little monster +1/15/26, 15:07 - Philipp: Haha, yeah, hard to tell which is which +1/15/26, 15:07 - Martin: How has it been going with the monstera on the balcony? +1/15/26, 15:08 - Martin: I've tried that too over the summer +1/15/26, 15:08 - Philipp: Pretty bad +1/15/26, 15:08 - Martin: Oh really? +1/15/26, 15:08 - Martin: What happened? +1/15/26, 15:08 - Philipp: Yeah +1/15/26, 15:08 - Philipp: I mean … it’s weird. +1/15/26, 15:08 - Philipp: The leafs that she had are getting dryer and dryer. But she’s also growing plenty of new ones +1/15/26, 15:09 - Philipp: It‘s like she’s changing her summer jacket to a winter jacket +1/15/26, 15:13 - Martin: Yeah something similar happened to ours +1/15/26, 15:14 - Martin: It had thrips over the winter, so we needed to get rid of them +1/15/26, 15:14 - Philipp: Ah, thrips are those tiny little beasts that eat your plants, aren't they? +1/15/26, 15:15 - Martin: Thought that the balcony time would help get rid of them +1/15/26, 15:15 - Martin: Yeah they are horrible, really cute and tiny and deadly +1/15/26, 15:16 - Martin: Most of the monstera's leaves died, but now there are new ones coming +1/15/26, 15:16 - Martin: I think it's the amount of light, they need different leaves for stronger sunlight +1/15/26, 15:17 - Philipp: Do you have any other approaches to get rid of tiny monsters? +1/15/26, 15:17 - Philipp: (Except putting the plant on the balcony) +1/15/26, 15:17 - Martin: Tiny monstera's? +1/15/26, 15:17 - Philipp: Handling tiny monsters to grow big monsteras +1/15/26, 15:17 - Martin: Haha +1/15/26, 15:17 - Martin: Well, no. Just the balcony. This worked best +1/15/26, 15:18 - Martin: We tried applying soapy water +1/15/26, 15:18 - Martin: Which is a suggestion +1/15/26, 15:18 - Martin: And it keeps them a bit in check, but you can't get totally rid of them +1/15/26, 15:18 - Philipp: 10/10 thrips don't like this simple trick 😅 +1/15/26, 15:18 - Philipp: Oh, okay +1/15/26, 15:18 - Philipp: 8/10 thrips don't like this simple trick +1/15/26, 15:18 - Martin: I really hope they're gone now 🤞 +1/15/26, 15:18 - Martin: Lol +1/15/26, 15:19 - Martin: It's depressing when lil monstera keeps making new leaves for them just to get infected 😢 +1/15/26, 15:19 - Philipp: Yeah, nature can be harsh +1/15/26, 15:20 - Martin: Ah yes, it's a slightly strange rendering of nature though, if it's about potted plants +1/15/26, 15:20 - Martin: I feel like they could handle it better out in the wild +1/15/26, 15:21 - Martin: Good that you're making yours strong enough to leave eventually! +1/15/26, 15:22 - Philipp: For the other plants, my words help them to grow +1/15/26, 15:22 - Philipp: Inside and outside +1/15/26, 15:22 - Martin: What are the magic words? +1/15/26, 15:23 - Martin: Wait, do you make *all* plants grow??? +1/15/26, 15:24 - Philipp: Grow hastily, grow healthily, grow heartily 🪄✨🌱 +1/15/26, 15:24 - Philipp: Do you not make all your plants grow? +1/15/26, 15:24 - Martin: :)) +1/15/26, 15:25 - Martin: What do you consider 'your plants'? +1/15/26, 15:28 - Philipp: Oh, now I understand! +1/15/26, 15:29 - Philipp: I only considered the plants that live in my apartment (or my balcony) as the plant-spell-receiving plants +1/15/26, 15:29 - Philipp: But maybe they share the words? +1/15/26, 15:30 - Martin: Do raindrops touch their leaves? +1/15/26, 15:30 - Martin: I'm sure they chat with the other plants if they can +1/15/26, 15:31 - Philipp: Yeah, I heard that trees communicate in the woods with their roots +1/15/26, 15:31 - Philipp: But thinking about that makes me feel bad that my plants are potted 😬 +1/15/26, 15:31 - Martin: 😢 +1/15/26, 15:32 - Martin: Yeah... +1/15/26, 15:32 - Martin: The trees use mushrooms mycelium in the ground that's hooked to their roots to chat +1/15/26, 15:32 - Martin: Pretty cool 😎 +1/15/26, 15:33 - Martin: So i also have a Pilea +1/15/26, 15:33 - Martin: And some basil plants +1/15/26, 15:33 - Philipp: Do you have a photo of the Pilea? I don't know how it looks +1/15/26, 15:34 - Martin: And a peace lily +1/15/26, 15:34 - Martin: https://en.m.wikipedia.org/wiki/Pilea_peperomioides +1/15/26, 15:47 - Philipp: Oh, the Pilea looks cool! +1/15/26, 15:47 - Philipp: The leaves are like small umbrellas +1/15/26, 15:48 - Philipp: Did you actually manage to keep a supermarket basil alive or did you grow it yourself? +1/15/26, 16:28 - Martin: that's quite a story! +1/15/26, 16:28 - Martin: my dad had a flowering basil last year and put the seeds from that one plant into seeding pots +1/15/26, 16:29 - Martin: so many of them came up that he had about two dining room tables full of basil plants, each in their own pots... +1/15/26, 16:29 - Martin: i got three of them, so they are second gen supermarket basils with lots of siblings :) +1/15/26, 20:58 - Philipp: I always thought supermarket basil was meant to die after a few days +1/15/26, 20:58 - Philipp: But it seems it was my subpar care +1/15/26, 20:59 - Philipp: Congratulations to your basil dynasty! +1/16/26, 06:11 - Martin: Thanks! +1/16/26, 06:12 - Martin: Kudos go mostly to my dad +1/16/26, 06:12 - Martin: But you can bring them through winter +1/16/26, 06:12 - Martin: If there's no thrip infestation... +1/16/26, 06:34 - Martin: +1/16/26, 06:34 - Martin: +1/16/26, 06:35 - Martin: +1/16/26, 06:35 - Martin: Morning view of most of my house plants +1/16/26, 09:44 - Philipp: Fingers crossed 🤞 +1/16/26, 09:45 - Philipp: Are the ones on top avocados? +1/16/26, 09:53 - Martin: Yes, there are a couple of seedlings that wanted to live +1/16/26, 09:54 - Martin: Two more on the balcony of a similar size +1/16/26, 09:54 - Martin: And another seed that's one it's way 🤷‍♂️ +1/16/26, 09:55 - Philipp: I heard that it’s not easy to raise an Avodaco! +1/16/26, 09:55 - Martin: I haven't even heard of Avodacos! +1/16/26, 09:56 - Philipp: Wait, weren’t we talking about avocados? +1/16/26, 09:56 - Martin: Ah yes avocados 🥑! +1/16/26, 09:57 - Martin: I was just joking, riffing based on your typo 😝 +1/16/26, 09:57 - Philipp: Ooh! I was wondering why there was a red line under that word +1/16/26, 09:57 - Martin: Do you think there are avotacos? 🥑🌮 +1/16/26, 09:57 - Philipp: But I like that term, too +1/16/26, 09:58 - Philipp: 😂 +1/16/26, 09:58 - Philipp: If this is not a common term, then I want to make it common! +1/16/26, 09:59 - Martin: Maybe growing an avotaco plant would be a plant symbiosis between an avocado tree and some corn plants? +1/16/26, 10:19 - Philipp: Sounds like the perfect experiment! diff --git a/chatterbot/source_code_final/cleaner.py b/chatterbot/source_code_final/cleaner.py index 4654709549..72c534a5ba 100644 --- a/chatterbot/source_code_final/cleaner.py +++ b/chatterbot/source_code_final/cleaner.py @@ -15,7 +15,7 @@ def remove_chat_metadata(chat_export_file): date time username message --------------------------------------- - 8/26/22, 17:47 - Jane Doe: Message text + 1/16/26, 06:34 - Jane Doe: Message text This function removes all the metadata up to the text of each message. @@ -25,7 +25,7 @@ def remove_chat_metadata(chat_export_file): Returns: tuple: The text of each message in the conversation """ - date_time = r"(\d+\/\d+\/\d+,\s\d+:\d+)" # e.g. "8/26/22, 17:47" + date_time = r"(\d+\/\d+\/\d+,\s\d+:\d+)" # e.g. "1/16/26, 06:34" dash_whitespace = r"\s-\s" # " - " username = r"([\w\s]+)" # e.g. "Jane Doe" metadata_end = r":\s" # ": " diff --git a/chatterbot/source_code_final/db.sqlite3 b/chatterbot/source_code_final/db.sqlite3 index 7bacb6d6c6..5476f3160b 100644 Binary files a/chatterbot/source_code_final/db.sqlite3 and b/chatterbot/source_code_final/db.sqlite3 differ diff --git a/chatterbot/source_code_final/db.sqlite3-shm b/chatterbot/source_code_final/db.sqlite3-shm deleted file mode 100644 index c44e586605..0000000000 Binary files a/chatterbot/source_code_final/db.sqlite3-shm and /dev/null differ diff --git a/chatterbot/source_code_final/db.sqlite3-wal b/chatterbot/source_code_final/db.sqlite3-wal deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/chatterbot/source_code_final/trainer.py b/chatterbot/source_code_final/trainer.py new file mode 100644 index 0000000000..6b95736f43 --- /dev/null +++ b/chatterbot/source_code_final/trainer.py @@ -0,0 +1,10 @@ +from chatterbot import ChatBot +from chatterbot.trainers import ListTrainer +from cleaner import clean_corpus + +CORPUS_FILE = "chat.txt" + +chatbot = ChatBot("Chatpot") +trainer = ListTrainer(chatbot) +cleaned_corpus = clean_corpus(CORPUS_FILE) +trainer.train(cleaned_corpus) diff --git a/chatterbot/source_code_step_1/db.sqlite3 b/chatterbot/source_code_step_1/db.sqlite3 index e6e77e67b3..a70be118d2 100644 Binary files a/chatterbot/source_code_step_1/db.sqlite3 and b/chatterbot/source_code_step_1/db.sqlite3 differ diff --git a/chatterbot/source_code_step_1/db.sqlite3-shm b/chatterbot/source_code_step_1/db.sqlite3-shm deleted file mode 100644 index fe9ac2845e..0000000000 Binary files a/chatterbot/source_code_step_1/db.sqlite3-shm and /dev/null differ diff --git a/chatterbot/source_code_step_1/db.sqlite3-wal b/chatterbot/source_code_step_1/db.sqlite3-wal deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/chatterbot/source_code_step_2/bot.py b/chatterbot/source_code_step_2/bot.py index 941882289a..b21489c283 100644 --- a/chatterbot/source_code_step_2/bot.py +++ b/chatterbot/source_code_step_2/bot.py @@ -1,12 +1,21 @@ -from chatterbot.trainers import ListTrainer - from chatterbot import ChatBot +from chatterbot.trainers import ListTrainer chatbot = ChatBot("Chatpot") trainer = ListTrainer(chatbot) -trainer.train(["Hi", "Welcome, friend 🤗"]) -trainer.train(["Are you a plant?", "No, I'm the pot below the plant!"]) +trainer.train( + [ + "Hi", + "Welcome, friend 🤗", + ] +) +trainer.train( + [ + "Are you a plant?", + "No, I'm the pot below the plant!", + ] +) exit_conditions = (":q", "quit", "exit") while True: diff --git a/chatterbot/source_code_step_2/db.sqlite3 b/chatterbot/source_code_step_2/db.sqlite3 index 8cd445d904..620099581b 100644 Binary files a/chatterbot/source_code_step_2/db.sqlite3 and b/chatterbot/source_code_step_2/db.sqlite3 differ diff --git a/chatterbot/source_code_step_2/db.sqlite3-shm b/chatterbot/source_code_step_2/db.sqlite3-shm deleted file mode 100644 index fe9ac2845e..0000000000 Binary files a/chatterbot/source_code_step_2/db.sqlite3-shm and /dev/null differ diff --git a/chatterbot/source_code_step_2/db.sqlite3-wal b/chatterbot/source_code_step_2/db.sqlite3-wal deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/chatterbot/source_code_step_3/bot.py b/chatterbot/source_code_step_3/bot.py index 941882289a..b21489c283 100644 --- a/chatterbot/source_code_step_3/bot.py +++ b/chatterbot/source_code_step_3/bot.py @@ -1,12 +1,21 @@ -from chatterbot.trainers import ListTrainer - from chatterbot import ChatBot +from chatterbot.trainers import ListTrainer chatbot = ChatBot("Chatpot") trainer = ListTrainer(chatbot) -trainer.train(["Hi", "Welcome, friend 🤗"]) -trainer.train(["Are you a plant?", "No, I'm the pot below the plant!"]) +trainer.train( + [ + "Hi", + "Welcome, friend 🤗", + ] +) +trainer.train( + [ + "Are you a plant?", + "No, I'm the pot below the plant!", + ] +) exit_conditions = (":q", "quit", "exit") while True: diff --git a/chatterbot/source_code_step_3/chat.txt b/chatterbot/source_code_step_3/chat.txt index b585737e91..dd585cc378 100644 --- a/chatterbot/source_code_step_3/chat.txt +++ b/chatterbot/source_code_step_3/chat.txt @@ -1,139 +1,139 @@ -9/15/22, 14:50 - Messages and calls are end-to-end encrypted. No one outside of this chat, not even WhatsApp, can read or listen to them. Tap to learn more. -9/15/22, 14:49 - Philipp: Hi Martin, Philipp here! -9/15/22, 14:50 - Philipp: I’m ready to talk about plants! -9/15/22, 14:51 - Martin: Oh that's great! -9/15/22, 14:52 - Martin: I've been waiting for a good convo about plants for a long time -9/15/22, 14:52 - Philipp: We all have. -9/15/22, 14:52 - Martin: Did you know they need water to grow? -9/15/22, 14:52 - Philipp: I always thought that love and music was more than enough -9/15/22, 14:53 - Philipp: But water makes sense -9/15/22, 14:53 - Martin: Do you talk to your plants? -9/15/22, 14:53 - Philipp: I do! -9/15/22, 14:53 - Philipp: Some of them even have names -9/15/22, 14:54 - Martin: What do they like to hear? -9/15/22, 14:54 - Philipp: Motivational speeches -9/15/22, 14:54 - Philipp: Or stories about plants that made it and are living outside now -9/15/22, 14:54 - Martin: Oohhh 🥲 -9/15/22, 14:54 - Martin: Are you training them for independence? -9/15/22, 14:56 - Philipp: Yeah! I want them to be strong and take care of themselves at some point -9/15/22, 14:56 - Martin: That's heroic! -9/15/22, 14:57 - Martin: Sounds like you're a great plant parent -9/15/22, 14:57 - Philipp: Do you have any plant care pro tips? -9/15/22, 14:58 - Martin: Ahh, idk i just leave them be... -9/15/22, 14:58 - Martin: They are doing ok but not great -9/15/22, 14:58 - Philipp: So they are independent already! -9/15/22, 14:58 - Martin: I guess one tip would be to get plants that don't need much :P -9/15/22, 14:58 - Philipp: Like plastic plants, for example? -9/15/22, 14:59 - Martin: Haha, yes! Get independent plants! -9/15/22, 14:59 - Martin: Plastic plants are the cream of the crop -9/15/22, 14:59 - Martin: I haven't graduated to plastic plants yet -9/15/22, 14:59 - Philipp: Cream of the crop? -9/15/22, 15:00 - Philipp: I don't know what this means -9/15/22, 15:01 - Martin: Crop is a cultivated plant that is grown on a large scale commercially, especially a cereal, fruit, or vegetable -9/15/22, 15:01 - Martin: The cream must be the best of the best -9/15/22, 15:01 - Martin: Or maybe just all of it blended together? ;p -9/15/22, 15:02 - Martin: I don't grow any crop at home -9/15/22, 15:02 - Martin: And no cream, in case you wondered -9/15/22, 15:03 - Philipp: Ah, gotcha! -9/15/22, 15:03 - Philipp: Let me show you something! -9/15/22, 15:04 - Martin: I let you -9/15/22, 15:06 - Philipp: -9/15/22, 15:06 - Martin: It's a monsters! -9/15/22, 15:07 - Martin: Monstera* (auto correct...) -9/15/22, 15:07 - Philipp: I’m currently running an experiment of keeping my Monstera on the balcony -9/15/22, 15:07 - Martin: A monstera and a fluffy little monster -9/15/22, 15:07 - Philipp: Haha, yeah, hard to tell which is which -9/15/22, 15:07 - Martin: How has it been going with the monstera on the balcony? -9/15/22, 15:08 - Martin: I've tried that too over the summer -9/15/22, 15:08 - Philipp: Pretty bad -9/15/22, 15:08 - Martin: Oh really? -9/15/22, 15:08 - Martin: What happened? -9/15/22, 15:08 - Philipp: Yeah -9/15/22, 15:08 - Philipp: I mean … it’s weird. -9/15/22, 15:08 - Philipp: The leafs that she had are getting dryer and dryer. But she’s also growing plenty of new ones -9/15/22, 15:09 - Philipp: It‘s like she’s changing her summer jacket to a winter jacket -9/15/22, 15:13 - Martin: Yeah something similar happened to ours -9/15/22, 15:14 - Martin: It had thrips over the winter, so we needed to get rid of them -9/15/22, 15:14 - Philipp: Ah, thrips are those tiny little beasts that eat your plants, aren't they? -9/15/22, 15:15 - Martin: Thought that the balcony time would help get rid of them -9/15/22, 15:15 - Martin: Yeah they are horrible, really cute and tiny and deadly -9/15/22, 15:16 - Martin: Most of the monstera's leaves died, but now there are new ones coming -9/15/22, 15:16 - Martin: I think it's the amount of light, they need different leaves for stronger sunlight -9/15/22, 15:17 - Philipp: Do you have any other approaches to get rid of tiny monsters? -9/15/22, 15:17 - Philipp: (Except putting the plant on the balcony) -9/15/22, 15:17 - Martin: Tiny monstera's? -9/15/22, 15:17 - Philipp: Handling tiny monsters to grow big monsteras -9/15/22, 15:17 - Martin: Haha -9/15/22, 15:17 - Martin: Well, no. Just the balcony. This worked best -9/15/22, 15:18 - Martin: We tried applying soapy water -9/15/22, 15:18 - Martin: Which is a suggestion -9/15/22, 15:18 - Martin: And it keeps them a bit in check, but you can't get totally rid of them -9/15/22, 15:18 - Philipp: 10/10 thrips don't like this simple trick 😅 -9/15/22, 15:18 - Philipp: Oh, okay -9/15/22, 15:18 - Philipp: 8/10 thrips don't like this simple trick -9/15/22, 15:18 - Martin: I really hope they're gone now 🤞 -9/15/22, 15:18 - Martin: Lol -9/15/22, 15:19 - Martin: It's depressing when lil monstera keeps making new leaves for them just to get infected 😢 -9/15/22, 15:19 - Philipp: Yeah, nature can be harsh -9/15/22, 15:20 - Martin: Ah yes, it's a slightly strange rendering of nature though, if it's about potted plants -9/15/22, 15:20 - Martin: I feel like they could handle it better out in the wild -9/15/22, 15:21 - Martin: Good that you're making yours strong enough to leave eventually! -9/15/22, 15:22 - Philipp: For the other plants, my words help them to grow -9/15/22, 15:22 - Philipp: Inside and outside -9/15/22, 15:22 - Martin: What are the magic words? -9/15/22, 15:23 - Martin: Wait, do you make *all* plants grow??? -9/15/22, 15:24 - Philipp: Grow hastily, grow healthily, grow heartily 🪄✨🌱 -9/15/22, 15:24 - Philipp: Do you not make all your plants grow? -9/15/22, 15:24 - Martin: :)) -9/15/22, 15:25 - Martin: What do you consider 'your plants'? -9/15/22, 15:28 - Philipp: Oh, now I understand! -9/15/22, 15:29 - Philipp: I only considered the plants that live in my apartment (or my balcony) as the plant-spell-receiving plants -9/15/22, 15:29 - Philipp: But maybe they share the words? -9/15/22, 15:30 - Martin: Do raindrops touch their leaves? -9/15/22, 15:30 - Martin: I'm sure they chat with the other plants if they can -9/15/22, 15:31 - Philipp: Yeah, I heard that trees communicate in the woods with their roots -9/15/22, 15:31 - Philipp: But thinking about that makes me feel bad that my plants are potted 😬 -9/15/22, 15:31 - Martin: 😢 -9/15/22, 15:32 - Martin: Yeah... -9/15/22, 15:32 - Martin: The trees use mushrooms mycelium in the ground that's hooked to their roots to chat -9/15/22, 15:32 - Martin: Pretty cool 😎 -9/15/22, 15:33 - Martin: So i also have a Pilea -9/15/22, 15:33 - Martin: And some basil plants -9/15/22, 15:33 - Philipp: Do you have a photo of the Pilea? I don't know how it looks -9/15/22, 15:34 - Martin: And a peace lily -9/15/22, 15:34 - Martin: https://en.m.wikipedia.org/wiki/Pilea_peperomioides -9/15/22, 15:47 - Philipp: Oh, the Pilea looks cool! -9/15/22, 15:47 - Philipp: The leaves are like small umbrellas -9/15/22, 15:48 - Philipp: Did you actually manage to keep a supermarket basil alive or did you grow it yourself? -9/15/22, 16:28 - Martin: that's quite a story! -9/15/22, 16:28 - Martin: my dad had a flowering basil last year and put the seeds from that one plant into seeding pots -9/15/22, 16:29 - Martin: so many of them came up that he had about two dining room tables full of basil plants, each in their own pots... -9/15/22, 16:29 - Martin: i got three of them, so they are second gen supermarket basils with lots of siblings :) -9/15/22, 20:58 - Philipp: I always thought supermarket basil was meant to die after a few days -9/15/22, 20:58 - Philipp: But it seems it was my subpar care -9/15/22, 20:59 - Philipp: Congratulations to your basil dynasty! -9/16/22, 06:11 - Martin: Thanks! -9/16/22, 06:12 - Martin: Kudos go mostly to my dad -9/16/22, 06:12 - Martin: But you can bring them through winter -9/16/22, 06:12 - Martin: If there's no thrip infestation... -9/16/22, 06:34 - Martin: -9/16/22, 06:34 - Martin: -9/16/22, 06:35 - Martin: -9/16/22, 06:35 - Martin: Morning view of most of my house plants -9/16/22, 09:44 - Philipp: Fingers crossed 🤞 -9/16/22, 09:45 - Philipp: Are the ones on top avocados? -9/16/22, 09:53 - Martin: Yes, there are a couple of seedlings that wanted to live -9/16/22, 09:54 - Martin: Two more on the balcony of a similar size -9/16/22, 09:54 - Martin: And another seed that's one it's way 🤷‍♂️ -9/16/22, 09:55 - Philipp: I heard that it’s not easy to raise an Avodaco! -9/16/22, 09:55 - Martin: I haven't even heard of Avodacos! -9/16/22, 09:56 - Philipp: Wait, weren’t we talking about avocados? -9/16/22, 09:56 - Martin: Ah yes avocados 🥑! -9/16/22, 09:57 - Martin: I was just joking, riffing based on your typo 😝 -9/16/22, 09:57 - Philipp: Ooh! I was wondering why there was a red line under that word -9/16/22, 09:57 - Martin: Do you think there are avotacos? 🥑🌮 -9/16/22, 09:57 - Philipp: But I like that term, too -9/16/22, 09:58 - Philipp: 😂 -9/16/22, 09:58 - Philipp: If this is not a common term, then I want to make it common! -9/16/22, 09:59 - Martin: Maybe growing an avotaco plant would be a plant symbiosis between an avocado tree and some corn plants? -9/16/22, 10:19 - Philipp: Sounds like the perfect experiment! +1/15/26, 14:50 - Messages and calls are end-to-end encrypted. No one outside of this chat, not even WhatsApp, can read or listen to them. Tap to learn more. +1/15/26, 14:49 - Philipp: Hi Martin, Philipp here! +1/15/26, 14:50 - Philipp: I’m ready to talk about plants! +1/15/26, 14:51 - Martin: Oh that's great! +1/15/26, 14:52 - Martin: I've been waiting for a good convo about plants for a long time +1/15/26, 14:52 - Philipp: We all have. +1/15/26, 14:52 - Martin: Did you know they need water to grow? +1/15/26, 14:52 - Philipp: I always thought that love and music was more than enough +1/15/26, 14:53 - Philipp: But water makes sense +1/15/26, 14:53 - Martin: Do you talk to your plants? +1/15/26, 14:53 - Philipp: I do! +1/15/26, 14:53 - Philipp: Some of them even have names +1/15/26, 14:54 - Martin: What do they like to hear? +1/15/26, 14:54 - Philipp: Motivational speeches +1/15/26, 14:54 - Philipp: Or stories about plants that made it and are living outside now +1/15/26, 14:54 - Martin: Oohhh 🥲 +1/15/26, 14:54 - Martin: Are you training them for independence? +1/15/26, 14:56 - Philipp: Yeah! I want them to be strong and take care of themselves at some point +1/15/26, 14:56 - Martin: That's heroic! +1/15/26, 14:57 - Martin: Sounds like you're a great plant parent +1/15/26, 14:57 - Philipp: Do you have any plant care pro tips? +1/15/26, 14:58 - Martin: Ahh, idk i just leave them be... +1/15/26, 14:58 - Martin: They are doing ok but not great +1/15/26, 14:58 - Philipp: So they are independent already! +1/15/26, 14:58 - Martin: I guess one tip would be to get plants that don't need much :P +1/15/26, 14:58 - Philipp: Like plastic plants, for example? +1/15/26, 14:59 - Martin: Haha, yes! Get independent plants! +1/15/26, 14:59 - Martin: Plastic plants are the cream of the crop +1/15/26, 14:59 - Martin: I haven't graduated to plastic plants yet +1/15/26, 14:59 - Philipp: Cream of the crop? +1/15/26, 15:00 - Philipp: I don't know what this means +1/15/26, 15:01 - Martin: Crop is a cultivated plant that is grown on a large scale commercially, especially a cereal, fruit, or vegetable +1/15/26, 15:01 - Martin: The cream must be the best of the best +1/15/26, 15:01 - Martin: Or maybe just all of it blended together? ;p +1/15/26, 15:02 - Martin: I don't grow any crop at home +1/15/26, 15:02 - Martin: And no cream, in case you wondered +1/15/26, 15:03 - Philipp: Ah, gotcha! +1/15/26, 15:03 - Philipp: Let me show you something! +1/15/26, 15:04 - Martin: I let you +1/15/26, 15:06 - Philipp: +1/15/26, 15:06 - Martin: It's a monsters! +1/15/26, 15:07 - Martin: Monstera* (auto correct...) +1/15/26, 15:07 - Philipp: I’m currently running an experiment of keeping my Monstera on the balcony +1/15/26, 15:07 - Martin: A monstera and a fluffy little monster +1/15/26, 15:07 - Philipp: Haha, yeah, hard to tell which is which +1/15/26, 15:07 - Martin: How has it been going with the monstera on the balcony? +1/15/26, 15:08 - Martin: I've tried that too over the summer +1/15/26, 15:08 - Philipp: Pretty bad +1/15/26, 15:08 - Martin: Oh really? +1/15/26, 15:08 - Martin: What happened? +1/15/26, 15:08 - Philipp: Yeah +1/15/26, 15:08 - Philipp: I mean … it’s weird. +1/15/26, 15:08 - Philipp: The leafs that she had are getting dryer and dryer. But she’s also growing plenty of new ones +1/15/26, 15:09 - Philipp: It‘s like she’s changing her summer jacket to a winter jacket +1/15/26, 15:13 - Martin: Yeah something similar happened to ours +1/15/26, 15:14 - Martin: It had thrips over the winter, so we needed to get rid of them +1/15/26, 15:14 - Philipp: Ah, thrips are those tiny little beasts that eat your plants, aren't they? +1/15/26, 15:15 - Martin: Thought that the balcony time would help get rid of them +1/15/26, 15:15 - Martin: Yeah they are horrible, really cute and tiny and deadly +1/15/26, 15:16 - Martin: Most of the monstera's leaves died, but now there are new ones coming +1/15/26, 15:16 - Martin: I think it's the amount of light, they need different leaves for stronger sunlight +1/15/26, 15:17 - Philipp: Do you have any other approaches to get rid of tiny monsters? +1/15/26, 15:17 - Philipp: (Except putting the plant on the balcony) +1/15/26, 15:17 - Martin: Tiny monstera's? +1/15/26, 15:17 - Philipp: Handling tiny monsters to grow big monsteras +1/15/26, 15:17 - Martin: Haha +1/15/26, 15:17 - Martin: Well, no. Just the balcony. This worked best +1/15/26, 15:18 - Martin: We tried applying soapy water +1/15/26, 15:18 - Martin: Which is a suggestion +1/15/26, 15:18 - Martin: And it keeps them a bit in check, but you can't get totally rid of them +1/15/26, 15:18 - Philipp: 10/10 thrips don't like this simple trick 😅 +1/15/26, 15:18 - Philipp: Oh, okay +1/15/26, 15:18 - Philipp: 8/10 thrips don't like this simple trick +1/15/26, 15:18 - Martin: I really hope they're gone now 🤞 +1/15/26, 15:18 - Martin: Lol +1/15/26, 15:19 - Martin: It's depressing when lil monstera keeps making new leaves for them just to get infected 😢 +1/15/26, 15:19 - Philipp: Yeah, nature can be harsh +1/15/26, 15:20 - Martin: Ah yes, it's a slightly strange rendering of nature though, if it's about potted plants +1/15/26, 15:20 - Martin: I feel like they could handle it better out in the wild +1/15/26, 15:21 - Martin: Good that you're making yours strong enough to leave eventually! +1/15/26, 15:22 - Philipp: For the other plants, my words help them to grow +1/15/26, 15:22 - Philipp: Inside and outside +1/15/26, 15:22 - Martin: What are the magic words? +1/15/26, 15:23 - Martin: Wait, do you make *all* plants grow??? +1/15/26, 15:24 - Philipp: Grow hastily, grow healthily, grow heartily 🪄✨🌱 +1/15/26, 15:24 - Philipp: Do you not make all your plants grow? +1/15/26, 15:24 - Martin: :)) +1/15/26, 15:25 - Martin: What do you consider 'your plants'? +1/15/26, 15:28 - Philipp: Oh, now I understand! +1/15/26, 15:29 - Philipp: I only considered the plants that live in my apartment (or my balcony) as the plant-spell-receiving plants +1/15/26, 15:29 - Philipp: But maybe they share the words? +1/15/26, 15:30 - Martin: Do raindrops touch their leaves? +1/15/26, 15:30 - Martin: I'm sure they chat with the other plants if they can +1/15/26, 15:31 - Philipp: Yeah, I heard that trees communicate in the woods with their roots +1/15/26, 15:31 - Philipp: But thinking about that makes me feel bad that my plants are potted 😬 +1/15/26, 15:31 - Martin: 😢 +1/15/26, 15:32 - Martin: Yeah... +1/15/26, 15:32 - Martin: The trees use mushrooms mycelium in the ground that's hooked to their roots to chat +1/15/26, 15:32 - Martin: Pretty cool 😎 +1/15/26, 15:33 - Martin: So i also have a Pilea +1/15/26, 15:33 - Martin: And some basil plants +1/15/26, 15:33 - Philipp: Do you have a photo of the Pilea? I don't know how it looks +1/15/26, 15:34 - Martin: And a peace lily +1/15/26, 15:34 - Martin: https://en.m.wikipedia.org/wiki/Pilea_peperomioides +1/15/26, 15:47 - Philipp: Oh, the Pilea looks cool! +1/15/26, 15:47 - Philipp: The leaves are like small umbrellas +1/15/26, 15:48 - Philipp: Did you actually manage to keep a supermarket basil alive or did you grow it yourself? +1/15/26, 16:28 - Martin: that's quite a story! +1/15/26, 16:28 - Martin: my dad had a flowering basil last year and put the seeds from that one plant into seeding pots +1/15/26, 16:29 - Martin: so many of them came up that he had about two dining room tables full of basil plants, each in their own pots... +1/15/26, 16:29 - Martin: i got three of them, so they are second gen supermarket basils with lots of siblings :) +1/15/26, 20:58 - Philipp: I always thought supermarket basil was meant to die after a few days +1/15/26, 20:58 - Philipp: But it seems it was my subpar care +1/15/26, 20:59 - Philipp: Congratulations to your basil dynasty! +1/16/26, 06:11 - Martin: Thanks! +1/16/26, 06:12 - Martin: Kudos go mostly to my dad +1/16/26, 06:12 - Martin: But you can bring them through winter +1/16/26, 06:12 - Martin: If there's no thrip infestation... +1/16/26, 06:34 - Martin: +1/16/26, 06:34 - Martin: +1/16/26, 06:35 - Martin: +1/16/26, 06:35 - Martin: Morning view of most of my house plants +1/16/26, 09:44 - Philipp: Fingers crossed 🤞 +1/16/26, 09:45 - Philipp: Are the ones on top avocados? +1/16/26, 09:53 - Martin: Yes, there are a couple of seedlings that wanted to live +1/16/26, 09:54 - Martin: Two more on the balcony of a similar size +1/16/26, 09:54 - Martin: And another seed that's one it's way 🤷‍♂️ +1/16/26, 09:55 - Philipp: I heard that it’s not easy to raise an Avodaco! +1/16/26, 09:55 - Martin: I haven't even heard of Avodacos! +1/16/26, 09:56 - Philipp: Wait, weren’t we talking about avocados? +1/16/26, 09:56 - Martin: Ah yes avocados 🥑! +1/16/26, 09:57 - Martin: I was just joking, riffing based on your typo 😝 +1/16/26, 09:57 - Philipp: Ooh! I was wondering why there was a red line under that word +1/16/26, 09:57 - Martin: Do you think there are avotacos? 🥑🌮 +1/16/26, 09:57 - Philipp: But I like that term, too +1/16/26, 09:58 - Philipp: 😂 +1/16/26, 09:58 - Philipp: If this is not a common term, then I want to make it common! +1/16/26, 09:59 - Martin: Maybe growing an avotaco plant would be a plant symbiosis between an avocado tree and some corn plants? +1/16/26, 10:19 - Philipp: Sounds like the perfect experiment! diff --git a/chatterbot/source_code_step_3/db.sqlite3 b/chatterbot/source_code_step_3/db.sqlite3 index 8cd445d904..a7d3ae25ec 100644 Binary files a/chatterbot/source_code_step_3/db.sqlite3 and b/chatterbot/source_code_step_3/db.sqlite3 differ diff --git a/chatterbot/source_code_step_3/db.sqlite3-shm b/chatterbot/source_code_step_3/db.sqlite3-shm deleted file mode 100644 index fe9ac2845e..0000000000 Binary files a/chatterbot/source_code_step_3/db.sqlite3-shm and /dev/null differ diff --git a/chatterbot/source_code_step_3/db.sqlite3-wal b/chatterbot/source_code_step_3/db.sqlite3-wal deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/chatterbot/source_code_step_4/bot.py b/chatterbot/source_code_step_4/bot.py index 941882289a..b21489c283 100644 --- a/chatterbot/source_code_step_4/bot.py +++ b/chatterbot/source_code_step_4/bot.py @@ -1,12 +1,21 @@ -from chatterbot.trainers import ListTrainer - from chatterbot import ChatBot +from chatterbot.trainers import ListTrainer chatbot = ChatBot("Chatpot") trainer = ListTrainer(chatbot) -trainer.train(["Hi", "Welcome, friend 🤗"]) -trainer.train(["Are you a plant?", "No, I'm the pot below the plant!"]) +trainer.train( + [ + "Hi", + "Welcome, friend 🤗", + ] +) +trainer.train( + [ + "Are you a plant?", + "No, I'm the pot below the plant!", + ] +) exit_conditions = (":q", "quit", "exit") while True: diff --git a/chatterbot/source_code_step_4/chat.txt b/chatterbot/source_code_step_4/chat.txt index b585737e91..dd585cc378 100644 --- a/chatterbot/source_code_step_4/chat.txt +++ b/chatterbot/source_code_step_4/chat.txt @@ -1,139 +1,139 @@ -9/15/22, 14:50 - Messages and calls are end-to-end encrypted. No one outside of this chat, not even WhatsApp, can read or listen to them. Tap to learn more. -9/15/22, 14:49 - Philipp: Hi Martin, Philipp here! -9/15/22, 14:50 - Philipp: I’m ready to talk about plants! -9/15/22, 14:51 - Martin: Oh that's great! -9/15/22, 14:52 - Martin: I've been waiting for a good convo about plants for a long time -9/15/22, 14:52 - Philipp: We all have. -9/15/22, 14:52 - Martin: Did you know they need water to grow? -9/15/22, 14:52 - Philipp: I always thought that love and music was more than enough -9/15/22, 14:53 - Philipp: But water makes sense -9/15/22, 14:53 - Martin: Do you talk to your plants? -9/15/22, 14:53 - Philipp: I do! -9/15/22, 14:53 - Philipp: Some of them even have names -9/15/22, 14:54 - Martin: What do they like to hear? -9/15/22, 14:54 - Philipp: Motivational speeches -9/15/22, 14:54 - Philipp: Or stories about plants that made it and are living outside now -9/15/22, 14:54 - Martin: Oohhh 🥲 -9/15/22, 14:54 - Martin: Are you training them for independence? -9/15/22, 14:56 - Philipp: Yeah! I want them to be strong and take care of themselves at some point -9/15/22, 14:56 - Martin: That's heroic! -9/15/22, 14:57 - Martin: Sounds like you're a great plant parent -9/15/22, 14:57 - Philipp: Do you have any plant care pro tips? -9/15/22, 14:58 - Martin: Ahh, idk i just leave them be... -9/15/22, 14:58 - Martin: They are doing ok but not great -9/15/22, 14:58 - Philipp: So they are independent already! -9/15/22, 14:58 - Martin: I guess one tip would be to get plants that don't need much :P -9/15/22, 14:58 - Philipp: Like plastic plants, for example? -9/15/22, 14:59 - Martin: Haha, yes! Get independent plants! -9/15/22, 14:59 - Martin: Plastic plants are the cream of the crop -9/15/22, 14:59 - Martin: I haven't graduated to plastic plants yet -9/15/22, 14:59 - Philipp: Cream of the crop? -9/15/22, 15:00 - Philipp: I don't know what this means -9/15/22, 15:01 - Martin: Crop is a cultivated plant that is grown on a large scale commercially, especially a cereal, fruit, or vegetable -9/15/22, 15:01 - Martin: The cream must be the best of the best -9/15/22, 15:01 - Martin: Or maybe just all of it blended together? ;p -9/15/22, 15:02 - Martin: I don't grow any crop at home -9/15/22, 15:02 - Martin: And no cream, in case you wondered -9/15/22, 15:03 - Philipp: Ah, gotcha! -9/15/22, 15:03 - Philipp: Let me show you something! -9/15/22, 15:04 - Martin: I let you -9/15/22, 15:06 - Philipp: -9/15/22, 15:06 - Martin: It's a monsters! -9/15/22, 15:07 - Martin: Monstera* (auto correct...) -9/15/22, 15:07 - Philipp: I’m currently running an experiment of keeping my Monstera on the balcony -9/15/22, 15:07 - Martin: A monstera and a fluffy little monster -9/15/22, 15:07 - Philipp: Haha, yeah, hard to tell which is which -9/15/22, 15:07 - Martin: How has it been going with the monstera on the balcony? -9/15/22, 15:08 - Martin: I've tried that too over the summer -9/15/22, 15:08 - Philipp: Pretty bad -9/15/22, 15:08 - Martin: Oh really? -9/15/22, 15:08 - Martin: What happened? -9/15/22, 15:08 - Philipp: Yeah -9/15/22, 15:08 - Philipp: I mean … it’s weird. -9/15/22, 15:08 - Philipp: The leafs that she had are getting dryer and dryer. But she’s also growing plenty of new ones -9/15/22, 15:09 - Philipp: It‘s like she’s changing her summer jacket to a winter jacket -9/15/22, 15:13 - Martin: Yeah something similar happened to ours -9/15/22, 15:14 - Martin: It had thrips over the winter, so we needed to get rid of them -9/15/22, 15:14 - Philipp: Ah, thrips are those tiny little beasts that eat your plants, aren't they? -9/15/22, 15:15 - Martin: Thought that the balcony time would help get rid of them -9/15/22, 15:15 - Martin: Yeah they are horrible, really cute and tiny and deadly -9/15/22, 15:16 - Martin: Most of the monstera's leaves died, but now there are new ones coming -9/15/22, 15:16 - Martin: I think it's the amount of light, they need different leaves for stronger sunlight -9/15/22, 15:17 - Philipp: Do you have any other approaches to get rid of tiny monsters? -9/15/22, 15:17 - Philipp: (Except putting the plant on the balcony) -9/15/22, 15:17 - Martin: Tiny monstera's? -9/15/22, 15:17 - Philipp: Handling tiny monsters to grow big monsteras -9/15/22, 15:17 - Martin: Haha -9/15/22, 15:17 - Martin: Well, no. Just the balcony. This worked best -9/15/22, 15:18 - Martin: We tried applying soapy water -9/15/22, 15:18 - Martin: Which is a suggestion -9/15/22, 15:18 - Martin: And it keeps them a bit in check, but you can't get totally rid of them -9/15/22, 15:18 - Philipp: 10/10 thrips don't like this simple trick 😅 -9/15/22, 15:18 - Philipp: Oh, okay -9/15/22, 15:18 - Philipp: 8/10 thrips don't like this simple trick -9/15/22, 15:18 - Martin: I really hope they're gone now 🤞 -9/15/22, 15:18 - Martin: Lol -9/15/22, 15:19 - Martin: It's depressing when lil monstera keeps making new leaves for them just to get infected 😢 -9/15/22, 15:19 - Philipp: Yeah, nature can be harsh -9/15/22, 15:20 - Martin: Ah yes, it's a slightly strange rendering of nature though, if it's about potted plants -9/15/22, 15:20 - Martin: I feel like they could handle it better out in the wild -9/15/22, 15:21 - Martin: Good that you're making yours strong enough to leave eventually! -9/15/22, 15:22 - Philipp: For the other plants, my words help them to grow -9/15/22, 15:22 - Philipp: Inside and outside -9/15/22, 15:22 - Martin: What are the magic words? -9/15/22, 15:23 - Martin: Wait, do you make *all* plants grow??? -9/15/22, 15:24 - Philipp: Grow hastily, grow healthily, grow heartily 🪄✨🌱 -9/15/22, 15:24 - Philipp: Do you not make all your plants grow? -9/15/22, 15:24 - Martin: :)) -9/15/22, 15:25 - Martin: What do you consider 'your plants'? -9/15/22, 15:28 - Philipp: Oh, now I understand! -9/15/22, 15:29 - Philipp: I only considered the plants that live in my apartment (or my balcony) as the plant-spell-receiving plants -9/15/22, 15:29 - Philipp: But maybe they share the words? -9/15/22, 15:30 - Martin: Do raindrops touch their leaves? -9/15/22, 15:30 - Martin: I'm sure they chat with the other plants if they can -9/15/22, 15:31 - Philipp: Yeah, I heard that trees communicate in the woods with their roots -9/15/22, 15:31 - Philipp: But thinking about that makes me feel bad that my plants are potted 😬 -9/15/22, 15:31 - Martin: 😢 -9/15/22, 15:32 - Martin: Yeah... -9/15/22, 15:32 - Martin: The trees use mushrooms mycelium in the ground that's hooked to their roots to chat -9/15/22, 15:32 - Martin: Pretty cool 😎 -9/15/22, 15:33 - Martin: So i also have a Pilea -9/15/22, 15:33 - Martin: And some basil plants -9/15/22, 15:33 - Philipp: Do you have a photo of the Pilea? I don't know how it looks -9/15/22, 15:34 - Martin: And a peace lily -9/15/22, 15:34 - Martin: https://en.m.wikipedia.org/wiki/Pilea_peperomioides -9/15/22, 15:47 - Philipp: Oh, the Pilea looks cool! -9/15/22, 15:47 - Philipp: The leaves are like small umbrellas -9/15/22, 15:48 - Philipp: Did you actually manage to keep a supermarket basil alive or did you grow it yourself? -9/15/22, 16:28 - Martin: that's quite a story! -9/15/22, 16:28 - Martin: my dad had a flowering basil last year and put the seeds from that one plant into seeding pots -9/15/22, 16:29 - Martin: so many of them came up that he had about two dining room tables full of basil plants, each in their own pots... -9/15/22, 16:29 - Martin: i got three of them, so they are second gen supermarket basils with lots of siblings :) -9/15/22, 20:58 - Philipp: I always thought supermarket basil was meant to die after a few days -9/15/22, 20:58 - Philipp: But it seems it was my subpar care -9/15/22, 20:59 - Philipp: Congratulations to your basil dynasty! -9/16/22, 06:11 - Martin: Thanks! -9/16/22, 06:12 - Martin: Kudos go mostly to my dad -9/16/22, 06:12 - Martin: But you can bring them through winter -9/16/22, 06:12 - Martin: If there's no thrip infestation... -9/16/22, 06:34 - Martin: -9/16/22, 06:34 - Martin: -9/16/22, 06:35 - Martin: -9/16/22, 06:35 - Martin: Morning view of most of my house plants -9/16/22, 09:44 - Philipp: Fingers crossed 🤞 -9/16/22, 09:45 - Philipp: Are the ones on top avocados? -9/16/22, 09:53 - Martin: Yes, there are a couple of seedlings that wanted to live -9/16/22, 09:54 - Martin: Two more on the balcony of a similar size -9/16/22, 09:54 - Martin: And another seed that's one it's way 🤷‍♂️ -9/16/22, 09:55 - Philipp: I heard that it’s not easy to raise an Avodaco! -9/16/22, 09:55 - Martin: I haven't even heard of Avodacos! -9/16/22, 09:56 - Philipp: Wait, weren’t we talking about avocados? -9/16/22, 09:56 - Martin: Ah yes avocados 🥑! -9/16/22, 09:57 - Martin: I was just joking, riffing based on your typo 😝 -9/16/22, 09:57 - Philipp: Ooh! I was wondering why there was a red line under that word -9/16/22, 09:57 - Martin: Do you think there are avotacos? 🥑🌮 -9/16/22, 09:57 - Philipp: But I like that term, too -9/16/22, 09:58 - Philipp: 😂 -9/16/22, 09:58 - Philipp: If this is not a common term, then I want to make it common! -9/16/22, 09:59 - Martin: Maybe growing an avotaco plant would be a plant symbiosis between an avocado tree and some corn plants? -9/16/22, 10:19 - Philipp: Sounds like the perfect experiment! +1/15/26, 14:50 - Messages and calls are end-to-end encrypted. No one outside of this chat, not even WhatsApp, can read or listen to them. Tap to learn more. +1/15/26, 14:49 - Philipp: Hi Martin, Philipp here! +1/15/26, 14:50 - Philipp: I’m ready to talk about plants! +1/15/26, 14:51 - Martin: Oh that's great! +1/15/26, 14:52 - Martin: I've been waiting for a good convo about plants for a long time +1/15/26, 14:52 - Philipp: We all have. +1/15/26, 14:52 - Martin: Did you know they need water to grow? +1/15/26, 14:52 - Philipp: I always thought that love and music was more than enough +1/15/26, 14:53 - Philipp: But water makes sense +1/15/26, 14:53 - Martin: Do you talk to your plants? +1/15/26, 14:53 - Philipp: I do! +1/15/26, 14:53 - Philipp: Some of them even have names +1/15/26, 14:54 - Martin: What do they like to hear? +1/15/26, 14:54 - Philipp: Motivational speeches +1/15/26, 14:54 - Philipp: Or stories about plants that made it and are living outside now +1/15/26, 14:54 - Martin: Oohhh 🥲 +1/15/26, 14:54 - Martin: Are you training them for independence? +1/15/26, 14:56 - Philipp: Yeah! I want them to be strong and take care of themselves at some point +1/15/26, 14:56 - Martin: That's heroic! +1/15/26, 14:57 - Martin: Sounds like you're a great plant parent +1/15/26, 14:57 - Philipp: Do you have any plant care pro tips? +1/15/26, 14:58 - Martin: Ahh, idk i just leave them be... +1/15/26, 14:58 - Martin: They are doing ok but not great +1/15/26, 14:58 - Philipp: So they are independent already! +1/15/26, 14:58 - Martin: I guess one tip would be to get plants that don't need much :P +1/15/26, 14:58 - Philipp: Like plastic plants, for example? +1/15/26, 14:59 - Martin: Haha, yes! Get independent plants! +1/15/26, 14:59 - Martin: Plastic plants are the cream of the crop +1/15/26, 14:59 - Martin: I haven't graduated to plastic plants yet +1/15/26, 14:59 - Philipp: Cream of the crop? +1/15/26, 15:00 - Philipp: I don't know what this means +1/15/26, 15:01 - Martin: Crop is a cultivated plant that is grown on a large scale commercially, especially a cereal, fruit, or vegetable +1/15/26, 15:01 - Martin: The cream must be the best of the best +1/15/26, 15:01 - Martin: Or maybe just all of it blended together? ;p +1/15/26, 15:02 - Martin: I don't grow any crop at home +1/15/26, 15:02 - Martin: And no cream, in case you wondered +1/15/26, 15:03 - Philipp: Ah, gotcha! +1/15/26, 15:03 - Philipp: Let me show you something! +1/15/26, 15:04 - Martin: I let you +1/15/26, 15:06 - Philipp: +1/15/26, 15:06 - Martin: It's a monsters! +1/15/26, 15:07 - Martin: Monstera* (auto correct...) +1/15/26, 15:07 - Philipp: I’m currently running an experiment of keeping my Monstera on the balcony +1/15/26, 15:07 - Martin: A monstera and a fluffy little monster +1/15/26, 15:07 - Philipp: Haha, yeah, hard to tell which is which +1/15/26, 15:07 - Martin: How has it been going with the monstera on the balcony? +1/15/26, 15:08 - Martin: I've tried that too over the summer +1/15/26, 15:08 - Philipp: Pretty bad +1/15/26, 15:08 - Martin: Oh really? +1/15/26, 15:08 - Martin: What happened? +1/15/26, 15:08 - Philipp: Yeah +1/15/26, 15:08 - Philipp: I mean … it’s weird. +1/15/26, 15:08 - Philipp: The leafs that she had are getting dryer and dryer. But she’s also growing plenty of new ones +1/15/26, 15:09 - Philipp: It‘s like she’s changing her summer jacket to a winter jacket +1/15/26, 15:13 - Martin: Yeah something similar happened to ours +1/15/26, 15:14 - Martin: It had thrips over the winter, so we needed to get rid of them +1/15/26, 15:14 - Philipp: Ah, thrips are those tiny little beasts that eat your plants, aren't they? +1/15/26, 15:15 - Martin: Thought that the balcony time would help get rid of them +1/15/26, 15:15 - Martin: Yeah they are horrible, really cute and tiny and deadly +1/15/26, 15:16 - Martin: Most of the monstera's leaves died, but now there are new ones coming +1/15/26, 15:16 - Martin: I think it's the amount of light, they need different leaves for stronger sunlight +1/15/26, 15:17 - Philipp: Do you have any other approaches to get rid of tiny monsters? +1/15/26, 15:17 - Philipp: (Except putting the plant on the balcony) +1/15/26, 15:17 - Martin: Tiny monstera's? +1/15/26, 15:17 - Philipp: Handling tiny monsters to grow big monsteras +1/15/26, 15:17 - Martin: Haha +1/15/26, 15:17 - Martin: Well, no. Just the balcony. This worked best +1/15/26, 15:18 - Martin: We tried applying soapy water +1/15/26, 15:18 - Martin: Which is a suggestion +1/15/26, 15:18 - Martin: And it keeps them a bit in check, but you can't get totally rid of them +1/15/26, 15:18 - Philipp: 10/10 thrips don't like this simple trick 😅 +1/15/26, 15:18 - Philipp: Oh, okay +1/15/26, 15:18 - Philipp: 8/10 thrips don't like this simple trick +1/15/26, 15:18 - Martin: I really hope they're gone now 🤞 +1/15/26, 15:18 - Martin: Lol +1/15/26, 15:19 - Martin: It's depressing when lil monstera keeps making new leaves for them just to get infected 😢 +1/15/26, 15:19 - Philipp: Yeah, nature can be harsh +1/15/26, 15:20 - Martin: Ah yes, it's a slightly strange rendering of nature though, if it's about potted plants +1/15/26, 15:20 - Martin: I feel like they could handle it better out in the wild +1/15/26, 15:21 - Martin: Good that you're making yours strong enough to leave eventually! +1/15/26, 15:22 - Philipp: For the other plants, my words help them to grow +1/15/26, 15:22 - Philipp: Inside and outside +1/15/26, 15:22 - Martin: What are the magic words? +1/15/26, 15:23 - Martin: Wait, do you make *all* plants grow??? +1/15/26, 15:24 - Philipp: Grow hastily, grow healthily, grow heartily 🪄✨🌱 +1/15/26, 15:24 - Philipp: Do you not make all your plants grow? +1/15/26, 15:24 - Martin: :)) +1/15/26, 15:25 - Martin: What do you consider 'your plants'? +1/15/26, 15:28 - Philipp: Oh, now I understand! +1/15/26, 15:29 - Philipp: I only considered the plants that live in my apartment (or my balcony) as the plant-spell-receiving plants +1/15/26, 15:29 - Philipp: But maybe they share the words? +1/15/26, 15:30 - Martin: Do raindrops touch their leaves? +1/15/26, 15:30 - Martin: I'm sure they chat with the other plants if they can +1/15/26, 15:31 - Philipp: Yeah, I heard that trees communicate in the woods with their roots +1/15/26, 15:31 - Philipp: But thinking about that makes me feel bad that my plants are potted 😬 +1/15/26, 15:31 - Martin: 😢 +1/15/26, 15:32 - Martin: Yeah... +1/15/26, 15:32 - Martin: The trees use mushrooms mycelium in the ground that's hooked to their roots to chat +1/15/26, 15:32 - Martin: Pretty cool 😎 +1/15/26, 15:33 - Martin: So i also have a Pilea +1/15/26, 15:33 - Martin: And some basil plants +1/15/26, 15:33 - Philipp: Do you have a photo of the Pilea? I don't know how it looks +1/15/26, 15:34 - Martin: And a peace lily +1/15/26, 15:34 - Martin: https://en.m.wikipedia.org/wiki/Pilea_peperomioides +1/15/26, 15:47 - Philipp: Oh, the Pilea looks cool! +1/15/26, 15:47 - Philipp: The leaves are like small umbrellas +1/15/26, 15:48 - Philipp: Did you actually manage to keep a supermarket basil alive or did you grow it yourself? +1/15/26, 16:28 - Martin: that's quite a story! +1/15/26, 16:28 - Martin: my dad had a flowering basil last year and put the seeds from that one plant into seeding pots +1/15/26, 16:29 - Martin: so many of them came up that he had about two dining room tables full of basil plants, each in their own pots... +1/15/26, 16:29 - Martin: i got three of them, so they are second gen supermarket basils with lots of siblings :) +1/15/26, 20:58 - Philipp: I always thought supermarket basil was meant to die after a few days +1/15/26, 20:58 - Philipp: But it seems it was my subpar care +1/15/26, 20:59 - Philipp: Congratulations to your basil dynasty! +1/16/26, 06:11 - Martin: Thanks! +1/16/26, 06:12 - Martin: Kudos go mostly to my dad +1/16/26, 06:12 - Martin: But you can bring them through winter +1/16/26, 06:12 - Martin: If there's no thrip infestation... +1/16/26, 06:34 - Martin: +1/16/26, 06:34 - Martin: +1/16/26, 06:35 - Martin: +1/16/26, 06:35 - Martin: Morning view of most of my house plants +1/16/26, 09:44 - Philipp: Fingers crossed 🤞 +1/16/26, 09:45 - Philipp: Are the ones on top avocados? +1/16/26, 09:53 - Martin: Yes, there are a couple of seedlings that wanted to live +1/16/26, 09:54 - Martin: Two more on the balcony of a similar size +1/16/26, 09:54 - Martin: And another seed that's one it's way 🤷‍♂️ +1/16/26, 09:55 - Philipp: I heard that it’s not easy to raise an Avodaco! +1/16/26, 09:55 - Martin: I haven't even heard of Avodacos! +1/16/26, 09:56 - Philipp: Wait, weren’t we talking about avocados? +1/16/26, 09:56 - Martin: Ah yes avocados 🥑! +1/16/26, 09:57 - Martin: I was just joking, riffing based on your typo 😝 +1/16/26, 09:57 - Philipp: Ooh! I was wondering why there was a red line under that word +1/16/26, 09:57 - Martin: Do you think there are avotacos? 🥑🌮 +1/16/26, 09:57 - Philipp: But I like that term, too +1/16/26, 09:58 - Philipp: 😂 +1/16/26, 09:58 - Philipp: If this is not a common term, then I want to make it common! +1/16/26, 09:59 - Martin: Maybe growing an avotaco plant would be a plant symbiosis between an avocado tree and some corn plants? +1/16/26, 10:19 - Philipp: Sounds like the perfect experiment! diff --git a/chatterbot/source_code_step_4/cleaner.py b/chatterbot/source_code_step_4/cleaner.py index 4654709549..72c534a5ba 100644 --- a/chatterbot/source_code_step_4/cleaner.py +++ b/chatterbot/source_code_step_4/cleaner.py @@ -15,7 +15,7 @@ def remove_chat_metadata(chat_export_file): date time username message --------------------------------------- - 8/26/22, 17:47 - Jane Doe: Message text + 1/16/26, 06:34 - Jane Doe: Message text This function removes all the metadata up to the text of each message. @@ -25,7 +25,7 @@ def remove_chat_metadata(chat_export_file): Returns: tuple: The text of each message in the conversation """ - date_time = r"(\d+\/\d+\/\d+,\s\d+:\d+)" # e.g. "8/26/22, 17:47" + date_time = r"(\d+\/\d+\/\d+,\s\d+:\d+)" # e.g. "1/16/26, 06:34" dash_whitespace = r"\s-\s" # " - " username = r"([\w\s]+)" # e.g. "Jane Doe" metadata_end = r":\s" # ": " diff --git a/chatterbot/source_code_step_4/db.sqlite3 b/chatterbot/source_code_step_4/db.sqlite3 index 8cd445d904..949135c094 100644 Binary files a/chatterbot/source_code_step_4/db.sqlite3 and b/chatterbot/source_code_step_4/db.sqlite3 differ diff --git a/chatterbot/source_code_step_4/db.sqlite3-shm b/chatterbot/source_code_step_4/db.sqlite3-shm deleted file mode 100644 index fe9ac2845e..0000000000 Binary files a/chatterbot/source_code_step_4/db.sqlite3-shm and /dev/null differ diff --git a/chatterbot/source_code_step_4/db.sqlite3-wal b/chatterbot/source_code_step_4/db.sqlite3-wal deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/chatterbot/source_code_step_5/bot.py b/chatterbot/source_code_step_5/bot.py index 7fbe51d93a..2f0ab92c4b 100644 --- a/chatterbot/source_code_step_5/bot.py +++ b/chatterbot/source_code_step_5/bot.py @@ -1,16 +1,7 @@ -from chatterbot.trainers import ListTrainer -from cleaner import clean_corpus - from chatterbot import ChatBot -CORPUS_FILE = "chat.txt" - chatbot = ChatBot("Chatpot") -trainer = ListTrainer(chatbot) -cleaned_corpus = clean_corpus(CORPUS_FILE) -trainer.train(cleaned_corpus) - exit_conditions = (":q", "quit", "exit") while True: query = input("> ") diff --git a/chatterbot/source_code_step_5/chat.txt b/chatterbot/source_code_step_5/chat.txt index b585737e91..dd585cc378 100644 --- a/chatterbot/source_code_step_5/chat.txt +++ b/chatterbot/source_code_step_5/chat.txt @@ -1,139 +1,139 @@ -9/15/22, 14:50 - Messages and calls are end-to-end encrypted. No one outside of this chat, not even WhatsApp, can read or listen to them. Tap to learn more. -9/15/22, 14:49 - Philipp: Hi Martin, Philipp here! -9/15/22, 14:50 - Philipp: I’m ready to talk about plants! -9/15/22, 14:51 - Martin: Oh that's great! -9/15/22, 14:52 - Martin: I've been waiting for a good convo about plants for a long time -9/15/22, 14:52 - Philipp: We all have. -9/15/22, 14:52 - Martin: Did you know they need water to grow? -9/15/22, 14:52 - Philipp: I always thought that love and music was more than enough -9/15/22, 14:53 - Philipp: But water makes sense -9/15/22, 14:53 - Martin: Do you talk to your plants? -9/15/22, 14:53 - Philipp: I do! -9/15/22, 14:53 - Philipp: Some of them even have names -9/15/22, 14:54 - Martin: What do they like to hear? -9/15/22, 14:54 - Philipp: Motivational speeches -9/15/22, 14:54 - Philipp: Or stories about plants that made it and are living outside now -9/15/22, 14:54 - Martin: Oohhh 🥲 -9/15/22, 14:54 - Martin: Are you training them for independence? -9/15/22, 14:56 - Philipp: Yeah! I want them to be strong and take care of themselves at some point -9/15/22, 14:56 - Martin: That's heroic! -9/15/22, 14:57 - Martin: Sounds like you're a great plant parent -9/15/22, 14:57 - Philipp: Do you have any plant care pro tips? -9/15/22, 14:58 - Martin: Ahh, idk i just leave them be... -9/15/22, 14:58 - Martin: They are doing ok but not great -9/15/22, 14:58 - Philipp: So they are independent already! -9/15/22, 14:58 - Martin: I guess one tip would be to get plants that don't need much :P -9/15/22, 14:58 - Philipp: Like plastic plants, for example? -9/15/22, 14:59 - Martin: Haha, yes! Get independent plants! -9/15/22, 14:59 - Martin: Plastic plants are the cream of the crop -9/15/22, 14:59 - Martin: I haven't graduated to plastic plants yet -9/15/22, 14:59 - Philipp: Cream of the crop? -9/15/22, 15:00 - Philipp: I don't know what this means -9/15/22, 15:01 - Martin: Crop is a cultivated plant that is grown on a large scale commercially, especially a cereal, fruit, or vegetable -9/15/22, 15:01 - Martin: The cream must be the best of the best -9/15/22, 15:01 - Martin: Or maybe just all of it blended together? ;p -9/15/22, 15:02 - Martin: I don't grow any crop at home -9/15/22, 15:02 - Martin: And no cream, in case you wondered -9/15/22, 15:03 - Philipp: Ah, gotcha! -9/15/22, 15:03 - Philipp: Let me show you something! -9/15/22, 15:04 - Martin: I let you -9/15/22, 15:06 - Philipp: -9/15/22, 15:06 - Martin: It's a monsters! -9/15/22, 15:07 - Martin: Monstera* (auto correct...) -9/15/22, 15:07 - Philipp: I’m currently running an experiment of keeping my Monstera on the balcony -9/15/22, 15:07 - Martin: A monstera and a fluffy little monster -9/15/22, 15:07 - Philipp: Haha, yeah, hard to tell which is which -9/15/22, 15:07 - Martin: How has it been going with the monstera on the balcony? -9/15/22, 15:08 - Martin: I've tried that too over the summer -9/15/22, 15:08 - Philipp: Pretty bad -9/15/22, 15:08 - Martin: Oh really? -9/15/22, 15:08 - Martin: What happened? -9/15/22, 15:08 - Philipp: Yeah -9/15/22, 15:08 - Philipp: I mean … it’s weird. -9/15/22, 15:08 - Philipp: The leafs that she had are getting dryer and dryer. But she’s also growing plenty of new ones -9/15/22, 15:09 - Philipp: It‘s like she’s changing her summer jacket to a winter jacket -9/15/22, 15:13 - Martin: Yeah something similar happened to ours -9/15/22, 15:14 - Martin: It had thrips over the winter, so we needed to get rid of them -9/15/22, 15:14 - Philipp: Ah, thrips are those tiny little beasts that eat your plants, aren't they? -9/15/22, 15:15 - Martin: Thought that the balcony time would help get rid of them -9/15/22, 15:15 - Martin: Yeah they are horrible, really cute and tiny and deadly -9/15/22, 15:16 - Martin: Most of the monstera's leaves died, but now there are new ones coming -9/15/22, 15:16 - Martin: I think it's the amount of light, they need different leaves for stronger sunlight -9/15/22, 15:17 - Philipp: Do you have any other approaches to get rid of tiny monsters? -9/15/22, 15:17 - Philipp: (Except putting the plant on the balcony) -9/15/22, 15:17 - Martin: Tiny monstera's? -9/15/22, 15:17 - Philipp: Handling tiny monsters to grow big monsteras -9/15/22, 15:17 - Martin: Haha -9/15/22, 15:17 - Martin: Well, no. Just the balcony. This worked best -9/15/22, 15:18 - Martin: We tried applying soapy water -9/15/22, 15:18 - Martin: Which is a suggestion -9/15/22, 15:18 - Martin: And it keeps them a bit in check, but you can't get totally rid of them -9/15/22, 15:18 - Philipp: 10/10 thrips don't like this simple trick 😅 -9/15/22, 15:18 - Philipp: Oh, okay -9/15/22, 15:18 - Philipp: 8/10 thrips don't like this simple trick -9/15/22, 15:18 - Martin: I really hope they're gone now 🤞 -9/15/22, 15:18 - Martin: Lol -9/15/22, 15:19 - Martin: It's depressing when lil monstera keeps making new leaves for them just to get infected 😢 -9/15/22, 15:19 - Philipp: Yeah, nature can be harsh -9/15/22, 15:20 - Martin: Ah yes, it's a slightly strange rendering of nature though, if it's about potted plants -9/15/22, 15:20 - Martin: I feel like they could handle it better out in the wild -9/15/22, 15:21 - Martin: Good that you're making yours strong enough to leave eventually! -9/15/22, 15:22 - Philipp: For the other plants, my words help them to grow -9/15/22, 15:22 - Philipp: Inside and outside -9/15/22, 15:22 - Martin: What are the magic words? -9/15/22, 15:23 - Martin: Wait, do you make *all* plants grow??? -9/15/22, 15:24 - Philipp: Grow hastily, grow healthily, grow heartily 🪄✨🌱 -9/15/22, 15:24 - Philipp: Do you not make all your plants grow? -9/15/22, 15:24 - Martin: :)) -9/15/22, 15:25 - Martin: What do you consider 'your plants'? -9/15/22, 15:28 - Philipp: Oh, now I understand! -9/15/22, 15:29 - Philipp: I only considered the plants that live in my apartment (or my balcony) as the plant-spell-receiving plants -9/15/22, 15:29 - Philipp: But maybe they share the words? -9/15/22, 15:30 - Martin: Do raindrops touch their leaves? -9/15/22, 15:30 - Martin: I'm sure they chat with the other plants if they can -9/15/22, 15:31 - Philipp: Yeah, I heard that trees communicate in the woods with their roots -9/15/22, 15:31 - Philipp: But thinking about that makes me feel bad that my plants are potted 😬 -9/15/22, 15:31 - Martin: 😢 -9/15/22, 15:32 - Martin: Yeah... -9/15/22, 15:32 - Martin: The trees use mushrooms mycelium in the ground that's hooked to their roots to chat -9/15/22, 15:32 - Martin: Pretty cool 😎 -9/15/22, 15:33 - Martin: So i also have a Pilea -9/15/22, 15:33 - Martin: And some basil plants -9/15/22, 15:33 - Philipp: Do you have a photo of the Pilea? I don't know how it looks -9/15/22, 15:34 - Martin: And a peace lily -9/15/22, 15:34 - Martin: https://en.m.wikipedia.org/wiki/Pilea_peperomioides -9/15/22, 15:47 - Philipp: Oh, the Pilea looks cool! -9/15/22, 15:47 - Philipp: The leaves are like small umbrellas -9/15/22, 15:48 - Philipp: Did you actually manage to keep a supermarket basil alive or did you grow it yourself? -9/15/22, 16:28 - Martin: that's quite a story! -9/15/22, 16:28 - Martin: my dad had a flowering basil last year and put the seeds from that one plant into seeding pots -9/15/22, 16:29 - Martin: so many of them came up that he had about two dining room tables full of basil plants, each in their own pots... -9/15/22, 16:29 - Martin: i got three of them, so they are second gen supermarket basils with lots of siblings :) -9/15/22, 20:58 - Philipp: I always thought supermarket basil was meant to die after a few days -9/15/22, 20:58 - Philipp: But it seems it was my subpar care -9/15/22, 20:59 - Philipp: Congratulations to your basil dynasty! -9/16/22, 06:11 - Martin: Thanks! -9/16/22, 06:12 - Martin: Kudos go mostly to my dad -9/16/22, 06:12 - Martin: But you can bring them through winter -9/16/22, 06:12 - Martin: If there's no thrip infestation... -9/16/22, 06:34 - Martin: -9/16/22, 06:34 - Martin: -9/16/22, 06:35 - Martin: -9/16/22, 06:35 - Martin: Morning view of most of my house plants -9/16/22, 09:44 - Philipp: Fingers crossed 🤞 -9/16/22, 09:45 - Philipp: Are the ones on top avocados? -9/16/22, 09:53 - Martin: Yes, there are a couple of seedlings that wanted to live -9/16/22, 09:54 - Martin: Two more on the balcony of a similar size -9/16/22, 09:54 - Martin: And another seed that's one it's way 🤷‍♂️ -9/16/22, 09:55 - Philipp: I heard that it’s not easy to raise an Avodaco! -9/16/22, 09:55 - Martin: I haven't even heard of Avodacos! -9/16/22, 09:56 - Philipp: Wait, weren’t we talking about avocados? -9/16/22, 09:56 - Martin: Ah yes avocados 🥑! -9/16/22, 09:57 - Martin: I was just joking, riffing based on your typo 😝 -9/16/22, 09:57 - Philipp: Ooh! I was wondering why there was a red line under that word -9/16/22, 09:57 - Martin: Do you think there are avotacos? 🥑🌮 -9/16/22, 09:57 - Philipp: But I like that term, too -9/16/22, 09:58 - Philipp: 😂 -9/16/22, 09:58 - Philipp: If this is not a common term, then I want to make it common! -9/16/22, 09:59 - Martin: Maybe growing an avotaco plant would be a plant symbiosis between an avocado tree and some corn plants? -9/16/22, 10:19 - Philipp: Sounds like the perfect experiment! +1/15/26, 14:50 - Messages and calls are end-to-end encrypted. No one outside of this chat, not even WhatsApp, can read or listen to them. Tap to learn more. +1/15/26, 14:49 - Philipp: Hi Martin, Philipp here! +1/15/26, 14:50 - Philipp: I’m ready to talk about plants! +1/15/26, 14:51 - Martin: Oh that's great! +1/15/26, 14:52 - Martin: I've been waiting for a good convo about plants for a long time +1/15/26, 14:52 - Philipp: We all have. +1/15/26, 14:52 - Martin: Did you know they need water to grow? +1/15/26, 14:52 - Philipp: I always thought that love and music was more than enough +1/15/26, 14:53 - Philipp: But water makes sense +1/15/26, 14:53 - Martin: Do you talk to your plants? +1/15/26, 14:53 - Philipp: I do! +1/15/26, 14:53 - Philipp: Some of them even have names +1/15/26, 14:54 - Martin: What do they like to hear? +1/15/26, 14:54 - Philipp: Motivational speeches +1/15/26, 14:54 - Philipp: Or stories about plants that made it and are living outside now +1/15/26, 14:54 - Martin: Oohhh 🥲 +1/15/26, 14:54 - Martin: Are you training them for independence? +1/15/26, 14:56 - Philipp: Yeah! I want them to be strong and take care of themselves at some point +1/15/26, 14:56 - Martin: That's heroic! +1/15/26, 14:57 - Martin: Sounds like you're a great plant parent +1/15/26, 14:57 - Philipp: Do you have any plant care pro tips? +1/15/26, 14:58 - Martin: Ahh, idk i just leave them be... +1/15/26, 14:58 - Martin: They are doing ok but not great +1/15/26, 14:58 - Philipp: So they are independent already! +1/15/26, 14:58 - Martin: I guess one tip would be to get plants that don't need much :P +1/15/26, 14:58 - Philipp: Like plastic plants, for example? +1/15/26, 14:59 - Martin: Haha, yes! Get independent plants! +1/15/26, 14:59 - Martin: Plastic plants are the cream of the crop +1/15/26, 14:59 - Martin: I haven't graduated to plastic plants yet +1/15/26, 14:59 - Philipp: Cream of the crop? +1/15/26, 15:00 - Philipp: I don't know what this means +1/15/26, 15:01 - Martin: Crop is a cultivated plant that is grown on a large scale commercially, especially a cereal, fruit, or vegetable +1/15/26, 15:01 - Martin: The cream must be the best of the best +1/15/26, 15:01 - Martin: Or maybe just all of it blended together? ;p +1/15/26, 15:02 - Martin: I don't grow any crop at home +1/15/26, 15:02 - Martin: And no cream, in case you wondered +1/15/26, 15:03 - Philipp: Ah, gotcha! +1/15/26, 15:03 - Philipp: Let me show you something! +1/15/26, 15:04 - Martin: I let you +1/15/26, 15:06 - Philipp: +1/15/26, 15:06 - Martin: It's a monsters! +1/15/26, 15:07 - Martin: Monstera* (auto correct...) +1/15/26, 15:07 - Philipp: I’m currently running an experiment of keeping my Monstera on the balcony +1/15/26, 15:07 - Martin: A monstera and a fluffy little monster +1/15/26, 15:07 - Philipp: Haha, yeah, hard to tell which is which +1/15/26, 15:07 - Martin: How has it been going with the monstera on the balcony? +1/15/26, 15:08 - Martin: I've tried that too over the summer +1/15/26, 15:08 - Philipp: Pretty bad +1/15/26, 15:08 - Martin: Oh really? +1/15/26, 15:08 - Martin: What happened? +1/15/26, 15:08 - Philipp: Yeah +1/15/26, 15:08 - Philipp: I mean … it’s weird. +1/15/26, 15:08 - Philipp: The leafs that she had are getting dryer and dryer. But she’s also growing plenty of new ones +1/15/26, 15:09 - Philipp: It‘s like she’s changing her summer jacket to a winter jacket +1/15/26, 15:13 - Martin: Yeah something similar happened to ours +1/15/26, 15:14 - Martin: It had thrips over the winter, so we needed to get rid of them +1/15/26, 15:14 - Philipp: Ah, thrips are those tiny little beasts that eat your plants, aren't they? +1/15/26, 15:15 - Martin: Thought that the balcony time would help get rid of them +1/15/26, 15:15 - Martin: Yeah they are horrible, really cute and tiny and deadly +1/15/26, 15:16 - Martin: Most of the monstera's leaves died, but now there are new ones coming +1/15/26, 15:16 - Martin: I think it's the amount of light, they need different leaves for stronger sunlight +1/15/26, 15:17 - Philipp: Do you have any other approaches to get rid of tiny monsters? +1/15/26, 15:17 - Philipp: (Except putting the plant on the balcony) +1/15/26, 15:17 - Martin: Tiny monstera's? +1/15/26, 15:17 - Philipp: Handling tiny monsters to grow big monsteras +1/15/26, 15:17 - Martin: Haha +1/15/26, 15:17 - Martin: Well, no. Just the balcony. This worked best +1/15/26, 15:18 - Martin: We tried applying soapy water +1/15/26, 15:18 - Martin: Which is a suggestion +1/15/26, 15:18 - Martin: And it keeps them a bit in check, but you can't get totally rid of them +1/15/26, 15:18 - Philipp: 10/10 thrips don't like this simple trick 😅 +1/15/26, 15:18 - Philipp: Oh, okay +1/15/26, 15:18 - Philipp: 8/10 thrips don't like this simple trick +1/15/26, 15:18 - Martin: I really hope they're gone now 🤞 +1/15/26, 15:18 - Martin: Lol +1/15/26, 15:19 - Martin: It's depressing when lil monstera keeps making new leaves for them just to get infected 😢 +1/15/26, 15:19 - Philipp: Yeah, nature can be harsh +1/15/26, 15:20 - Martin: Ah yes, it's a slightly strange rendering of nature though, if it's about potted plants +1/15/26, 15:20 - Martin: I feel like they could handle it better out in the wild +1/15/26, 15:21 - Martin: Good that you're making yours strong enough to leave eventually! +1/15/26, 15:22 - Philipp: For the other plants, my words help them to grow +1/15/26, 15:22 - Philipp: Inside and outside +1/15/26, 15:22 - Martin: What are the magic words? +1/15/26, 15:23 - Martin: Wait, do you make *all* plants grow??? +1/15/26, 15:24 - Philipp: Grow hastily, grow healthily, grow heartily 🪄✨🌱 +1/15/26, 15:24 - Philipp: Do you not make all your plants grow? +1/15/26, 15:24 - Martin: :)) +1/15/26, 15:25 - Martin: What do you consider 'your plants'? +1/15/26, 15:28 - Philipp: Oh, now I understand! +1/15/26, 15:29 - Philipp: I only considered the plants that live in my apartment (or my balcony) as the plant-spell-receiving plants +1/15/26, 15:29 - Philipp: But maybe they share the words? +1/15/26, 15:30 - Martin: Do raindrops touch their leaves? +1/15/26, 15:30 - Martin: I'm sure they chat with the other plants if they can +1/15/26, 15:31 - Philipp: Yeah, I heard that trees communicate in the woods with their roots +1/15/26, 15:31 - Philipp: But thinking about that makes me feel bad that my plants are potted 😬 +1/15/26, 15:31 - Martin: 😢 +1/15/26, 15:32 - Martin: Yeah... +1/15/26, 15:32 - Martin: The trees use mushrooms mycelium in the ground that's hooked to their roots to chat +1/15/26, 15:32 - Martin: Pretty cool 😎 +1/15/26, 15:33 - Martin: So i also have a Pilea +1/15/26, 15:33 - Martin: And some basil plants +1/15/26, 15:33 - Philipp: Do you have a photo of the Pilea? I don't know how it looks +1/15/26, 15:34 - Martin: And a peace lily +1/15/26, 15:34 - Martin: https://en.m.wikipedia.org/wiki/Pilea_peperomioides +1/15/26, 15:47 - Philipp: Oh, the Pilea looks cool! +1/15/26, 15:47 - Philipp: The leaves are like small umbrellas +1/15/26, 15:48 - Philipp: Did you actually manage to keep a supermarket basil alive or did you grow it yourself? +1/15/26, 16:28 - Martin: that's quite a story! +1/15/26, 16:28 - Martin: my dad had a flowering basil last year and put the seeds from that one plant into seeding pots +1/15/26, 16:29 - Martin: so many of them came up that he had about two dining room tables full of basil plants, each in their own pots... +1/15/26, 16:29 - Martin: i got three of them, so they are second gen supermarket basils with lots of siblings :) +1/15/26, 20:58 - Philipp: I always thought supermarket basil was meant to die after a few days +1/15/26, 20:58 - Philipp: But it seems it was my subpar care +1/15/26, 20:59 - Philipp: Congratulations to your basil dynasty! +1/16/26, 06:11 - Martin: Thanks! +1/16/26, 06:12 - Martin: Kudos go mostly to my dad +1/16/26, 06:12 - Martin: But you can bring them through winter +1/16/26, 06:12 - Martin: If there's no thrip infestation... +1/16/26, 06:34 - Martin: +1/16/26, 06:34 - Martin: +1/16/26, 06:35 - Martin: +1/16/26, 06:35 - Martin: Morning view of most of my house plants +1/16/26, 09:44 - Philipp: Fingers crossed 🤞 +1/16/26, 09:45 - Philipp: Are the ones on top avocados? +1/16/26, 09:53 - Martin: Yes, there are a couple of seedlings that wanted to live +1/16/26, 09:54 - Martin: Two more on the balcony of a similar size +1/16/26, 09:54 - Martin: And another seed that's one it's way 🤷‍♂️ +1/16/26, 09:55 - Philipp: I heard that it’s not easy to raise an Avodaco! +1/16/26, 09:55 - Martin: I haven't even heard of Avodacos! +1/16/26, 09:56 - Philipp: Wait, weren’t we talking about avocados? +1/16/26, 09:56 - Martin: Ah yes avocados 🥑! +1/16/26, 09:57 - Martin: I was just joking, riffing based on your typo 😝 +1/16/26, 09:57 - Philipp: Ooh! I was wondering why there was a red line under that word +1/16/26, 09:57 - Martin: Do you think there are avotacos? 🥑🌮 +1/16/26, 09:57 - Philipp: But I like that term, too +1/16/26, 09:58 - Philipp: 😂 +1/16/26, 09:58 - Philipp: If this is not a common term, then I want to make it common! +1/16/26, 09:59 - Martin: Maybe growing an avotaco plant would be a plant symbiosis between an avocado tree and some corn plants? +1/16/26, 10:19 - Philipp: Sounds like the perfect experiment! diff --git a/chatterbot/source_code_step_5/cleaner.py b/chatterbot/source_code_step_5/cleaner.py index 4654709549..72c534a5ba 100644 --- a/chatterbot/source_code_step_5/cleaner.py +++ b/chatterbot/source_code_step_5/cleaner.py @@ -15,7 +15,7 @@ def remove_chat_metadata(chat_export_file): date time username message --------------------------------------- - 8/26/22, 17:47 - Jane Doe: Message text + 1/16/26, 06:34 - Jane Doe: Message text This function removes all the metadata up to the text of each message. @@ -25,7 +25,7 @@ def remove_chat_metadata(chat_export_file): Returns: tuple: The text of each message in the conversation """ - date_time = r"(\d+\/\d+\/\d+,\s\d+:\d+)" # e.g. "8/26/22, 17:47" + date_time = r"(\d+\/\d+\/\d+,\s\d+:\d+)" # e.g. "1/16/26, 06:34" dash_whitespace = r"\s-\s" # " - " username = r"([\w\s]+)" # e.g. "Jane Doe" metadata_end = r":\s" # ": " diff --git a/chatterbot/source_code_step_5/db.sqlite3 b/chatterbot/source_code_step_5/db.sqlite3 index d0b54e27f3..5a4ee6c06d 100644 Binary files a/chatterbot/source_code_step_5/db.sqlite3 and b/chatterbot/source_code_step_5/db.sqlite3 differ diff --git a/chatterbot/source_code_step_5/db.sqlite3-shm b/chatterbot/source_code_step_5/db.sqlite3-shm deleted file mode 100644 index cc98ed7d59..0000000000 Binary files a/chatterbot/source_code_step_5/db.sqlite3-shm and /dev/null differ diff --git a/chatterbot/source_code_step_5/db.sqlite3-wal b/chatterbot/source_code_step_5/db.sqlite3-wal deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/chatterbot/source_code_step_5/trainer.py b/chatterbot/source_code_step_5/trainer.py new file mode 100644 index 0000000000..6b95736f43 --- /dev/null +++ b/chatterbot/source_code_step_5/trainer.py @@ -0,0 +1,10 @@ +from chatterbot import ChatBot +from chatterbot.trainers import ListTrainer +from cleaner import clean_corpus + +CORPUS_FILE = "chat.txt" + +chatbot = ChatBot("Chatpot") +trainer = ListTrainer(chatbot) +cleaned_corpus = clean_corpus(CORPUS_FILE) +trainer.train(cleaned_corpus) diff --git a/chatterbot/source_code_step_6/bot.py b/chatterbot/source_code_step_6/bot.py new file mode 100644 index 0000000000..dd24be4e5b --- /dev/null +++ b/chatterbot/source_code_step_6/bot.py @@ -0,0 +1,23 @@ +from chatterbot import ChatBot + +chatbot = ChatBot( + "Chatpot", + logic_adapters=[ + { + "import_path": "chatterbot.logic.BestMatch", + }, + { + "import_path": "chatterbot.logic.OllamaLogicAdapter", + "model": "llama3.2:latest", + "host": "http://localhost:11434", + }, + ], +) + +exit_conditions = (":q", "quit", "exit") +while True: + query = input("> ") + if query in exit_conditions: + break + else: + print(f"🪴 {chatbot.get_response(query)}") diff --git a/chatterbot/source_code_step_6/chat.txt b/chatterbot/source_code_step_6/chat.txt new file mode 100644 index 0000000000..dd585cc378 --- /dev/null +++ b/chatterbot/source_code_step_6/chat.txt @@ -0,0 +1,139 @@ +1/15/26, 14:50 - Messages and calls are end-to-end encrypted. No one outside of this chat, not even WhatsApp, can read or listen to them. Tap to learn more. +1/15/26, 14:49 - Philipp: Hi Martin, Philipp here! +1/15/26, 14:50 - Philipp: I’m ready to talk about plants! +1/15/26, 14:51 - Martin: Oh that's great! +1/15/26, 14:52 - Martin: I've been waiting for a good convo about plants for a long time +1/15/26, 14:52 - Philipp: We all have. +1/15/26, 14:52 - Martin: Did you know they need water to grow? +1/15/26, 14:52 - Philipp: I always thought that love and music was more than enough +1/15/26, 14:53 - Philipp: But water makes sense +1/15/26, 14:53 - Martin: Do you talk to your plants? +1/15/26, 14:53 - Philipp: I do! +1/15/26, 14:53 - Philipp: Some of them even have names +1/15/26, 14:54 - Martin: What do they like to hear? +1/15/26, 14:54 - Philipp: Motivational speeches +1/15/26, 14:54 - Philipp: Or stories about plants that made it and are living outside now +1/15/26, 14:54 - Martin: Oohhh 🥲 +1/15/26, 14:54 - Martin: Are you training them for independence? +1/15/26, 14:56 - Philipp: Yeah! I want them to be strong and take care of themselves at some point +1/15/26, 14:56 - Martin: That's heroic! +1/15/26, 14:57 - Martin: Sounds like you're a great plant parent +1/15/26, 14:57 - Philipp: Do you have any plant care pro tips? +1/15/26, 14:58 - Martin: Ahh, idk i just leave them be... +1/15/26, 14:58 - Martin: They are doing ok but not great +1/15/26, 14:58 - Philipp: So they are independent already! +1/15/26, 14:58 - Martin: I guess one tip would be to get plants that don't need much :P +1/15/26, 14:58 - Philipp: Like plastic plants, for example? +1/15/26, 14:59 - Martin: Haha, yes! Get independent plants! +1/15/26, 14:59 - Martin: Plastic plants are the cream of the crop +1/15/26, 14:59 - Martin: I haven't graduated to plastic plants yet +1/15/26, 14:59 - Philipp: Cream of the crop? +1/15/26, 15:00 - Philipp: I don't know what this means +1/15/26, 15:01 - Martin: Crop is a cultivated plant that is grown on a large scale commercially, especially a cereal, fruit, or vegetable +1/15/26, 15:01 - Martin: The cream must be the best of the best +1/15/26, 15:01 - Martin: Or maybe just all of it blended together? ;p +1/15/26, 15:02 - Martin: I don't grow any crop at home +1/15/26, 15:02 - Martin: And no cream, in case you wondered +1/15/26, 15:03 - Philipp: Ah, gotcha! +1/15/26, 15:03 - Philipp: Let me show you something! +1/15/26, 15:04 - Martin: I let you +1/15/26, 15:06 - Philipp: +1/15/26, 15:06 - Martin: It's a monsters! +1/15/26, 15:07 - Martin: Monstera* (auto correct...) +1/15/26, 15:07 - Philipp: I’m currently running an experiment of keeping my Monstera on the balcony +1/15/26, 15:07 - Martin: A monstera and a fluffy little monster +1/15/26, 15:07 - Philipp: Haha, yeah, hard to tell which is which +1/15/26, 15:07 - Martin: How has it been going with the monstera on the balcony? +1/15/26, 15:08 - Martin: I've tried that too over the summer +1/15/26, 15:08 - Philipp: Pretty bad +1/15/26, 15:08 - Martin: Oh really? +1/15/26, 15:08 - Martin: What happened? +1/15/26, 15:08 - Philipp: Yeah +1/15/26, 15:08 - Philipp: I mean … it’s weird. +1/15/26, 15:08 - Philipp: The leafs that she had are getting dryer and dryer. But she’s also growing plenty of new ones +1/15/26, 15:09 - Philipp: It‘s like she’s changing her summer jacket to a winter jacket +1/15/26, 15:13 - Martin: Yeah something similar happened to ours +1/15/26, 15:14 - Martin: It had thrips over the winter, so we needed to get rid of them +1/15/26, 15:14 - Philipp: Ah, thrips are those tiny little beasts that eat your plants, aren't they? +1/15/26, 15:15 - Martin: Thought that the balcony time would help get rid of them +1/15/26, 15:15 - Martin: Yeah they are horrible, really cute and tiny and deadly +1/15/26, 15:16 - Martin: Most of the monstera's leaves died, but now there are new ones coming +1/15/26, 15:16 - Martin: I think it's the amount of light, they need different leaves for stronger sunlight +1/15/26, 15:17 - Philipp: Do you have any other approaches to get rid of tiny monsters? +1/15/26, 15:17 - Philipp: (Except putting the plant on the balcony) +1/15/26, 15:17 - Martin: Tiny monstera's? +1/15/26, 15:17 - Philipp: Handling tiny monsters to grow big monsteras +1/15/26, 15:17 - Martin: Haha +1/15/26, 15:17 - Martin: Well, no. Just the balcony. This worked best +1/15/26, 15:18 - Martin: We tried applying soapy water +1/15/26, 15:18 - Martin: Which is a suggestion +1/15/26, 15:18 - Martin: And it keeps them a bit in check, but you can't get totally rid of them +1/15/26, 15:18 - Philipp: 10/10 thrips don't like this simple trick 😅 +1/15/26, 15:18 - Philipp: Oh, okay +1/15/26, 15:18 - Philipp: 8/10 thrips don't like this simple trick +1/15/26, 15:18 - Martin: I really hope they're gone now 🤞 +1/15/26, 15:18 - Martin: Lol +1/15/26, 15:19 - Martin: It's depressing when lil monstera keeps making new leaves for them just to get infected 😢 +1/15/26, 15:19 - Philipp: Yeah, nature can be harsh +1/15/26, 15:20 - Martin: Ah yes, it's a slightly strange rendering of nature though, if it's about potted plants +1/15/26, 15:20 - Martin: I feel like they could handle it better out in the wild +1/15/26, 15:21 - Martin: Good that you're making yours strong enough to leave eventually! +1/15/26, 15:22 - Philipp: For the other plants, my words help them to grow +1/15/26, 15:22 - Philipp: Inside and outside +1/15/26, 15:22 - Martin: What are the magic words? +1/15/26, 15:23 - Martin: Wait, do you make *all* plants grow??? +1/15/26, 15:24 - Philipp: Grow hastily, grow healthily, grow heartily 🪄✨🌱 +1/15/26, 15:24 - Philipp: Do you not make all your plants grow? +1/15/26, 15:24 - Martin: :)) +1/15/26, 15:25 - Martin: What do you consider 'your plants'? +1/15/26, 15:28 - Philipp: Oh, now I understand! +1/15/26, 15:29 - Philipp: I only considered the plants that live in my apartment (or my balcony) as the plant-spell-receiving plants +1/15/26, 15:29 - Philipp: But maybe they share the words? +1/15/26, 15:30 - Martin: Do raindrops touch their leaves? +1/15/26, 15:30 - Martin: I'm sure they chat with the other plants if they can +1/15/26, 15:31 - Philipp: Yeah, I heard that trees communicate in the woods with their roots +1/15/26, 15:31 - Philipp: But thinking about that makes me feel bad that my plants are potted 😬 +1/15/26, 15:31 - Martin: 😢 +1/15/26, 15:32 - Martin: Yeah... +1/15/26, 15:32 - Martin: The trees use mushrooms mycelium in the ground that's hooked to their roots to chat +1/15/26, 15:32 - Martin: Pretty cool 😎 +1/15/26, 15:33 - Martin: So i also have a Pilea +1/15/26, 15:33 - Martin: And some basil plants +1/15/26, 15:33 - Philipp: Do you have a photo of the Pilea? I don't know how it looks +1/15/26, 15:34 - Martin: And a peace lily +1/15/26, 15:34 - Martin: https://en.m.wikipedia.org/wiki/Pilea_peperomioides +1/15/26, 15:47 - Philipp: Oh, the Pilea looks cool! +1/15/26, 15:47 - Philipp: The leaves are like small umbrellas +1/15/26, 15:48 - Philipp: Did you actually manage to keep a supermarket basil alive or did you grow it yourself? +1/15/26, 16:28 - Martin: that's quite a story! +1/15/26, 16:28 - Martin: my dad had a flowering basil last year and put the seeds from that one plant into seeding pots +1/15/26, 16:29 - Martin: so many of them came up that he had about two dining room tables full of basil plants, each in their own pots... +1/15/26, 16:29 - Martin: i got three of them, so they are second gen supermarket basils with lots of siblings :) +1/15/26, 20:58 - Philipp: I always thought supermarket basil was meant to die after a few days +1/15/26, 20:58 - Philipp: But it seems it was my subpar care +1/15/26, 20:59 - Philipp: Congratulations to your basil dynasty! +1/16/26, 06:11 - Martin: Thanks! +1/16/26, 06:12 - Martin: Kudos go mostly to my dad +1/16/26, 06:12 - Martin: But you can bring them through winter +1/16/26, 06:12 - Martin: If there's no thrip infestation... +1/16/26, 06:34 - Martin: +1/16/26, 06:34 - Martin: +1/16/26, 06:35 - Martin: +1/16/26, 06:35 - Martin: Morning view of most of my house plants +1/16/26, 09:44 - Philipp: Fingers crossed 🤞 +1/16/26, 09:45 - Philipp: Are the ones on top avocados? +1/16/26, 09:53 - Martin: Yes, there are a couple of seedlings that wanted to live +1/16/26, 09:54 - Martin: Two more on the balcony of a similar size +1/16/26, 09:54 - Martin: And another seed that's one it's way 🤷‍♂️ +1/16/26, 09:55 - Philipp: I heard that it’s not easy to raise an Avodaco! +1/16/26, 09:55 - Martin: I haven't even heard of Avodacos! +1/16/26, 09:56 - Philipp: Wait, weren’t we talking about avocados? +1/16/26, 09:56 - Martin: Ah yes avocados 🥑! +1/16/26, 09:57 - Martin: I was just joking, riffing based on your typo 😝 +1/16/26, 09:57 - Philipp: Ooh! I was wondering why there was a red line under that word +1/16/26, 09:57 - Martin: Do you think there are avotacos? 🥑🌮 +1/16/26, 09:57 - Philipp: But I like that term, too +1/16/26, 09:58 - Philipp: 😂 +1/16/26, 09:58 - Philipp: If this is not a common term, then I want to make it common! +1/16/26, 09:59 - Martin: Maybe growing an avotaco plant would be a plant symbiosis between an avocado tree and some corn plants? +1/16/26, 10:19 - Philipp: Sounds like the perfect experiment! diff --git a/chatterbot/source_code_step_6/cleaner.py b/chatterbot/source_code_step_6/cleaner.py new file mode 100644 index 0000000000..72c534a5ba --- /dev/null +++ b/chatterbot/source_code_step_6/cleaner.py @@ -0,0 +1,57 @@ +import re + + +def clean_corpus(chat_export_file): + """Prepare a WhatsApp chat export for training with chatterbot.""" + message_corpus = remove_chat_metadata(chat_export_file) + cleaned_corpus = remove_non_message_text(message_corpus) + return cleaned_corpus + + +def remove_chat_metadata(chat_export_file): + """Remove WhatsApp chat metadata. + + WhatsApp chat exports come with metadata about each message: + + date time username message + --------------------------------------- + 1/16/26, 06:34 - Jane Doe: Message text + + This function removes all the metadata up to the text of each message. + + Args: + chat_export_file (str): The name of the chat export file + + Returns: + tuple: The text of each message in the conversation + """ + date_time = r"(\d+\/\d+\/\d+,\s\d+:\d+)" # e.g. "1/16/26, 06:34" + dash_whitespace = r"\s-\s" # " - " + username = r"([\w\s]+)" # e.g. "Jane Doe" + metadata_end = r":\s" # ": " + pattern = date_time + dash_whitespace + username + metadata_end + + with open(chat_export_file, "r") as corpus_file: + content = corpus_file.read() + cleaned_corpus = re.sub(pattern, "", content) + return tuple(cleaned_corpus.split("\n")) + + +def remove_non_message_text(export_text_lines): + """Remove conversation-irrelevant text from chat export. + + WhatsApp chat exports come with a standardized intro line, + and an empty line at the end of the file. + Text exports also replace media messages with text that isn't + relevant for the conversation. This function removes all that. + + Args: + export_text_lines (tuple): All lines from the export file + + Returns: + tuple: Messages that are a relevant part of the conversation + """ + messages = export_text_lines[1:-1] + + filter_out_msgs = ("",) + return tuple((msg for msg in messages if msg not in filter_out_msgs)) diff --git a/chatterbot/source_code_step_6/trainer.py b/chatterbot/source_code_step_6/trainer.py new file mode 100644 index 0000000000..6b95736f43 --- /dev/null +++ b/chatterbot/source_code_step_6/trainer.py @@ -0,0 +1,10 @@ +from chatterbot import ChatBot +from chatterbot.trainers import ListTrainer +from cleaner import clean_corpus + +CORPUS_FILE = "chat.txt" + +chatbot = ChatBot("Chatpot") +trainer = ListTrainer(chatbot) +cleaned_corpus = clean_corpus(CORPUS_FILE) +trainer.train(cleaned_corpus)