# Unit 6 Lesson 2 - Level 8B (Chatbot)

**URL:** <https://forum.code.org/t/unit-6-lesson-2-level-8b-chatbot/40258>\
**Category:** Coding and Debugging Help\
**Created:** [December 24, 2024, 5:11am UTC](https://forum.code.org/t/unit-6-lesson-2-level-8b-chatbot/40258 "2024-12-24T05:11:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![a112032](https://avatars.discourse-cdn.com/v4/letter/a/b5ac83/32.png) [@a112032](https://forum.code.org/u/a112032)\
**Post date:** [December 24, 2024, 5:11am UTC](https://forum.code.org/t/unit-6-lesson-2-level-8b-chatbot/40258/1 "2024-12-24T05:11:05Z")

</div>

Anyone else having problems with the test on this level?

Here’s my current project code:

> **[New Java Lab Project - Code.org](https://studio.code.org/projects/javalab/YRUqba2uEbD1m4bquUcJfqTHNk2u-DwSulxTVe56PbE)**
>
> Anyone can learn computer science. Make games, apps and art with code.

I tried a few different ways to solve it, including guarding against not finding a match and, in that case, not adding anything to the result String.

Students are also having problems with the test on 8A.

The expected test result seems to match the output of the test of my code, but the error seems to be in the class they use for testing the level (ChatBotTest.Java).

---

<div class="post-metadata">

**Author:** ![a112032](https://avatars.discourse-cdn.com/v4/letter/a/b5ac83/32.png) [@a112032](https://forum.code.org/u/a112032)\
**Post date:** [December 24, 2024, 6:16am UTC](https://forum.code.org/t/unit-6-lesson-2-level-8b-chatbot/40258/2 "2024-12-24T06:16:36Z")

</div>

On a second pass through, it looks like the problem is that there’s duplicate words with different parts of speech. The test expects the last entry to be returned when mine returns the first entry.

---

<div class="post-metadata">

**Author:** ![sylvia.wood](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/sylvia.wood/32/5622_2.png) [@sylvia.wood](https://forum.code.org/u/sylvia.wood)\
**Post date:** [January 6, 2025, 2:15am UTC](https://forum.code.org/t/unit-6-lesson-2-level-8b-chatbot/40258/3 "2025-01-06T02:15:37Z")

</div>

@a112032 Mr. Johnson-Myers - thank you for you post. I am wondering if you compared your solution’s logic with the [Example](https://studio.code.org/s/csa6-2024/lessons/2/levels/8/sublevel/2?exemplar=true) solution?

The solution example works as intended. Please let us know if this helps.  
Sylvia

---

<div class="post-metadata">

**Author:** ![a112032](https://avatars.discourse-cdn.com/v4/letter/a/b5ac83/32.png) [@a112032](https://forum.code.org/u/a112032)\
**Post date:** [January 6, 2025, 6:37am UTC](https://forum.code.org/t/unit-6-lesson-2-level-8b-chatbot/40258/4 "2025-01-06T06:37:24Z")

</div>

Interesting, thanks. I see the difference now - they return a String for multiple matches where we were returning the first match.

The message from failing the test was not very clear.

Thanks for taking the time to look at this.

---

<div class="post-metadata">

**Author:** ![sylvia.wood](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/sylvia.wood/32/5622_2.png) [@sylvia.wood](https://forum.code.org/u/sylvia.wood)\
**Post date:** [January 13, 2025, 2:54am UTC](https://forum.code.org/t/unit-6-lesson-2-level-8b-chatbot/40258/5 "2025-01-13T02:54:00Z")

</div>

@a112032 - You are welcome. I will share you insights with the curriculum team.  
Sylvia
