Skip to content
Aabha AI Academy

All courses · Course overview · Lesson sequence

Skip to lesson text

project/capstone_starter.py

"""Learner starter: implement a context-selection decision, then defend its limits."""

import argparse
import json
import sys

from capstone_reference import run_capstone


def learner_select(hits, max_quote_chars):
    """Return the select_context contract taught in Module 6.

    Required shape:
      packet: quote_only evidence packet with complete verbatim quotes
      budget_skipped_ids: list of candidate IDs omitted for budget
      conflicting_source_versions: dict mapping source to ambiguous versions

    You may reuse select_context as a baseline, then explain one deliberate
    alternative in your report. Do not invent confidence or resolve a source
    conflict by sorting arbitrary version strings. See Module 10 for the task.
    """
    raise NotImplementedError("Implement learner_select using the taught context contract, then rerun.")


def main():
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("--k", type=int, default=2)
    parser.add_argument("--max-quote-chars", type=int, default=400)
    arguments = parser.parse_args()
    try:
        result = run_capstone(arguments.k, arguments.max_quote_chars, selector=learner_select)
    except (NotImplementedError, ValueError) as error:
        print(str(error), file=sys.stderr)
        return 2
    print(json.dumps(result, indent=2, ensure_ascii=False))
    return 0


if __name__ == "__main__":
    raise SystemExit(main())

Download this source file