Ready to begin
No records have been processed. Start with Next step.

Follow the dictionary as its keys and values change. Predict each lookup or update before revealing the next step.
Ready
No records have been processed. Start with Next step.
Predict the next key, whether it already exists, and the value that will be stored.
partOfSpeech = {}
partOfSpeech["Noun"] = []
partOfSpeech["Pronoun"] = []
# Process word records in ascending SerialNumber.
foreach X in words {
if (X.PartOfSpeech == "Noun") {
partOfSpeech["Noun"] = partOfSpeech["Noun"] ++ [X.SerialNumber]
}
if (X.PartOfSpeech == "Pronoun") {
partOfSpeech["Pronoun"] = partOfSpeech["Pronoun"] ++ [X.SerialNumber]
}
}The dataset field is SerialNumber, beginning at 0. The slides use SerialNo for the same position role. Our lab maps the concept to the actual field. It uses the supplied part-of-speech labels without retagging the text. There are 21 Noun records and 7 Pronoun records.
The noun positions are sorted because the INPUT is processed in ascending position and positions are appended. A dictionary does not sort the contents of a list value for you. If word cards arrive shuffled, restore position order before relying on the early-exit matcher.
What does partOfSpeech[Pronoun] contain?
A list of word positions, not a list of pronoun spellings and not a dictionary count.
Does the dictionary’s key order determine the list’s order?
No. The input scan and append order determine the list order.
Why create both keys with [] first?
Appending is safe even before the first noun or pronoun is encountered. A key can exist with an empty list value.