Please enable JavaScript to use CodeHS

AP Computer Science A (Cortado)

Magpie 2.0 Lab

Students explore the foundations of chatbot technology by learning about natural language processing (NLP) and analyzing different types of chatbot interactions. They then progressively build and refine a chatbot in Java, enhancing it with random responses, keyword detection, string transformation, and arrays to simulate increasingly sophisticated conversation behaviors.

All but Activity 5 of this lab can be used after Unit 2: Selection and Iteration in Cortado, Unit 4: Iteration in Nitro, and Unit 2: Basic Java in Mocha.

Activity 5, which includes arrays, can be used after completing basic array creation lessons.

Lessons

7.1 Activity 1 - Familiarizing Yourself with Chatbots

  • Familiarizing Yourself with Chatbots Part A
  • Familiarizing Yourself with Chatbots Part B

7.2 Activity 2 - Introduction to the Magpie Class

  • Introduction to the Magpie Class Part A
  • Activity 2A - Check for Understanding
  • Introduction to the Magpie Class Part B
  • Introduction to the Magpie Class Part C
  • Activity 2C - Check for Understanding

7.3 Activity 3 - Responses That Transform Statements

  • Responses That Transform Statements Part A
  • Activity 3A - Check for Understanding
  • Responses That Transform Statements Part B
  • Responses That Transform Statements Part C

7.4 Activity 4 - Find and Replace

  • Find and Replace Part A
  • Find and Replace Part B

7.5 Activity 5 - Arrays and Magpie

  • Arrays and Magpie Part A
  • Activity 5A - Check for Understanding
  • Arrays and Magpie Part B
  • Activity 5B - Check for Understanding

Courses that include this module