Skip to content
Aabha AI Academy

All courses · Course overview · Lesson sequence

Skip to lesson text

Answers and explanations · Build a source collection you can inspect

A. The windows are one two three and three four five. The start advances two words each time because size−overlap=2. Their spans are [0,13) and [8,23), respectively. Verify the slices in code rather than relying on these numbers for a different string. Adding a leading word shifts offsets, so the old chunk identity must remain tied to the old parent text/version.

from retrieval import Document
from methods import word_windows, paragraph_chunks
source = Document("words-v1", "Words", "one two three four five",
                  "synthetic://words", "1", "current", "public")
for chunk in word_windows(source, 3, 1):
    assert source.text[chunk.start:chunk.end] == chunk.text
    print(chunk.text, chunk.start, chunk.end)

B. The renewal paragraph exceeds 10 characters and is preserved with over_budget=True. Ask early. is exactly 10 characters and is not flagged. Use a new Document with the two-paragraph text and call paragraph_chunks(source, 10) to confirm. The chunker records an uncomfortable boundary decision instead of cutting the rule. Context selection can still reject the oversized chunk under a smaller quote budget, so ranking coverage and packet coverage must be measured separately.

C. 14 days has lost both the population and what the number measures. An authored representation could be Member type: Public. Maximum loan duration: 14 days. Preserve a source/version pointer to the actual row. This is manual conversion for a synthetic example, not proof that an arbitrary extractor reads every table correctly. Review headings, units, merged cells and footnotes when actual source formats are introduced.

D. Duplicate IDs with differing text are ambiguous, so the loader should reject them. For this lab, create a distinct version/ID after reviewing the change, mark the old record archived, rebuild chunks and verify only the intended current record enters the index. A checksum can detect a mismatch against a recorded byte sequence. It cannot prove truth, freshness, permission or authorship; those require separate evidence and process.

Return to this lesson