def decide_pipeline_patterns( parsed: ParsedQuestion, doc_profile: DocumentProfile, ) -> Activations: activations = dict(DEFAULT_ACTIVATIONS) # TOC retrieval: enable whenever the document has a usable TOC. if doc_profile.has_usable_toc: activations["toc_retrieval"] = True # Dense retrieval (embeddings): only as a fallback for questions whose # vocabulary may not match the document's wording. if parsed.intent in ("open_scoped", "open_corpus_wide"): activations["dense_retrieval"] = True # Two-hop references: enable when the question carries a structural # hint that points outside its primary passage. if parsed.retrieval.section_hint or parsed.retrieval.layout_hint: activations["two_hop_references"] = True if parsed.intent in ("section_retrieval", "open_scoped"): activations["two_hop_references"] = True # Listing aggregation: enable when the question intent is listing. if parsed.intent == "listing": activations["listing_aggregation"] = True return activations