SECTION 11 / 17

Find a pronoun’s person: search backwards

2 min read
On this page 1 headings

A pronoun such as he or his can refer to a person mentioned earlier. Our word cards preserve the paragraph’s order with SerialNumber. The task asks about meaning, so the nearest ordinary noun is not enough: “eyes”, “Monday” and “calendar” are nouns but not the person named Swaminathan.

At “his” in position 9, look backwards past “open”, “to”, “reluctant” and “was” to the name Swaminathan in position 4.
At “his” in position 9, look backwards past “open”, “to”, “reluctant” and “was” to the name Swaminathan in position 4.
REAL COURSE DATA · THINK BEFORE EACH STEP

Search backwards for a person name

Trace the records, compare the methods and watch what changes. Back and Reset let you try again.

Ready

CURRENT RECORD X

Ready to begin

Choose Next step to follow the actual course records.

What we remember

Processed
0

Start with Next step. Predict what changes before reading the explanation.

For this small demonstration, we explicitly recognize the person names Swaminathan and Vedanayagam. PartOfSpeech = Noun alone does not tell us which nouns are people. A larger language system would need more information. The nearest-person-name rule produces a candidate; later lessons here show when that rule fails.

The outer loop and the inner loop

The outer loop reads the paragraph forwards. When a relevant pronoun is found, the inner loop searches earlier words backwards. After finding a candidate, restore the searched cards, return to the marked pronoun and resume the outer loop after it. Without a position marker, you may repeat or skip words.

A word-search helper must return the original word order and the caller’s marked position, together with its answer.
A word-search helper must return the original word order and the caller’s marked position, together with its answer.

If the text has p pronouns and each backward scan may inspect up to n words, the search can revisit many cards. Physical restoration adds movements too. The order of a sentence is part of the information: changing it can change the meaning, unlike reordering cards when only their mark sum matters.

Try it yourself

At word 11, “He considered”, why not choose “eyes” at word 10?

Show explained answer

It is a noun, but not a person name. The simple person-name search passes it and reaches Swaminathan at position 4.

Try it yourself

What should the procedure return if it reaches the start without a suitable name?

Show explained answer

An explicit unresolved result. It should not invent a person or silently reuse an unrelated value.

Try it yourself

Why keep SerialNumber when showing words in a table?

Show explained answer

The position preserves text order and lets us locate the pronoun and preceding words even if another view is filtered or rearranged.

YOUR STUDY PROGRESS

Finished this section? Save your progress.

Back to top ↑