Capstone40 min+50 XP

Track project: Command brain

Give Vault Breaker a smart parser that understands commands it was never told about.

0% done

Code runs right here in your browser. Nothing to install.

TASK 1

Mission briefing

Key idea

Commands that share the most words with an example get its verb.

"grab that keycard"{grab, that, keycard}words()grab the torch  (take)similarity 0.2take the key  (take)similarity 0go north  (go)similarity 0show my bag  (inv)similarity 0takebest match wins
How the command brain classifies "grab that keycard".
1Titlescreen2Playerprofile3Main menuloop4Combatsystem5Inventoryand map6The vaultworld7Move thegame home8Scoreanalyser9Thecipherlock10Save andload11Heroesandenemies12Leaderboardengine13VaultBreaker1.014Achievements15Datareport16Onlineleaderboard17Commandbrainyou are here
Vault Breaker milestones. You are building number 17 of 17.

Players type things like "walk to the north door" or "grab that keycard", but your parser only understands go and take. In this project you build a tiny text classifier that learns from examples which verb a command means.

It uses nearest neighbours with words instead of numbers: two commands are similar if they share words. The Jaccard similarity is the number of shared words divided by the number of different words in both: len(a & b) / len(a | b).

Real life linkVoice assistants do not have a list of every sentence you might say. They learn from examples and match what you said to the nearest meaning.
TASK 2

Capture the flag

+10 XP

"take the key" and "take the torch" share 2 words out of 4 different words. What is their Jaccard similarity? (a decimal)

Create a free account to start this lab

Sign in to answer the flag question. Your progress, XP and code are saved to your account. No card needed.

MILESTONE

Build the command brain

+20 XP

Using the EXAMPLES training data:

  • write words(text) that returns a set of lowercase words with punctuation removed
  • write similarity(a, b) that returns the Jaccard similarity of two word sets
  • write classify(command) that returns the verb of the most similar example, or "unknown" if the best similarity is 0
  • test it on the TESTS list, printing walk to the north door -> go and so on, then the accuracy as Accuracy: 5/6 or better

Create a free account to start this lab

Sign in to do this homework and have it checked. Your progress, XP and code are saved to your account. No card needed.