infinity-context 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- infinity_context-0.1.0.dist-info/METADATA +239 -0
- infinity_context-0.1.0.dist-info/RECORD +1053 -0
- infinity_context-0.1.0.dist-info/WHEEL +5 -0
- infinity_context-0.1.0.dist-info/entry_points.txt +9 -0
- infinity_context-0.1.0.dist-info/licenses/LICENSE +201 -0
- infinity_context-0.1.0.dist-info/top_level.txt +8 -0
- infinity_context_adapters/__init__.py +1 -0
- infinity_context_adapters/cognee/__init__.py +5 -0
- infinity_context_adapters/cognee/adapter.py +364 -0
- infinity_context_adapters/embeddings/__init__.py +6 -0
- infinity_context_adapters/embeddings/noop_adapter.py +5 -0
- infinity_context_adapters/embeddings/openai_adapter.py +104 -0
- infinity_context_adapters/extraction/__init__.py +41 -0
- infinity_context_adapters/extraction/content.py +828 -0
- infinity_context_adapters/extraction/docling_engine.py +255 -0
- infinity_context_adapters/extraction/document_normalization.py +434 -0
- infinity_context_adapters/extraction/factory.py +69 -0
- infinity_context_adapters/extraction/fallback_context.py +137 -0
- infinity_context_adapters/extraction/file_detection.py +378 -0
- infinity_context_adapters/extraction/image_evidence.py +319 -0
- infinity_context_adapters/extraction/media_tools.py +579 -0
- infinity_context_adapters/extraction/openai_json.py +356 -0
- infinity_context_adapters/extraction/openai_vision.py +722 -0
- infinity_context_adapters/extraction/prompts/__init__.py +1 -0
- infinity_context_adapters/extraction/prompts/semantic_memory_v1.md +20 -0
- infinity_context_adapters/extraction/schemas/__init__.py +1 -0
- infinity_context_adapters/extraction/schemas/semantic_memory_v1.json +62 -0
- infinity_context_adapters/extraction/transcription/__init__.py +11 -0
- infinity_context_adapters/extraction/transcription/openai_adapter.py +400 -0
- infinity_context_adapters/extraction/transcription_engine.py +544 -0
- infinity_context_adapters/extraction/video_evidence.py +129 -0
- infinity_context_adapters/extraction/whisper_engine.py +386 -0
- infinity_context_adapters/features/__init__.py +7 -0
- infinity_context_adapters/features/context_building/__init__.py +53 -0
- infinity_context_adapters/features/context_building/candidate_provider_chain.py +68 -0
- infinity_context_adapters/features/context_building/graphiti_candidate_provider.py +44 -0
- infinity_context_adapters/features/context_building/in_memory_candidate_provider.py +62 -0
- infinity_context_adapters/features/context_building/postgres_candidate_provider.py +44 -0
- infinity_context_adapters/features/context_building/qdrant_candidate_provider.py +44 -0
- infinity_context_adapters/features/context_building/query_request.py +99 -0
- infinity_context_adapters/features/context_building/records.py +113 -0
- infinity_context_adapters/features/document_ingestion/__init__.py +74 -0
- infinity_context_adapters/features/document_ingestion/composition.py +69 -0
- infinity_context_adapters/features/document_ingestion/extraction_adapter.py +114 -0
- infinity_context_adapters/features/document_ingestion/in_memory_chunk_index.py +67 -0
- infinity_context_adapters/features/document_ingestion/in_memory_document_store.py +176 -0
- infinity_context_adapters/features/document_ingestion/postgres_document_store.py +110 -0
- infinity_context_adapters/features/document_ingestion/qdrant_chunk_index.py +49 -0
- infinity_context_adapters/features/document_ingestion/records.py +88 -0
- infinity_context_adapters/features/memory_facts/__init__.py +53 -0
- infinity_context_adapters/features/memory_facts/graphiti_fact_projection.py +111 -0
- infinity_context_adapters/features/memory_facts/in_memory_fact_store.py +200 -0
- infinity_context_adapters/features/memory_facts/postgres_fact_store.py +126 -0
- infinity_context_adapters/features/memory_facts/qdrant_fact_projection.py +100 -0
- infinity_context_adapters/features/memory_scopes/__init__.py +44 -0
- infinity_context_adapters/features/memory_scopes/in_memory_scope_store.py +189 -0
- infinity_context_adapters/features/memory_scopes/postgres_scope_store.py +121 -0
- infinity_context_adapters/features/memory_scopes/records.py +86 -0
- infinity_context_adapters/graphiti/__init__.py +5 -0
- infinity_context_adapters/graphiti/adapter.py +613 -0
- infinity_context_adapters/graphiti/identity_evidence.py +711 -0
- infinity_context_adapters/graphiti/scope_identity.py +31 -0
- infinity_context_adapters/local_blob.py +101 -0
- infinity_context_adapters/noop/__init__.py +16 -0
- infinity_context_adapters/noop/adapters.py +156 -0
- infinity_context_adapters/noop/runtime.py +21 -0
- infinity_context_adapters/postgres/__init__.py +19 -0
- infinity_context_adapters/postgres/asset_mappers.py +348 -0
- infinity_context_adapters/postgres/asset_repositories.py +865 -0
- infinity_context_adapters/postgres/benchmark_projection_schema.py +241 -0
- infinity_context_adapters/postgres/benchmark_run_completion.py +645 -0
- infinity_context_adapters/postgres/benchmark_run_repositories.py +908 -0
- infinity_context_adapters/postgres/benchmark_writer_fence.py +139 -0
- infinity_context_adapters/postgres/canonical_keyword_trigram.py +31 -0
- infinity_context_adapters/postgres/canonical_retrieval_batching.py +388 -0
- infinity_context_adapters/postgres/fact_repositories.py +766 -0
- infinity_context_adapters/postgres/mappers.py +745 -0
- infinity_context_adapters/postgres/migrations/0001_core_facts.sql +95 -0
- infinity_context_adapters/postgres/migrations/0002_threads_documents_chunks.sql +97 -0
- infinity_context_adapters/postgres/migrations/0003_suggestions.sql +24 -0
- infinity_context_adapters/postgres/migrations/0004_service_tokens.sql +16 -0
- infinity_context_adapters/postgres/migrations/0005_data_classification_lite.sql +8 -0
- infinity_context_adapters/postgres/migrations/0006_service_token_usage_metadata.sql +5 -0
- infinity_context_adapters/postgres/migrations/0007_service_token_permissions.sql +2 -0
- infinity_context_adapters/postgres/migrations/0008_service_token_memory_scope.sql +2 -0
- infinity_context_adapters/postgres/migrations/0009_outbox_lifecycle_hardening.sql +15 -0
- infinity_context_adapters/postgres/migrations/0010_fact_taxonomy.sql +14 -0
- infinity_context_adapters/postgres/migrations/0011_asset_extractions.sql +66 -0
- infinity_context_adapters/postgres/migrations/0012_asset_extraction_execution_hardening.sql +20 -0
- infinity_context_adapters/postgres/migrations/0012_usage_governance.sql +33 -0
- infinity_context_adapters/postgres/migrations/0013_context_link_suggestions.sql +44 -0
- infinity_context_adapters/postgres/migrations/0014_memory_anchors.sql +26 -0
- infinity_context_adapters/postgres/migrations/0015_users_acl.sql +36 -0
- infinity_context_adapters/postgres/migrations/0016_managed_benchmark_runs.sql +27 -0
- infinity_context_adapters/postgres/migrations/0017_managed_benchmark_writer_fence.sql +104 -0
- infinity_context_adapters/postgres/migrations/0018_benchmark_projection_manifest.sql +51 -0
- infinity_context_adapters/postgres/migrations/0019_managed_benchmark_sealed_fence.sql +131 -0
- infinity_context_adapters/postgres/migrations/0020_benchmark_cleanup_completion.sql +219 -0
- infinity_context_adapters/postgres/migrations/0021_benchmark_unsealed_abort.sql +64 -0
- infinity_context_adapters/postgres/migrations/0022_canonical_keyword_trigram.sql +5 -0
- infinity_context_adapters/postgres/models.py +878 -0
- infinity_context_adapters/postgres/projection_fence.py +80 -0
- infinity_context_adapters/postgres/repositories.py +906 -0
- infinity_context_adapters/postgres/repository_helpers.py +115 -0
- infinity_context_adapters/postgres/scope_repositories.py +540 -0
- infinity_context_adapters/postgres/unit_of_work.py +785 -0
- infinity_context_adapters/postgres/usage_repositories.py +128 -0
- infinity_context_adapters/postgres/user_repositories.py +164 -0
- infinity_context_adapters/provider_errors.py +73 -0
- infinity_context_adapters/qdrant/__init__.py +5 -0
- infinity_context_adapters/qdrant/identity_evidence.py +504 -0
- infinity_context_adapters/qdrant/vector_adapter.py +718 -0
- infinity_context_adapters/s3_blob.py +242 -0
- infinity_context_cli/__init__.py +5 -0
- infinity_context_cli/__main__.py +6 -0
- infinity_context_cli/cli.py +964 -0
- infinity_context_cli/config.py +184 -0
- infinity_context_cli/doctor.py +397 -0
- infinity_context_cli/local_experience.py +250 -0
- infinity_context_cli/mcp_config.py +124 -0
- infinity_context_cli/onboarding.py +542 -0
- infinity_context_cli/runtime.py +179 -0
- infinity_context_contracts/__init__.py +16 -0
- infinity_context_contracts/_json.py +32 -0
- infinity_context_contracts/capabilities.py +67 -0
- infinity_context_contracts/common.py +54 -0
- infinity_context_contracts/features/__init__.py +12 -0
- infinity_context_contracts/features/context_building.py +248 -0
- infinity_context_contracts/features/document_ingestion.py +277 -0
- infinity_context_contracts/features/memory_facts.py +236 -0
- infinity_context_contracts/features/memory_scopes.py +329 -0
- infinity_context_contracts/health.py +23 -0
- infinity_context_core/__init__.py +76 -0
- infinity_context_core/agent_behavior_contract.py +72 -0
- infinity_context_core/application/__init__.py +580 -0
- infinity_context_core/application/anchor_creative_work_filters.py +148 -0
- infinity_context_core/application/anchor_event_extraction.py +1571 -0
- infinity_context_core/application/anchor_extraction.py +1144 -0
- infinity_context_core/application/anchor_identity_normalization.py +90 -0
- infinity_context_core/application/anchor_relation_projection.py +203 -0
- infinity_context_core/application/anchor_temporal_window.py +172 -0
- infinity_context_core/application/asset_extraction_mapping.py +236 -0
- infinity_context_core/application/asset_upload_policy.py +952 -0
- infinity_context_core/application/auto_apply.py +72 -0
- infinity_context_core/application/auto_memory.py +527 -0
- infinity_context_core/application/capture_policy.py +61 -0
- infinity_context_core/application/chunker.py +93 -0
- infinity_context_core/application/context_action_role_evidence.py +890 -0
- infinity_context_core/application/context_action_role_labels.py +176 -0
- infinity_context_core/application/context_action_roles.py +2365 -0
- infinity_context_core/application/context_action_subject_policy.py +71 -0
- infinity_context_core/application/context_activity_companion.py +120 -0
- infinity_context_core/application/context_activity_duration_rerank.py +118 -0
- infinity_context_core/application/context_activity_participant_grounding.py +87 -0
- infinity_context_core/application/context_aggregation_answer_slots.py +586 -0
- infinity_context_core/application/context_aggregation_evidence_text.py +409 -0
- infinity_context_core/application/context_aggregation_rerank.py +145 -0
- infinity_context_core/application/context_aggregation_subject.py +137 -0
- infinity_context_core/application/context_allergy_condition_inference.py +146 -0
- infinity_context_core/application/context_anchor_identity.py +157 -0
- infinity_context_core/application/context_anchor_intent_ranking.py +84 -0
- infinity_context_core/application/context_anchor_relations.py +67 -0
- infinity_context_core/application/context_anchors.py +393 -0
- infinity_context_core/application/context_answer_evidence_types.py +14 -0
- infinity_context_core/application/context_answer_unit_shapes.py +207 -0
- infinity_context_core/application/context_artifact_evidence.py +893 -0
- infinity_context_core/application/context_attribution_lexicon.py +254 -0
- infinity_context_core/application/context_awareness_cause_rerank.py +109 -0
- infinity_context_core/application/context_baby_birth_evidence.py +91 -0
- infinity_context_core/application/context_birdwatching_schedule_rerank.py +130 -0
- infinity_context_core/application/context_bm25_ranking.py +450 -0
- infinity_context_core/application/context_book_author_preference_exact_turns.py +110 -0
- infinity_context_core/application/context_building_legacy_candidate_adapter.py +530 -0
- infinity_context_core/application/context_canonical_fact_retrieval.py +409 -0
- infinity_context_core/application/context_causal_reason_rerank.py +145 -0
- infinity_context_core/application/context_choice_reason_rerank.py +109 -0
- infinity_context_core/application/context_collectors.py +931 -0
- infinity_context_core/application/context_commonality_rerank.py +428 -0
- infinity_context_core/application/context_community_membership_inference.py +139 -0
- infinity_context_core/application/context_competition_count_exact_turns.py +383 -0
- infinity_context_core/application/context_conflicting_evidence_rerank.py +282 -0
- infinity_context_core/application/context_conversation_counterparty.py +260 -0
- infinity_context_core/application/context_count_cardinality.py +164 -0
- infinity_context_core/application/context_creative_work_count_exact_turns.py +517 -0
- infinity_context_core/application/context_diagnostics.py +55 -0
- infinity_context_core/application/context_diagnostics_bundle_keys.py +433 -0
- infinity_context_core/application/context_diagnostics_bundle_projection.py +711 -0
- infinity_context_core/application/context_diagnostics_item_projection.py +410 -0
- infinity_context_core/application/context_diagnostics_primitives.py +131 -0
- infinity_context_core/application/context_diagnostics_ranking.py +143 -0
- infinity_context_core/application/context_diagnostics_signals.py +209 -0
- infinity_context_core/application/context_diagnostics_sources.py +82 -0
- infinity_context_core/application/context_dialogue_authority.py +382 -0
- infinity_context_core/application/context_distinct_set_evidence.py +994 -0
- infinity_context_core/application/context_distinct_set_selection.py +335 -0
- infinity_context_core/application/context_domain_rerank_apply.py +310 -0
- infinity_context_core/application/context_domain_rerank_signals.py +2391 -0
- infinity_context_core/application/context_domain_rerank_types.py +14 -0
- infinity_context_core/application/context_english_activity_displacement_answer_support.py +128 -0
- infinity_context_core/application/context_english_lifestyle_inference.py +122 -0
- infinity_context_core/application/context_english_lifestyle_inference_answer_support.py +291 -0
- infinity_context_core/application/context_english_temporal_dates.py +53 -0
- infinity_context_core/application/context_evidence_priority.py +262 -0
- infinity_context_core/application/context_evidence_reservation_safety.py +208 -0
- infinity_context_core/application/context_exercise_performance_rerank.py +71 -0
- infinity_context_core/application/context_food_inventory_exact_turns.py +583 -0
- infinity_context_core/application/context_frequency_rerank.py +109 -0
- infinity_context_core/application/context_future_plan_timing_rerank.py +110 -0
- infinity_context_core/application/context_generic_behavior_inference.py +348 -0
- infinity_context_core/application/context_geo_residence_aliases.py +149 -0
- infinity_context_core/application/context_hydration.py +329 -0
- infinity_context_core/application/context_identity_fact_rerank.py +362 -0
- infinity_context_core/application/context_identity_rerank.py +76 -0
- infinity_context_core/application/context_identity_terms.py +15 -0
- infinity_context_core/application/context_inference_evidence.py +484 -0
- infinity_context_core/application/context_inference_evidence_terms.py +744 -0
- infinity_context_core/application/context_internal_diagnostics.py +61 -0
- infinity_context_core/application/context_item_evidence.py +108 -0
- infinity_context_core/application/context_item_purchase_evidence.py +49 -0
- infinity_context_core/application/context_keyword_aggregation_prefilter.py +63 -0
- infinity_context_core/application/context_keyword_ranking.py +178 -0
- infinity_context_core/application/context_lexical.py +750 -0
- infinity_context_core/application/context_lifecycle_rerank.py +502 -0
- infinity_context_core/application/context_link_candidate_policy.py +864 -0
- infinity_context_core/application/context_link_expansion.py +727 -0
- infinity_context_core/application/context_link_expansion_items.py +441 -0
- infinity_context_core/application/context_link_policy.py +451 -0
- infinity_context_core/application/context_link_source_enrichment.py +120 -0
- infinity_context_core/application/context_media_time.py +368 -0
- infinity_context_core/application/context_museum_visit_policy.py +66 -0
- infinity_context_core/application/context_named_person_preference.py +313 -0
- infinity_context_core/application/context_national_park_inference.py +93 -0
- infinity_context_core/application/context_object_attribute_rerank.py +416 -0
- infinity_context_core/application/context_object_mismatch.py +63 -0
- infinity_context_core/application/context_occupational_role_identity.py +961 -0
- infinity_context_core/application/context_ordinal_sequence.py +134 -0
- infinity_context_core/application/context_owner_grounding.py +408 -0
- infinity_context_core/application/context_packer.py +858 -0
- infinity_context_core/application/context_packer_answer_slots.py +733 -0
- infinity_context_core/application/context_packer_answer_support.py +3101 -0
- infinity_context_core/application/context_packer_answer_support_patterns.py +1267 -0
- infinity_context_core/application/context_packer_answer_support_slots.py +1209 -0
- infinity_context_core/application/context_packer_answer_support_utils.py +473 -0
- infinity_context_core/application/context_packer_diagnostics.py +48 -0
- infinity_context_core/application/context_packer_exact_literal_turns.py +697 -0
- infinity_context_core/application/context_packer_exact_prepasses.py +758 -0
- infinity_context_core/application/context_packer_exact_turn_utils.py +133 -0
- infinity_context_core/application/context_packer_identity_policy.py +155 -0
- infinity_context_core/application/context_packer_inference_reservation.py +113 -0
- infinity_context_core/application/context_packer_inventory_prepasses.py +359 -0
- infinity_context_core/application/context_packer_inventory_slots.py +771 -0
- infinity_context_core/application/context_packer_marker_coverage.py +409 -0
- infinity_context_core/application/context_packer_rendering.py +338 -0
- infinity_context_core/application/context_packer_selection.py +487 -0
- infinity_context_core/application/context_packer_source_policy.py +123 -0
- infinity_context_core/application/context_paired_evidence_requirements.py +78 -0
- infinity_context_core/application/context_paired_evidence_roles.py +64 -0
- infinity_context_core/application/context_person_activity_exact_turns.py +375 -0
- infinity_context_core/application/context_person_aliases.py +49 -0
- infinity_context_core/application/context_person_kinship.py +296 -0
- infinity_context_core/application/context_person_occupation.py +240 -0
- infinity_context_core/application/context_person_relation_inventory.py +755 -0
- infinity_context_core/application/context_person_residence.py +398 -0
- infinity_context_core/application/context_person_team_membership.py +305 -0
- infinity_context_core/application/context_pet_ownership.py +223 -0
- infinity_context_core/application/context_polarity_rerank.py +338 -0
- infinity_context_core/application/context_policy.py +107 -0
- infinity_context_core/application/context_political_inference.py +128 -0
- infinity_context_core/application/context_possession_source.py +161 -0
- infinity_context_core/application/context_precise_temporal_evidence.py +156 -0
- infinity_context_core/application/context_preference_goal_rerank.py +428 -0
- infinity_context_core/application/context_preference_inference.py +335 -0
- infinity_context_core/application/context_property_interaction_evidence.py +659 -0
- infinity_context_core/application/context_provider_retrieval_terms.py +95 -0
- infinity_context_core/application/context_quality.py +488 -0
- infinity_context_core/application/context_quantity_evidence_patterns.py +254 -0
- infinity_context_core/application/context_quantity_evidence_slots.py +750 -0
- infinity_context_core/application/context_quantity_pending_clothing.py +200 -0
- infinity_context_core/application/context_query_artifact_inventory_expansions.py +76 -0
- infinity_context_core/application/context_query_decomposition.py +879 -0
- infinity_context_core/application/context_query_decomposition_answer_policy.py +707 -0
- infinity_context_core/application/context_query_decomposition_contracts.py +28 -0
- infinity_context_core/application/context_query_decomposition_event_policy.py +535 -0
- infinity_context_core/application/context_query_decomposition_inventory_policy.py +767 -0
- infinity_context_core/application/context_query_decomposition_shared.py +300 -0
- infinity_context_core/application/context_query_duration.py +171 -0
- infinity_context_core/application/context_query_entity_relation_expansions.py +212 -0
- infinity_context_core/application/context_query_event_summary_expansions.py +80 -0
- infinity_context_core/application/context_query_expansion.py +200 -0
- infinity_context_core/application/context_query_expansion_rule_catalog_part1.py +1279 -0
- infinity_context_core/application/context_query_expansion_rule_catalog_part2.py +770 -0
- infinity_context_core/application/context_query_expansion_rule_catalog_part3.py +982 -0
- infinity_context_core/application/context_query_expansion_rule_catalog_part4.py +1334 -0
- infinity_context_core/application/context_query_expansion_rule_catalog_part5.py +517 -0
- infinity_context_core/application/context_query_expansion_rule_terms.py +269 -0
- infinity_context_core/application/context_query_expansion_rules.py +66 -0
- infinity_context_core/application/context_query_expansion_selection.py +892 -0
- infinity_context_core/application/context_query_financial_resources_inference.py +92 -0
- infinity_context_core/application/context_query_food_expansions.py +89 -0
- infinity_context_core/application/context_query_frequency.py +194 -0
- infinity_context_core/application/context_query_game_expansions.py +141 -0
- infinity_context_core/application/context_query_health_lifestyle_expansions.py +178 -0
- infinity_context_core/application/context_query_identity_terms.py +81 -0
- infinity_context_core/application/context_query_intent.py +33 -0
- infinity_context_core/application/context_query_intent_common.py +29 -0
- infinity_context_core/application/context_query_intent_contracts.py +92 -0
- infinity_context_core/application/context_query_intent_extraction.py +614 -0
- infinity_context_core/application/context_query_intent_keys.py +499 -0
- infinity_context_core/application/context_query_intent_matching.py +407 -0
- infinity_context_core/application/context_query_organization_summary_expansions.py +75 -0
- infinity_context_core/application/context_query_personal_fact_expansions.py +314 -0
- infinity_context_core/application/context_query_pet_activity_expansions.py +329 -0
- infinity_context_core/application/context_query_preference_expansions.py +97 -0
- infinity_context_core/application/context_query_project_summary_expansions.py +60 -0
- infinity_context_core/application/context_query_relevance_ranking.py +76 -0
- infinity_context_core/application/context_query_sports_expansions.py +48 -0
- infinity_context_core/application/context_query_state_transition.py +53 -0
- infinity_context_core/application/context_query_support_role.py +165 -0
- infinity_context_core/application/context_query_temporal_expansions.py +18 -0
- infinity_context_core/application/context_query_travel_expansions.py +134 -0
- infinity_context_core/application/context_query_vehicle_expansions.py +79 -0
- infinity_context_core/application/context_query_workflow_expansions.py +233 -0
- infinity_context_core/application/context_query_workflow_intent.py +65 -0
- infinity_context_core/application/context_quote_scanner.py +342 -0
- infinity_context_core/application/context_rank_dedupe.py +171 -0
- infinity_context_core/application/context_rank_fusion.py +191 -0
- infinity_context_core/application/context_ranked_activity_reservation.py +586 -0
- infinity_context_core/application/context_ranked_evidence_coverage_reservation.py +427 -0
- infinity_context_core/application/context_ranked_evidence_priority_reservation.py +37 -0
- infinity_context_core/application/context_ranked_evidence_selection.py +260 -0
- infinity_context_core/application/context_ranking.py +3681 -0
- infinity_context_core/application/context_ranking_reason_policy.py +31 -0
- infinity_context_core/application/context_ranking_reason_priorities.py +859 -0
- infinity_context_core/application/context_ranking_reason_scores.py +519 -0
- infinity_context_core/application/context_recommendation_answer_support.py +358 -0
- infinity_context_core/application/context_recommendation_exact_turns.py +360 -0
- infinity_context_core/application/context_relation_requirement.py +498 -0
- infinity_context_core/application/context_relationship_status_evidence.py +83 -0
- infinity_context_core/application/context_relative_duration_evidence.py +61 -0
- infinity_context_core/application/context_relevance.py +430 -0
- infinity_context_core/application/context_reported_obligation_attribution.py +416 -0
- infinity_context_core/application/context_reporting_frames.py +338 -0
- infinity_context_core/application/context_requirement_coverage.py +767 -0
- infinity_context_core/application/context_requirement_guard.py +503 -0
- infinity_context_core/application/context_requirement_patterns.py +943 -0
- infinity_context_core/application/context_requirement_ranking.py +181 -0
- infinity_context_core/application/context_requirement_signals.py +101 -0
- infinity_context_core/application/context_rerank_domain_heuristics.py +433 -0
- infinity_context_core/application/context_rerank_evidence_signals.py +400 -0
- infinity_context_core/application/context_rerank_relevance.py +131 -0
- infinity_context_core/application/context_retrieval_performance.py +153 -0
- infinity_context_core/application/context_review_items.py +338 -0
- infinity_context_core/application/context_score_signal_rerank.py +21 -0
- infinity_context_core/application/context_short_story_progress_evidence.py +119 -0
- infinity_context_core/application/context_snippets.py +545 -0
- infinity_context_core/application/context_social_education_inference.py +265 -0
- infinity_context_core/application/context_social_inventory_rerank.py +329 -0
- infinity_context_core/application/context_source_family.py +100 -0
- infinity_context_core/application/context_source_grounding.py +277 -0
- infinity_context_core/application/context_source_sibling_answer_evidence_repair.py +1983 -0
- infinity_context_core/application/context_source_sibling_contracts.py +35 -0
- infinity_context_core/application/context_source_sibling_evidence.py +405 -0
- infinity_context_core/application/context_source_sibling_evidence_rules.py +798 -0
- infinity_context_core/application/context_source_sibling_evidence_shared.py +449 -0
- infinity_context_core/application/context_source_sibling_identity.py +114 -0
- infinity_context_core/application/context_source_sibling_inventory_evidence.py +28 -0
- infinity_context_core/application/context_source_sibling_patterns.py +946 -0
- infinity_context_core/application/context_source_sibling_place_evidence.py +561 -0
- infinity_context_core/application/context_source_sibling_policy.py +988 -0
- infinity_context_core/application/context_source_sibling_scoring.py +721 -0
- infinity_context_core/application/context_source_siblings.py +363 -0
- infinity_context_core/application/context_speaker_attribution.py +574 -0
- infinity_context_core/application/context_speaker_disambiguation.py +108 -0
- infinity_context_core/application/context_stage_diagnostics.py +111 -0
- infinity_context_core/application/context_state_evidence.py +196 -0
- infinity_context_core/application/context_state_residence_inference.py +163 -0
- infinity_context_core/application/context_state_transition_pairing.py +401 -0
- infinity_context_core/application/context_temporal_answer_grounding.py +187 -0
- infinity_context_core/application/context_temporal_hints.py +485 -0
- infinity_context_core/application/context_temporal_intent_policy.py +146 -0
- infinity_context_core/application/context_temporal_interval_requirements.py +107 -0
- infinity_context_core/application/context_temporal_metadata.py +29 -0
- infinity_context_core/application/context_temporal_query.py +1358 -0
- infinity_context_core/application/context_temporal_ranges.py +471 -0
- infinity_context_core/application/context_temporal_session_order.py +439 -0
- infinity_context_core/application/context_temporal_source_identity.py +426 -0
- infinity_context_core/application/context_temporal_source_turn.py +1290 -0
- infinity_context_core/application/context_temporal_source_turn_labels.py +265 -0
- infinity_context_core/application/context_temporal_source_turn_patterns.py +186 -0
- infinity_context_core/application/context_temporal_source_turn_types.py +62 -0
- infinity_context_core/application/context_travel_hobby_writing_evidence.py +176 -0
- infinity_context_core/application/context_travel_place_evidence.py +23 -0
- infinity_context_core/application/document_fragments.py +206 -0
- infinity_context_core/application/document_text.py +203 -0
- infinity_context_core/application/dto.py +311 -0
- infinity_context_core/application/dto_anchors.py +143 -0
- infinity_context_core/application/dto_assets.py +234 -0
- infinity_context_core/application/dto_benchmark_runs.py +114 -0
- infinity_context_core/application/dto_context.py +176 -0
- infinity_context_core/application/dto_context_links.py +170 -0
- infinity_context_core/application/dto_facts.py +275 -0
- infinity_context_core/application/dto_suggestions_capture.py +199 -0
- infinity_context_core/application/dto_workspace.py +101 -0
- infinity_context_core/application/extraction_coordinates.py +56 -0
- infinity_context_core/application/extraction_resource_policy.py +796 -0
- infinity_context_core/application/extractor.py +147 -0
- infinity_context_core/application/memory_digest_renderer.py +215 -0
- infinity_context_core/application/multimodal_manifest.py +418 -0
- infinity_context_core/application/normalize.py +29 -0
- infinity_context_core/application/observed_anchor_resolution.py +243 -0
- infinity_context_core/application/related_facts.py +144 -0
- infinity_context_core/application/review_payloads.py +104 -0
- infinity_context_core/application/safe_payload.py +86 -0
- infinity_context_core/application/semantic_dedupe.py +943 -0
- infinity_context_core/application/sensitive_text.py +39 -0
- infinity_context_core/application/source_refs.py +263 -0
- infinity_context_core/application/storage_key_safety.py +13 -0
- infinity_context_core/application/temporal_validity.py +31 -0
- infinity_context_core/application/use_cases/__init__.py +1 -0
- infinity_context_core/application/use_cases/anchors.py +1165 -0
- infinity_context_core/application/use_cases/asset_extraction_support.py +273 -0
- infinity_context_core/application/use_cases/asset_extractions.py +1454 -0
- infinity_context_core/application/use_cases/assets.py +463 -0
- infinity_context_core/application/use_cases/benchmark_runs.py +877 -0
- infinity_context_core/application/use_cases/benchmark_unsealed_abort.py +147 -0
- infinity_context_core/application/use_cases/blob_storage_cleanup.py +289 -0
- infinity_context_core/application/use_cases/blob_storage_integrity.py +351 -0
- infinity_context_core/application/use_cases/build_context.py +995 -0
- infinity_context_core/application/use_cases/build_context_final_packing.py +59 -0
- infinity_context_core/application/use_cases/build_context_item_projection.py +839 -0
- infinity_context_core/application/use_cases/build_context_keyword_aggregation.py +908 -0
- infinity_context_core/application/use_cases/build_context_keyword_aggregation_seeds.py +132 -0
- infinity_context_core/application/use_cases/build_context_keyword_aggregation_selection.py +280 -0
- infinity_context_core/application/use_cases/build_context_keyword_aggregation_support.py +161 -0
- infinity_context_core/application/use_cases/build_context_requirement_guard.py +156 -0
- infinity_context_core/application/use_cases/build_context_source_selection.py +935 -0
- infinity_context_core/application/use_cases/build_memory_digest.py +203 -0
- infinity_context_core/application/use_cases/build_memory_insights.py +979 -0
- infinity_context_core/application/use_cases/consolidate_capture.py +806 -0
- infinity_context_core/application/use_cases/context_link_crud.py +196 -0
- infinity_context_core/application/use_cases/context_link_reviews.py +441 -0
- infinity_context_core/application/use_cases/context_link_suggestions.py +1060 -0
- infinity_context_core/application/use_cases/context_link_visibility.py +106 -0
- infinity_context_core/application/use_cases/context_links.py +33 -0
- infinity_context_core/application/use_cases/delete_document.py +71 -0
- infinity_context_core/application/use_cases/delete_thread_memory.py +55 -0
- infinity_context_core/application/use_cases/duplicate_merge_resolution.py +307 -0
- infinity_context_core/application/use_cases/ensure_scope.py +29 -0
- infinity_context_core/application/use_cases/expire_suggestions.py +36 -0
- infinity_context_core/application/use_cases/export_graph.py +684 -0
- infinity_context_core/application/use_cases/fact_relations.py +204 -0
- infinity_context_core/application/use_cases/forget_fact.py +43 -0
- infinity_context_core/application/use_cases/get_capabilities.py +213 -0
- infinity_context_core/application/use_cases/get_capture.py +16 -0
- infinity_context_core/application/use_cases/get_session_status.py +23 -0
- infinity_context_core/application/use_cases/ingest_document.py +376 -0
- infinity_context_core/application/use_cases/ingest_episode.py +263 -0
- infinity_context_core/application/use_cases/list_captures.py +25 -0
- infinity_context_core/application/use_cases/memory_browser.py +414 -0
- infinity_context_core/application/use_cases/operations_console.py +293 -0
- infinity_context_core/application/use_cases/process_document.py +83 -0
- infinity_context_core/application/use_cases/purge_capture.py +34 -0
- infinity_context_core/application/use_cases/query_documents.py +42 -0
- infinity_context_core/application/use_cases/query_facts.py +57 -0
- infinity_context_core/application/use_cases/receive_capture.py +238 -0
- infinity_context_core/application/use_cases/related_facts.py +47 -0
- infinity_context_core/application/use_cases/remember_fact.py +145 -0
- infinity_context_core/application/use_cases/spaces_memory_scopes.py +134 -0
- infinity_context_core/application/use_cases/suggestions.py +804 -0
- infinity_context_core/application/use_cases/update_fact.py +43 -0
- infinity_context_core/application/use_cases/usage.py +49 -0
- infinity_context_core/application/use_cases/users.py +138 -0
- infinity_context_core/domain/__init__.py +1 -0
- infinity_context_core/domain/aggregation_admission.py +200 -0
- infinity_context_core/domain/anchor_entities.py +316 -0
- infinity_context_core/domain/assets.py +654 -0
- infinity_context_core/domain/capture.py +321 -0
- infinity_context_core/domain/distinct_set_membership.py +69 -0
- infinity_context_core/domain/entities.py +103 -0
- infinity_context_core/domain/entity_policies.py +119 -0
- infinity_context_core/domain/entity_types.py +150 -0
- infinity_context_core/domain/errors.py +53 -0
- infinity_context_core/domain/events.py +14 -0
- infinity_context_core/domain/extraction.py +529 -0
- infinity_context_core/domain/idempotency.py +12 -0
- infinity_context_core/domain/memory_item_entities.py +426 -0
- infinity_context_core/domain/source_refs.py +91 -0
- infinity_context_core/domain/suggestion_entities.py +236 -0
- infinity_context_core/domain/taxonomy.py +121 -0
- infinity_context_core/domain/usage.py +221 -0
- infinity_context_core/domain/workspace_entities.py +269 -0
- infinity_context_core/features/__init__.py +7 -0
- infinity_context_core/features/context_building/__init__.py +3 -0
- infinity_context_core/features/context_building/application/__init__.py +92 -0
- infinity_context_core/features/context_building/application/candidate_fusion.py +136 -0
- infinity_context_core/features/context_building/application/coverage_reservation_selector.py +212 -0
- infinity_context_core/features/context_building/application/handlers.py +155 -0
- infinity_context_core/features/context_building/application/inference_evidence_reservation.py +592 -0
- infinity_context_core/features/context_building/application/provider_pipeline.py +61 -0
- infinity_context_core/features/context_building/application/queries.py +107 -0
- infinity_context_core/features/context_building/application/use_cases.py +78 -0
- infinity_context_core/features/context_building/domain/__init__.py +95 -0
- infinity_context_core/features/context_building/domain/budget.py +97 -0
- infinity_context_core/features/context_building/domain/context.py +157 -0
- infinity_context_core/features/context_building/domain/evidence_obligations.py +60 -0
- infinity_context_core/features/context_building/domain/feature.py +15 -0
- infinity_context_core/features/context_building/domain/prompt_sections.py +150 -0
- infinity_context_core/features/context_building/domain/query_pipeline.py +276 -0
- infinity_context_core/features/context_building/domain/rendering.py +102 -0
- infinity_context_core/features/context_building/ports/__init__.py +8 -0
- infinity_context_core/features/context_building/ports/candidates.py +36 -0
- infinity_context_core/features/context_building/public.py +165 -0
- infinity_context_core/features/context_building/tests/test_application_ports_public_skeleton.py +575 -0
- infinity_context_core/features/context_building/tests/test_domain_context_building_skeleton.py +402 -0
- infinity_context_core/features/document_ingestion/__init__.py +3 -0
- infinity_context_core/features/document_ingestion/application/__init__.py +31 -0
- infinity_context_core/features/document_ingestion/application/commands.py +62 -0
- infinity_context_core/features/document_ingestion/application/use_cases.py +273 -0
- infinity_context_core/features/document_ingestion/domain/__init__.py +61 -0
- infinity_context_core/features/document_ingestion/domain/chunking.py +297 -0
- infinity_context_core/features/document_ingestion/domain/errors.py +22 -0
- infinity_context_core/features/document_ingestion/domain/feature.py +18 -0
- infinity_context_core/features/document_ingestion/domain/source_document.py +228 -0
- infinity_context_core/features/document_ingestion/ports/__init__.py +21 -0
- infinity_context_core/features/document_ingestion/ports/indexing.py +51 -0
- infinity_context_core/features/document_ingestion/ports/repositories.py +56 -0
- infinity_context_core/features/document_ingestion/public.py +95 -0
- infinity_context_core/features/document_ingestion/tests/test_application_handlers.py +226 -0
- infinity_context_core/features/document_ingestion/tests/test_application_ports_public_skeleton.py +334 -0
- infinity_context_core/features/document_ingestion/tests/test_domain_chunking_skeleton.py +79 -0
- infinity_context_core/features/document_ingestion/tests/test_domain_source_document_skeleton.py +101 -0
- infinity_context_core/features/memory_facts/__init__.py +3 -0
- infinity_context_core/features/memory_facts/application/__init__.py +37 -0
- infinity_context_core/features/memory_facts/application/commands.py +89 -0
- infinity_context_core/features/memory_facts/application/handlers.py +241 -0
- infinity_context_core/features/memory_facts/application/use_cases.py +47 -0
- infinity_context_core/features/memory_facts/domain/__init__.py +35 -0
- infinity_context_core/features/memory_facts/domain/fact.py +98 -0
- infinity_context_core/features/memory_facts/domain/feature.py +15 -0
- infinity_context_core/features/memory_facts/ports/__init__.py +31 -0
- infinity_context_core/features/memory_facts/ports/clock.py +14 -0
- infinity_context_core/features/memory_facts/ports/ids.py +19 -0
- infinity_context_core/features/memory_facts/ports/outbox.py +26 -0
- infinity_context_core/features/memory_facts/ports/repositories.py +30 -0
- infinity_context_core/features/memory_facts/ports/unit_of_work.py +43 -0
- infinity_context_core/features/memory_facts/public.py +79 -0
- infinity_context_core/features/memory_facts/tests/test_application_handlers.py +332 -0
- infinity_context_core/features/memory_facts/tests/test_application_ports_public_skeleton.py +318 -0
- infinity_context_core/features/memory_facts/tests/test_domain_fact_skeleton.py +222 -0
- infinity_context_core/features/memory_scopes/__init__.py +3 -0
- infinity_context_core/features/memory_scopes/application/__init__.py +55 -0
- infinity_context_core/features/memory_scopes/application/commands.py +102 -0
- infinity_context_core/features/memory_scopes/application/errors.py +27 -0
- infinity_context_core/features/memory_scopes/application/handlers.py +226 -0
- infinity_context_core/features/memory_scopes/application/use_cases.py +68 -0
- infinity_context_core/features/memory_scopes/domain/__init__.py +59 -0
- infinity_context_core/features/memory_scopes/domain/errors.py +22 -0
- infinity_context_core/features/memory_scopes/domain/feature.py +18 -0
- infinity_context_core/features/memory_scopes/domain/policies.py +197 -0
- infinity_context_core/features/memory_scopes/domain/scope.py +178 -0
- infinity_context_core/features/memory_scopes/ports/__init__.py +25 -0
- infinity_context_core/features/memory_scopes/ports/clock.py +14 -0
- infinity_context_core/features/memory_scopes/ports/ids.py +13 -0
- infinity_context_core/features/memory_scopes/ports/repositories.py +40 -0
- infinity_context_core/features/memory_scopes/ports/unit_of_work.py +39 -0
- infinity_context_core/features/memory_scopes/public.py +111 -0
- infinity_context_core/features/memory_scopes/tests/test_application_ports_public_skeleton.py +824 -0
- infinity_context_core/features/memory_scopes/tests/test_domain_scope_skeleton.py +428 -0
- infinity_context_core/memory_scope_snapshot_preview.py +863 -0
- infinity_context_core/memory_scope_snapshots.py +206 -0
- infinity_context_core/ports/__init__.py +164 -0
- infinity_context_core/ports/adapters.py +217 -0
- infinity_context_core/ports/assets.py +270 -0
- infinity_context_core/ports/auth.py +68 -0
- infinity_context_core/ports/auto_memory.py +71 -0
- infinity_context_core/ports/benchmark_runs.py +205 -0
- infinity_context_core/ports/capabilities.py +324 -0
- infinity_context_core/ports/captures.py +53 -0
- infinity_context_core/ports/clock.py +11 -0
- infinity_context_core/ports/derived_projection_policy.py +72 -0
- infinity_context_core/ports/extraction.py +201 -0
- infinity_context_core/ports/graph_evidence.py +170 -0
- infinity_context_core/ports/ids.py +11 -0
- infinity_context_core/ports/projection_fence.py +27 -0
- infinity_context_core/ports/repositories.py +563 -0
- infinity_context_core/ports/transcription.py +63 -0
- infinity_context_core/ports/unit_of_work.py +77 -0
- infinity_context_core/ports/usage.py +36 -0
- infinity_context_core/ports/vector_projection_evidence.py +230 -0
- infinity_context_core/ports/vision.py +36 -0
- infinity_context_core/processes/__init__.py +3 -0
- infinity_context_core/processes/document_memory_pipeline/__init__.py +3 -0
- infinity_context_core/processes/document_memory_pipeline/contracts.py +44 -0
- infinity_context_core/processes/document_memory_pipeline/process.py +72 -0
- infinity_context_core/processes/document_memory_pipeline/public.py +21 -0
- infinity_context_core/reporting.py +105 -0
- infinity_context_mcp/__init__.py +5 -0
- infinity_context_mcp/__main__.py +6 -0
- infinity_context_mcp/adapters/__init__.py +1 -0
- infinity_context_mcp/adapters/http_gateway.py +940 -0
- infinity_context_mcp/agent_behavior_bench.py +1731 -0
- infinity_context_mcp/agent_behavior_bench_metrics.py +419 -0
- infinity_context_mcp/agent_behavior_bench_redaction.py +149 -0
- infinity_context_mcp/agent_behavior_bench_types.py +127 -0
- infinity_context_mcp/agent_behavior_scenarios.py +35 -0
- infinity_context_mcp/agent_behavior_scenarios_core.py +484 -0
- infinity_context_mcp/agent_behavior_scenarios_realistic.py +473 -0
- infinity_context_mcp/agent_behavior_scenarios_transcript.py +196 -0
- infinity_context_mcp/agent_behavior_transcripts.py +231 -0
- infinity_context_mcp/agent_behavior_types.py +66 -0
- infinity_context_mcp/agent_behavior_utils.py +29 -0
- infinity_context_mcp/application/__init__.py +1 -0
- infinity_context_mcp/application/context_link_review.py +109 -0
- infinity_context_mcp/application/local_runtime.py +473 -0
- infinity_context_mcp/application/normalization.py +36 -0
- infinity_context_mcp/application/obsidian.py +568 -0
- infinity_context_mcp/application/policy.py +160 -0
- infinity_context_mcp/application/ports.py +324 -0
- infinity_context_mcp/application/prepare.py +254 -0
- infinity_context_mcp/application/readiness.py +71 -0
- infinity_context_mcp/application/review_batch.py +62 -0
- infinity_context_mcp/application/service.py +701 -0
- infinity_context_mcp/application/service_base.py +29 -0
- infinity_context_mcp/application/service_constants.py +89 -0
- infinity_context_mcp/application/service_context_links.py +224 -0
- infinity_context_mcp/application/service_duplicates.py +62 -0
- infinity_context_mcp/application/service_facts.py +461 -0
- infinity_context_mcp/application/service_helpers.py +179 -0
- infinity_context_mcp/application/service_lifecycle.py +348 -0
- infinity_context_mcp/application/service_policy.py +74 -0
- infinity_context_mcp/application/service_query.py +384 -0
- infinity_context_mcp/application/service_resources.py +192 -0
- infinity_context_mcp/application/service_response.py +95 -0
- infinity_context_mcp/application/service_scope.py +132 -0
- infinity_context_mcp/application/service_suggestions.py +820 -0
- infinity_context_mcp/application/suggest_batch.py +71 -0
- infinity_context_mcp/application/usage_guide.py +74 -0
- infinity_context_mcp/bench.py +279 -0
- infinity_context_mcp/config.py +213 -0
- infinity_context_mcp/domain/__init__.py +1 -0
- infinity_context_mcp/domain/context_links.py +117 -0
- infinity_context_mcp/domain/local_runtime_models.py +56 -0
- infinity_context_mcp/domain/memory_browser.py +35 -0
- infinity_context_mcp/domain/models.py +1036 -0
- infinity_context_mcp/domain/obsidian_models.py +67 -0
- infinity_context_mcp/domain/policy.py +112 -0
- infinity_context_mcp/domain/prepare_models.py +24 -0
- infinity_context_mcp/plugin_hook.py +873 -0
- infinity_context_mcp/plugin_hook_settings.py +253 -0
- infinity_context_mcp/server.py +133 -0
- infinity_context_mcp/server_context_tools.py +404 -0
- infinity_context_mcp/server_fact_tools.py +928 -0
- infinity_context_mcp/server_hardening.py +54 -0
- infinity_context_mcp/server_local_runtime_tools.py +164 -0
- infinity_context_mcp/server_obsidian_tools.py +380 -0
- infinity_context_mcp/server_query_tools.py +626 -0
- infinity_context_mcp/server_request_mapping.py +73 -0
- infinity_context_mcp/server_resources.py +187 -0
- infinity_context_mcp/server_response.py +26 -0
- infinity_context_obsidian/__init__.py +5 -0
- infinity_context_obsidian/cli.py +594 -0
- infinity_context_obsidian/conflicts.py +110 -0
- infinity_context_obsidian/doctor.py +319 -0
- infinity_context_obsidian/domain.py +92 -0
- infinity_context_obsidian/frontmatter.py +68 -0
- infinity_context_obsidian/gateway.py +66 -0
- infinity_context_obsidian/layout.py +179 -0
- infinity_context_obsidian/note_format.py +159 -0
- infinity_context_obsidian/plugin_bundle/__init__.py +1 -0
- infinity_context_obsidian/plugin_bundle/main.js +5 -0
- infinity_context_obsidian/plugin_bundle/manifest.json +10 -0
- infinity_context_obsidian/plugin_bundle/styles.css +123 -0
- infinity_context_obsidian/plugin_install.py +139 -0
- infinity_context_obsidian/ports.py +72 -0
- infinity_context_obsidian/setup.py +202 -0
- infinity_context_obsidian/state.py +85 -0
- infinity_context_obsidian/sync.py +741 -0
- infinity_context_obsidian/vault.py +61 -0
- infinity_context_sdk/__init__.py +1049 -0
- infinity_context_sdk/_payloads.py +401 -0
- infinity_context_sdk/_redaction.py +31 -0
- infinity_context_sdk/anchors.py +249 -0
- infinity_context_sdk/assets.py +554 -0
- infinity_context_sdk/capabilities.py +199 -0
- infinity_context_sdk/context.py +540 -0
- infinity_context_sdk/context_bundle_diagnostics.py +905 -0
- infinity_context_sdk/context_payload_utils.py +219 -0
- infinity_context_sdk/export.py +123 -0
- infinity_context_sdk/scopes.py +74 -0
- infinity_context_sdk/thread_memory.py +55 -0
- infinity_context_server/__init__.py +5 -0
- infinity_context_server/__main__.py +19 -0
- infinity_context_server/admin.py +832 -0
- infinity_context_server/admin_invariants.py +388 -0
- infinity_context_server/admin_outbox.py +130 -0
- infinity_context_server/admin_projection_repair.py +374 -0
- infinity_context_server/api/__init__.py +1 -0
- infinity_context_server/api/auth.py +432 -0
- infinity_context_server/api/dependencies.py +9 -0
- infinity_context_server/api/errors.py +94 -0
- infinity_context_server/api/legacy_client.py +356 -0
- infinity_context_server/api/policy.py +35 -0
- infinity_context_server/api/public_payload.py +27 -0
- infinity_context_server/api/v1/__init__.py +54 -0
- infinity_context_server/api/v1/anchors.py +469 -0
- infinity_context_server/api/v1/assets.py +409 -0
- infinity_context_server/api/v1/capabilities.py +144 -0
- infinity_context_server/api/v1/captures.py +329 -0
- infinity_context_server/api/v1/context.py +362 -0
- infinity_context_server/api/v1/context_links.py +611 -0
- infinity_context_server/api/v1/diagnostics.py +333 -0
- infinity_context_server/api/v1/digest.py +107 -0
- infinity_context_server/api/v1/documents.py +164 -0
- infinity_context_server/api/v1/episodes.py +146 -0
- infinity_context_server/api/v1/export.py +184 -0
- infinity_context_server/api/v1/facts.py +265 -0
- infinity_context_server/api/v1/health.py +24 -0
- infinity_context_server/api/v1/insights.py +100 -0
- infinity_context_server/api/v1/internal_memory_comparison_runs.py +406 -0
- infinity_context_server/api/v1/memory_browser.py +183 -0
- infinity_context_server/api/v1/operations.py +81 -0
- infinity_context_server/api/v1/scope_resolution.py +389 -0
- infinity_context_server/api/v1/source_refs.py +111 -0
- infinity_context_server/api/v1/spaces_memory_scopes.py +141 -0
- infinity_context_server/api/v1/suggestions.py +237 -0
- infinity_context_server/api/v1/thread_memory.py +74 -0
- infinity_context_server/api/v1/usage.py +75 -0
- infinity_context_server/api/v1/users.py +164 -0
- infinity_context_server/auth_scope.py +492 -0
- infinity_context_server/auth_tokens.py +283 -0
- infinity_context_server/backpressure.py +47 -0
- infinity_context_server/benchmark_projection_absence.py +155 -0
- infinity_context_server/benchmark_projection_delete_outbox.py +162 -0
- infinity_context_server/composition.py +897 -0
- infinity_context_server/config.py +223 -0
- infinity_context_server/db.py +39 -0
- infinity_context_server/deployment_readiness.py +205 -0
- infinity_context_server/derived_identity_evidence.py +987 -0
- infinity_context_server/derived_identity_target.py +39 -0
- infinity_context_server/derived_projection_policy.py +85 -0
- infinity_context_server/diagnostics.py +536 -0
- infinity_context_server/doctor.py +71 -0
- infinity_context_server/eval.py +3066 -0
- infinity_context_server/eval_auto_memory.py +1735 -0
- infinity_context_server/eval_auto_memory_metrics.py +224 -0
- infinity_context_server/eval_auto_memory_types.py +75 -0
- infinity_context_server/eval_case_catalog.py +1590 -0
- infinity_context_server/eval_case_runner.py +1100 -0
- infinity_context_server/eval_common.py +336 -0
- infinity_context_server/eval_constants.py +310 -0
- infinity_context_server/eval_fixtures.py +150 -0
- infinity_context_server/eval_graph.py +92 -0
- infinity_context_server/eval_hybrid.py +99 -0
- infinity_context_server/eval_multimodal_offline.py +697 -0
- infinity_context_server/eval_prompt_contract.py +402 -0
- infinity_context_server/eval_scorecard.py +2627 -0
- infinity_context_server/eval_semantic_linking.py +1526 -0
- infinity_context_server/eval_semantic_retrieval_api_canary.py +405 -0
- infinity_context_server/eval_semantic_retrieval_canary.py +359 -0
- infinity_context_server/eval_types.py +88 -0
- infinity_context_server/evidence_bundle.py +523 -0
- infinity_context_server/extraction_capabilities.py +1234 -0
- infinity_context_server/features/__init__.py +3 -0
- infinity_context_server/features/context_building/__init__.py +5 -0
- infinity_context_server/features/context_building/benchmark_budget.py +29 -0
- infinity_context_server/features/context_building/composition.py +49 -0
- infinity_context_server/features/context_building/context_requests.py +151 -0
- infinity_context_server/features/context_building/contracts.py +96 -0
- infinity_context_server/features/context_building/digest_api_responses.py +225 -0
- infinity_context_server/features/context_building/digest_requests.py +65 -0
- infinity_context_server/features/context_building/insights_api_responses.py +132 -0
- infinity_context_server/features/context_building/legacy_api_responses.py +875 -0
- infinity_context_server/features/context_building/mappers.py +205 -0
- infinity_context_server/features/context_building/public.py +66 -0
- infinity_context_server/features/context_building/routes.py +44 -0
- infinity_context_server/features/document_ingestion/__init__.py +5 -0
- infinity_context_server/features/document_ingestion/asset_requests.py +45 -0
- infinity_context_server/features/document_ingestion/asset_responses.py +365 -0
- infinity_context_server/features/document_ingestion/composition.py +49 -0
- infinity_context_server/features/document_ingestion/contracts.py +104 -0
- infinity_context_server/features/document_ingestion/mappers.py +386 -0
- infinity_context_server/features/document_ingestion/public.py +58 -0
- infinity_context_server/features/document_ingestion/routes.py +44 -0
- infinity_context_server/features/memory_facts/__init__.py +7 -0
- infinity_context_server/features/memory_facts/compatibility.py +204 -0
- infinity_context_server/features/memory_facts/composition.py +72 -0
- infinity_context_server/features/memory_facts/contracts.py +187 -0
- infinity_context_server/features/memory_facts/mappers.py +620 -0
- infinity_context_server/features/memory_facts/public.py +168 -0
- infinity_context_server/features/memory_facts/routes.py +118 -0
- infinity_context_server/features/memory_facts/suggestion_requests.py +283 -0
- infinity_context_server/features/memory_facts/suggestion_responses.py +382 -0
- infinity_context_server/features/memory_scopes/__init__.py +5 -0
- infinity_context_server/features/memory_scopes/compatibility.py +231 -0
- infinity_context_server/features/memory_scopes/composition.py +49 -0
- infinity_context_server/features/memory_scopes/contracts.py +103 -0
- infinity_context_server/features/memory_scopes/graph_export_responses.py +93 -0
- infinity_context_server/features/memory_scopes/mappers.py +290 -0
- infinity_context_server/features/memory_scopes/public.py +136 -0
- infinity_context_server/features/memory_scopes/routes.py +185 -0
- infinity_context_server/features/memory_scopes/snapshot_compatibility.py +146 -0
- infinity_context_server/features/memory_scopes/thread_memory_requests.py +127 -0
- infinity_context_server/llm_provider_readiness.py +267 -0
- infinity_context_server/longmemeval_session_identity.py +167 -0
- infinity_context_server/main.py +68 -0
- infinity_context_server/mem0_benchmark_auth_challenge.py +160 -0
- infinity_context_server/memora_comparison.py +658 -0
- infinity_context_server/memory_comparison_answer_context.py +2442 -0
- infinity_context_server/memory_comparison_answer_context_backfill.py +1027 -0
- infinity_context_server/memory_comparison_answer_context_diagnostics.py +694 -0
- infinity_context_server/memory_comparison_answer_context_inspection.py +103 -0
- infinity_context_server/memory_comparison_answer_context_retrieval_slice.py +175 -0
- infinity_context_server/memory_comparison_answer_context_risks.py +223 -0
- infinity_context_server/memory_comparison_backend_target.py +41 -0
- infinity_context_server/memory_comparison_benchmark.py +651 -0
- infinity_context_server/memory_comparison_benchmark_compact.py +387 -0
- infinity_context_server/memory_comparison_benchmark_compact_fast_gate.py +387 -0
- infinity_context_server/memory_comparison_benchmark_compact_samples.py +931 -0
- infinity_context_server/memory_comparison_benchmark_config.py +105 -0
- infinity_context_server/memory_comparison_benchmark_control.py +215 -0
- infinity_context_server/memory_comparison_benchmark_execution.py +238 -0
- infinity_context_server/memory_comparison_benchmark_identity.py +65 -0
- infinity_context_server/memory_comparison_benchmark_metrics.py +686 -0
- infinity_context_server/memory_comparison_benchmark_replay.py +400 -0
- infinity_context_server/memory_comparison_benchmark_shared.py +284 -0
- infinity_context_server/memory_comparison_bounded_provider.py +295 -0
- infinity_context_server/memory_comparison_bundle_partial_support.py +107 -0
- infinity_context_server/memory_comparison_bundle_planner.py +3521 -0
- infinity_context_server/memory_comparison_bundle_source_windows.py +247 -0
- infinity_context_server/memory_comparison_candidate_features.py +2014 -0
- infinity_context_server/memory_comparison_candidate_fusion.py +893 -0
- infinity_context_server/memory_comparison_candidate_risks.py +124 -0
- infinity_context_server/memory_comparison_canonical_source_hash.py +109 -0
- infinity_context_server/memory_comparison_case_identity.py +100 -0
- infinity_context_server/memory_comparison_case_loader.py +123 -0
- infinity_context_server/memory_comparison_chat_completions.py +402 -0
- infinity_context_server/memory_comparison_clean_state.py +607 -0
- infinity_context_server/memory_comparison_clean_state_http.py +120 -0
- infinity_context_server/memory_comparison_clean_state_runner.py +103 -0
- infinity_context_server/memory_comparison_cli.py +295 -0
- infinity_context_server/memory_comparison_codex_canary.py +315 -0
- infinity_context_server/memory_comparison_codex_llm.py +345 -0
- infinity_context_server/memory_comparison_compact_gap_report.py +289 -0
- infinity_context_server/memory_comparison_comparative_preference.py +71 -0
- infinity_context_server/memory_comparison_conversation_ingestion.py +198 -0
- infinity_context_server/memory_comparison_evidence.py +877 -0
- infinity_context_server/memory_comparison_evidence_commitment.py +20 -0
- infinity_context_server/memory_comparison_failure_diagnostics.py +809 -0
- infinity_context_server/memory_comparison_full_canonical_evidence.py +746 -0
- infinity_context_server/memory_comparison_full_canonical_source_evidence_trust.py +450 -0
- infinity_context_server/memory_comparison_full_delete_evidence.py +670 -0
- infinity_context_server/memory_comparison_full_delete_evidence_trust.py +441 -0
- infinity_context_server/memory_comparison_full_delete_evidence_witnesses.py +308 -0
- infinity_context_server/memory_comparison_full_execution_validation.py +697 -0
- infinity_context_server/memory_comparison_full_execution_validation_slots.py +655 -0
- infinity_context_server/memory_comparison_full_methodology.py +556 -0
- infinity_context_server/memory_comparison_full_policy_component_validation.py +899 -0
- infinity_context_server/memory_comparison_full_profiles.py +398 -0
- infinity_context_server/memory_comparison_full_run_component_sets.py +304 -0
- infinity_context_server/memory_comparison_full_run_components.py +787 -0
- infinity_context_server/memory_comparison_full_run_evidence.py +759 -0
- infinity_context_server/memory_comparison_full_scope.py +244 -0
- infinity_context_server/memory_comparison_full_source_evidence.py +866 -0
- infinity_context_server/memory_comparison_full_verdict.py +252 -0
- infinity_context_server/memory_comparison_gold_blind.py +654 -0
- infinity_context_server/memory_comparison_gold_blind_answer_contract.py +492 -0
- infinity_context_server/memory_comparison_gold_blind_contract.py +760 -0
- infinity_context_server/memory_comparison_gold_blind_dispatch_models.py +34 -0
- infinity_context_server/memory_comparison_gold_blind_execution_validation.py +170 -0
- infinity_context_server/memory_comparison_gold_blind_judge_binding.py +167 -0
- infinity_context_server/memory_comparison_gold_blind_judge_capability.py +387 -0
- infinity_context_server/memory_comparison_gold_blind_retrieval_contract.py +413 -0
- infinity_context_server/memory_comparison_gold_blind_run_proof.py +880 -0
- infinity_context_server/memory_comparison_gold_blind_run_validation.py +109 -0
- infinity_context_server/memory_comparison_gold_blind_validation.py +319 -0
- infinity_context_server/memory_comparison_http.py +921 -0
- infinity_context_server/memory_comparison_http_ingest_observation.py +710 -0
- infinity_context_server/memory_comparison_http_ingest_request.py +204 -0
- infinity_context_server/memory_comparison_intent.py +2925 -0
- infinity_context_server/memory_comparison_latency.py +455 -0
- infinity_context_server/memory_comparison_llm.py +473 -0
- infinity_context_server/memory_comparison_location_roles.py +169 -0
- infinity_context_server/memory_comparison_locomo_cases.py +328 -0
- infinity_context_server/memory_comparison_locomo_expected_turn.py +297 -0
- infinity_context_server/memory_comparison_locomo_transport.py +873 -0
- infinity_context_server/memory_comparison_longmemeval_cases.py +339 -0
- infinity_context_server/memory_comparison_managed_attestation.py +771 -0
- infinity_context_server/memory_comparison_managed_benchmark_registry_abort_http.py +120 -0
- infinity_context_server/memory_comparison_managed_benchmark_registry_contracts.py +715 -0
- infinity_context_server/memory_comparison_managed_benchmark_registry_http.py +855 -0
- infinity_context_server/memory_comparison_managed_benchmark_registry_recovery_http.py +164 -0
- infinity_context_server/memory_comparison_managed_benchmark_registry_wire.py +890 -0
- infinity_context_server/memory_comparison_managed_composite_assembler.py +524 -0
- infinity_context_server/memory_comparison_managed_corpus_projection.py +653 -0
- infinity_context_server/memory_comparison_managed_execution_receipts.py +991 -0
- infinity_context_server/memory_comparison_managed_http_derived_evidence.py +724 -0
- infinity_context_server/memory_comparison_managed_http_exact_cleanup.py +476 -0
- infinity_context_server/memory_comparison_managed_http_execution.py +673 -0
- infinity_context_server/memory_comparison_managed_http_lifecycle.py +905 -0
- infinity_context_server/memory_comparison_managed_http_lifecycle_credentials.py +83 -0
- infinity_context_server/memory_comparison_managed_http_lifecycle_evidence.py +366 -0
- infinity_context_server/memory_comparison_managed_http_lifecycle_registration.py +106 -0
- infinity_context_server/memory_comparison_managed_http_policy_lifecycle.py +894 -0
- infinity_context_server/memory_comparison_managed_http_policy_material_projection.py +315 -0
- infinity_context_server/memory_comparison_managed_http_policy_receipts.py +219 -0
- infinity_context_server/memory_comparison_managed_http_policy_registry_evidence.py +177 -0
- infinity_context_server/memory_comparison_managed_http_policy_requirements.py +824 -0
- infinity_context_server/memory_comparison_managed_http_policy_support.py +108 -0
- infinity_context_server/memory_comparison_managed_http_policy_validation.py +762 -0
- infinity_context_server/memory_comparison_managed_ingest_manifest.py +449 -0
- infinity_context_server/memory_comparison_managed_live_admission.py +886 -0
- infinity_context_server/memory_comparison_managed_live_cli.py +536 -0
- infinity_context_server/memory_comparison_managed_live_composition.py +636 -0
- infinity_context_server/memory_comparison_managed_llm_execution.py +850 -0
- infinity_context_server/memory_comparison_managed_llm_execution_dispatch.py +269 -0
- infinity_context_server/memory_comparison_managed_llm_execution_ports.py +225 -0
- infinity_context_server/memory_comparison_managed_mem0_auth.py +65 -0
- infinity_context_server/memory_comparison_managed_mem0_runtime_authority.py +241 -0
- infinity_context_server/memory_comparison_managed_mem0_runtime_http.py +541 -0
- infinity_context_server/memory_comparison_managed_plan_builder.py +685 -0
- infinity_context_server/memory_comparison_managed_preflight.py +907 -0
- infinity_context_server/memory_comparison_managed_preflight_cli.py +431 -0
- infinity_context_server/memory_comparison_managed_production_cli.py +325 -0
- infinity_context_server/memory_comparison_managed_production_composition.py +140 -0
- infinity_context_server/memory_comparison_managed_production_ports.py +194 -0
- infinity_context_server/memory_comparison_managed_production_runner.py +450 -0
- infinity_context_server/memory_comparison_managed_projection_manifest.py +438 -0
- infinity_context_server/memory_comparison_managed_provider_calls.py +450 -0
- infinity_context_server/memory_comparison_managed_quality_projection.py +347 -0
- infinity_context_server/memory_comparison_managed_registry_policy_lifecycle.py +677 -0
- infinity_context_server/memory_comparison_managed_run.py +892 -0
- infinity_context_server/memory_comparison_managed_run_contract.py +454 -0
- infinity_context_server/memory_comparison_managed_run_ports.py +79 -0
- infinity_context_server/memory_comparison_managed_runtime_credentials.py +916 -0
- infinity_context_server/memory_comparison_managed_runtime_credentials_capability.py +361 -0
- infinity_context_server/memory_comparison_managed_runtime_credentials_context.py +132 -0
- infinity_context_server/memory_comparison_managed_runtime_credentials_integrity.py +213 -0
- infinity_context_server/memory_comparison_managed_runtime_credentials_models.py +81 -0
- infinity_context_server/memory_comparison_managed_runtime_credentials_targets.py +28 -0
- infinity_context_server/memory_comparison_mem0_contract.py +491 -0
- infinity_context_server/memory_comparison_mem0_http_observation.py +296 -0
- infinity_context_server/memory_comparison_mem0_locomo_prompts.py +328 -0
- infinity_context_server/memory_comparison_mem0_longmemeval_prompts.py +365 -0
- infinity_context_server/memory_comparison_mem0_official_chat.py +504 -0
- infinity_context_server/memory_comparison_mem0_official_prompt_renderer.py +307 -0
- infinity_context_server/memory_comparison_mem0_oss_contract.py +456 -0
- infinity_context_server/memory_comparison_mem0_oss_manifest.py +563 -0
- infinity_context_server/memory_comparison_mem0_platform_contract.py +467 -0
- infinity_context_server/memory_comparison_mem0_runtime_attestation.py +861 -0
- infinity_context_server/memory_comparison_models.py +398 -0
- infinity_context_server/memory_comparison_openai_official_transport.py +525 -0
- infinity_context_server/memory_comparison_preflight.py +1147 -0
- infinity_context_server/memory_comparison_probe_transport.py +154 -0
- infinity_context_server/memory_comparison_prompt_policy.py +603 -0
- infinity_context_server/memory_comparison_provider_provenance.py +392 -0
- infinity_context_server/memory_comparison_quality_accessors.py +339 -0
- infinity_context_server/memory_comparison_quality_actionable_gaps.py +2038 -0
- infinity_context_server/memory_comparison_quality_answer_context_gaps.py +450 -0
- infinity_context_server/memory_comparison_quality_answer_context_risks.py +75 -0
- infinity_context_server/memory_comparison_quality_bundle_gaps.py +860 -0
- infinity_context_server/memory_comparison_quality_bundle_table.py +805 -0
- infinity_context_server/memory_comparison_quality_diagnostics.py +2798 -0
- infinity_context_server/memory_comparison_quality_fusion.py +241 -0
- infinity_context_server/memory_comparison_quality_query_plan_gaps.py +533 -0
- infinity_context_server/memory_comparison_quality_query_role_gaps.py +845 -0
- infinity_context_server/memory_comparison_quality_query_roles.py +815 -0
- infinity_context_server/memory_comparison_quality_rerank_gaps.py +492 -0
- infinity_context_server/memory_comparison_quality_selected_weakness.py +544 -0
- infinity_context_server/memory_comparison_quality_support.py +921 -0
- infinity_context_server/memory_comparison_query_integrity.py +301 -0
- infinity_context_server/memory_comparison_query_plan.py +524 -0
- infinity_context_server/memory_comparison_query_terms.py +2055 -0
- infinity_context_server/memory_comparison_relation_support.py +2100 -0
- infinity_context_server/memory_comparison_rerank.py +3209 -0
- infinity_context_server/memory_comparison_rerank_intents.py +405 -0
- infinity_context_server/memory_comparison_rerank_policies.py +1726 -0
- infinity_context_server/memory_comparison_rerank_policy.py +675 -0
- infinity_context_server/memory_comparison_rerank_shapes.py +152 -0
- infinity_context_server/memory_comparison_rerank_terms.py +973 -0
- infinity_context_server/memory_comparison_rerank_text.py +722 -0
- infinity_context_server/memory_comparison_retrieval_policy.py +108 -0
- infinity_context_server/memory_comparison_retrieval_width.py +383 -0
- infinity_context_server/memory_comparison_service_probe.py +278 -0
- infinity_context_server/memory_comparison_service_probes.py +547 -0
- infinity_context_server/memory_comparison_session_identity_contract.py +328 -0
- infinity_context_server/memory_comparison_source_identity.py +1655 -0
- infinity_context_server/memory_comparison_subscription_chat.py +717 -0
- infinity_context_server/memory_comparison_subscription_live_probe.py +323 -0
- infinity_context_server/memory_comparison_subscription_probe.py +368 -0
- infinity_context_server/memory_comparison_target_identity.py +42 -0
- infinity_context_server/memory_comparison_temporal_grounding.py +771 -0
- infinity_context_server/memory_comparison_token_budget_contract.py +665 -0
- infinity_context_server/memory_comparison_token_latency.py +136 -0
- infinity_context_server/memory_scope_transfer.py +933 -0
- infinity_context_server/memory_scope_transfer_assets.py +181 -0
- infinity_context_server/memory_scope_transfer_conflicts.py +565 -0
- infinity_context_server/memory_scope_transfer_context.py +295 -0
- infinity_context_server/memory_scope_transfer_extractions.py +390 -0
- infinity_context_server/memory_scope_transfer_facts.py +65 -0
- infinity_context_server/memory_scope_transfer_records.py +630 -0
- infinity_context_server/memory_scope_transfer_relations.py +84 -0
- infinity_context_server/memory_scope_transfer_remap.py +710 -0
- infinity_context_server/memory_scope_transfer_scope.py +267 -0
- infinity_context_server/memory_scope_transfer_support.py +108 -0
- infinity_context_server/memory_scope_transfer_temporal.py +24 -0
- infinity_context_server/metrics.py +264 -0
- infinity_context_server/official_public_benchmark.py +979 -0
- infinity_context_server/pagination.py +60 -0
- infinity_context_server/processes/__init__.py +38 -0
- infinity_context_server/processes/extractions.py +40 -0
- infinity_context_server/processes/outbox.py +47 -0
- infinity_context_server/processes/projections.py +372 -0
- infinity_context_server/provider_budget.py +59 -0
- infinity_context_server/provider_circuit.py +333 -0
- infinity_context_server/public_benchmark.py +2532 -0
- infinity_context_server/public_benchmark_artifacts.py +91 -0
- infinity_context_server/public_benchmark_case_diagnostics.py +231 -0
- infinity_context_server/public_benchmark_checkpoint.py +751 -0
- infinity_context_server/public_benchmark_environment.py +102 -0
- infinity_context_server/public_benchmark_execution.py +445 -0
- infinity_context_server/public_benchmark_http.py +39 -0
- infinity_context_server/public_benchmark_manifest.py +129 -0
- infinity_context_server/public_benchmark_metrics.py +645 -0
- infinity_context_server/public_benchmark_metrics_policy.py +117 -0
- infinity_context_server/public_benchmark_models.py +112 -0
- infinity_context_server/public_benchmark_progress.py +224 -0
- infinity_context_server/public_benchmark_results.py +76 -0
- infinity_context_server/public_benchmark_run_diagnostics.py +163 -0
- infinity_context_server/public_benchmark_selection.py +379 -0
- infinity_context_server/public_benchmark_transport.py +62 -0
- infinity_context_server/public_benchmark_unsupported.py +228 -0
- infinity_context_server/ranked_evidence_answer_support.py +665 -0
- infinity_context_server/ranked_evidence_document_seed_contract.py +30 -0
- infinity_context_server/ranked_evidence_evaluator_helpers.py +135 -0
- infinity_context_server/ranked_evidence_retrieval_request.py +36 -0
- infinity_context_server/ranked_evidence_seed_case.py +109 -0
- infinity_context_server/ranked_evidence_semantic_gate.py +980 -0
- infinity_context_server/ranked_evidence_semantic_gate_cli.py +137 -0
- infinity_context_server/ranked_evidence_semantic_gate_decision.py +163 -0
- infinity_context_server/ranked_evidence_semantic_metrics.py +375 -0
- infinity_context_server/ranked_evidence_session_identity.py +100 -0
- infinity_context_server/storage_maintenance.py +187 -0
- infinity_context_server/top_evidence_dataset_profile.py +442 -0
- infinity_context_server/top_evidence_policy.py +274 -0
- infinity_context_server/top_evidence_preflight.py +693 -0
- infinity_context_server/web/assets/memory-browser-capture.js +252 -0
- infinity_context_server/web/assets/memory-browser-operations.js +143 -0
- infinity_context_server/web/assets/memory-browser-review.js +687 -0
- infinity_context_server/web/assets/memory-browser.css +854 -0
- infinity_context_server/web/assets/memory-browser.js +3299 -0
- infinity_context_server/web/index.html +261 -0
- infinity_context_server/web_ui.py +29 -0
- infinity_context_server/worker.py +380 -0
|
@@ -0,0 +1,2925 @@
|
|
|
1
|
+
"""Typed retrieval intent contracts for memory-comparison retrieval."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import re
|
|
6
|
+
from collections.abc import Sequence
|
|
7
|
+
from dataclasses import dataclass
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@dataclass(frozen=True)
|
|
11
|
+
class RetrievalEntityIntent:
|
|
12
|
+
"""Person or named-entity surfaces extracted from a question."""
|
|
13
|
+
|
|
14
|
+
canonical: str
|
|
15
|
+
surfaces: tuple[str, ...]
|
|
16
|
+
speaker_surfaces: tuple[str, ...]
|
|
17
|
+
|
|
18
|
+
def to_diagnostics(self) -> dict[str, object]:
|
|
19
|
+
return {
|
|
20
|
+
"canonical": self.canonical,
|
|
21
|
+
"surfaces": list(self.surfaces),
|
|
22
|
+
"speaker_surfaces": list(self.speaker_surfaces),
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@dataclass(frozen=True)
|
|
27
|
+
class RetrievalTimeIntent:
|
|
28
|
+
"""Temporal constraints extracted from a question."""
|
|
29
|
+
|
|
30
|
+
is_temporal: bool
|
|
31
|
+
terms: tuple[str, ...]
|
|
32
|
+
surface_terms: tuple[str, ...]
|
|
33
|
+
kind: str
|
|
34
|
+
|
|
35
|
+
def to_diagnostics(self) -> dict[str, object]:
|
|
36
|
+
return {
|
|
37
|
+
"is_temporal": self.is_temporal,
|
|
38
|
+
"terms": list(self.terms),
|
|
39
|
+
"surface_terms": list(self.surface_terms),
|
|
40
|
+
"kind": self.kind,
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@dataclass(frozen=True)
|
|
45
|
+
class RetrievalRelationIntent:
|
|
46
|
+
"""Typed relation facet inferred from question-only relation terms."""
|
|
47
|
+
|
|
48
|
+
category: str
|
|
49
|
+
terms: tuple[str, ...]
|
|
50
|
+
variant_terms: tuple[str, ...]
|
|
51
|
+
evidence_need: str
|
|
52
|
+
reason_codes: tuple[str, ...]
|
|
53
|
+
|
|
54
|
+
def to_diagnostics(self) -> dict[str, object]:
|
|
55
|
+
return {
|
|
56
|
+
"category": self.category,
|
|
57
|
+
"terms": list(self.terms),
|
|
58
|
+
"variant_terms": list(self.variant_terms),
|
|
59
|
+
"evidence_need": self.evidence_need,
|
|
60
|
+
"reason_codes": list(self.reason_codes),
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@dataclass(frozen=True)
|
|
65
|
+
class RetrievalIntent:
|
|
66
|
+
"""Question-only retrieval intent used by query planning and rerank."""
|
|
67
|
+
|
|
68
|
+
question: str
|
|
69
|
+
lexical_terms: tuple[str, ...]
|
|
70
|
+
entities: tuple[RetrievalEntityIntent, ...]
|
|
71
|
+
relation_terms: tuple[str, ...]
|
|
72
|
+
relation_variant_terms: tuple[str, ...]
|
|
73
|
+
time_intent: RetrievalTimeIntent
|
|
74
|
+
visual_terms: tuple[str, ...]
|
|
75
|
+
multi_hop_markers: tuple[str, ...]
|
|
76
|
+
evidence_need: tuple[str, ...]
|
|
77
|
+
risk_flags: tuple[str, ...]
|
|
78
|
+
bundle_evidence_roles: tuple[str, ...] = ()
|
|
79
|
+
relation_intents: tuple[RetrievalRelationIntent, ...] = ()
|
|
80
|
+
answer_unit_shapes: tuple[str, ...] = ()
|
|
81
|
+
|
|
82
|
+
@property
|
|
83
|
+
def entity_names(self) -> tuple[str, ...]:
|
|
84
|
+
return tuple(entity.canonical for entity in self.entities)
|
|
85
|
+
|
|
86
|
+
@property
|
|
87
|
+
def entity_surfaces(self) -> tuple[str, ...]:
|
|
88
|
+
return tuple(
|
|
89
|
+
dict.fromkeys(
|
|
90
|
+
surface for entity in self.entities for surface in entity.surfaces
|
|
91
|
+
)
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
@property
|
|
95
|
+
def speaker_surfaces(self) -> tuple[str, ...]:
|
|
96
|
+
return tuple(
|
|
97
|
+
dict.fromkeys(
|
|
98
|
+
surface
|
|
99
|
+
for entity in self.entities
|
|
100
|
+
for surface in entity.speaker_surfaces
|
|
101
|
+
)
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
def to_query_profile(self) -> dict[str, object]:
|
|
105
|
+
return {
|
|
106
|
+
"lexical_terms": self.lexical_terms,
|
|
107
|
+
"entities": self.entity_names,
|
|
108
|
+
"entity_surfaces": self.entity_surfaces,
|
|
109
|
+
"speaker_surfaces": self.speaker_surfaces,
|
|
110
|
+
"relation_terms": self.relation_terms,
|
|
111
|
+
"relation_variant_terms": self.relation_variant_terms,
|
|
112
|
+
"relation_categories": tuple(
|
|
113
|
+
intent.category for intent in self.relation_intents
|
|
114
|
+
),
|
|
115
|
+
"relation_category_terms": {
|
|
116
|
+
intent.category: tuple(
|
|
117
|
+
dict.fromkeys((*intent.terms, *intent.variant_terms))
|
|
118
|
+
)
|
|
119
|
+
for intent in self.relation_intents
|
|
120
|
+
},
|
|
121
|
+
"is_temporal_query": self.time_intent.is_temporal,
|
|
122
|
+
"time_intent_kind": self.time_intent.kind,
|
|
123
|
+
"temporal_terms": self.time_intent.terms,
|
|
124
|
+
"temporal_surface_terms": self.time_intent.surface_terms,
|
|
125
|
+
"visual_terms": self.visual_terms,
|
|
126
|
+
"multi_hop_markers": self.multi_hop_markers,
|
|
127
|
+
"evidence_need": self.evidence_need,
|
|
128
|
+
"bundle_evidence_roles": self.bundle_evidence_roles,
|
|
129
|
+
"answer_unit_shapes": self.answer_unit_shapes,
|
|
130
|
+
"risk_flags": self.risk_flags,
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
def to_diagnostics(self) -> dict[str, object]:
|
|
134
|
+
return {
|
|
135
|
+
"schema_version": "retrieval_intent.v1",
|
|
136
|
+
"entity_count": len(self.entities),
|
|
137
|
+
"entities": [entity.to_diagnostics() for entity in self.entities],
|
|
138
|
+
"relations": {
|
|
139
|
+
"terms": list(self.relation_terms),
|
|
140
|
+
"variant_terms": list(self.relation_variant_terms),
|
|
141
|
+
"intents": [
|
|
142
|
+
intent.to_diagnostics() for intent in self.relation_intents
|
|
143
|
+
],
|
|
144
|
+
},
|
|
145
|
+
"time_intent": self.time_intent.to_diagnostics(),
|
|
146
|
+
"visual_terms": list(self.visual_terms),
|
|
147
|
+
"multi_hop_markers": list(self.multi_hop_markers),
|
|
148
|
+
"evidence_need": list(self.evidence_need),
|
|
149
|
+
"bundle_evidence_roles": list(self.bundle_evidence_roles),
|
|
150
|
+
"answer_unit_shapes": list(self.answer_unit_shapes),
|
|
151
|
+
"risk_flags": list(self.risk_flags),
|
|
152
|
+
"uses_ground_truth": False,
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def infer_time_intent_kind(
|
|
157
|
+
*,
|
|
158
|
+
is_temporal: bool,
|
|
159
|
+
temporal_terms: tuple[str, ...],
|
|
160
|
+
temporal_surface_terms: tuple[str, ...],
|
|
161
|
+
) -> str:
|
|
162
|
+
if not is_temporal:
|
|
163
|
+
return "none"
|
|
164
|
+
temporal_term_set = set(temporal_terms)
|
|
165
|
+
if {"how long", "long", "duration"} & temporal_term_set:
|
|
166
|
+
return "duration"
|
|
167
|
+
if {
|
|
168
|
+
"before",
|
|
169
|
+
"beforehand",
|
|
170
|
+
"after",
|
|
171
|
+
"afterward",
|
|
172
|
+
"afterwards",
|
|
173
|
+
"since",
|
|
174
|
+
} & temporal_term_set:
|
|
175
|
+
return "temporal_sequence"
|
|
176
|
+
if _RELATIVE_TIME_TERMS & temporal_term_set or _has_ordinal_event_term(
|
|
177
|
+
temporal_terms
|
|
178
|
+
):
|
|
179
|
+
return "relative_time"
|
|
180
|
+
if temporal_surface_terms:
|
|
181
|
+
return "explicit_time"
|
|
182
|
+
return "temporal_lookup"
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
_RELATIVE_WEEKDAY_TERMS = frozenset(
|
|
186
|
+
f"{modifier} {weekday}"
|
|
187
|
+
for modifier in ("last", "next", "this")
|
|
188
|
+
for weekday in (
|
|
189
|
+
"monday",
|
|
190
|
+
"tuesday",
|
|
191
|
+
"wednesday",
|
|
192
|
+
"thursday",
|
|
193
|
+
"friday",
|
|
194
|
+
"saturday",
|
|
195
|
+
"sunday",
|
|
196
|
+
)
|
|
197
|
+
)
|
|
198
|
+
_RELATIVE_ORDINAL_PERIOD_TERMS = frozenset(
|
|
199
|
+
f"{ordinal} {period}"
|
|
200
|
+
for ordinal in ("first", "second", "third", "fourth", "last")
|
|
201
|
+
for period in ("weekend", "week", "half", "quarter", "month")
|
|
202
|
+
)
|
|
203
|
+
_RELATIVE_SEASON_TERMS = frozenset(
|
|
204
|
+
f"{modifier} {season}"
|
|
205
|
+
for modifier in ("last", "next", "this")
|
|
206
|
+
for season in ("spring", "summer", "fall", "autumn", "winter")
|
|
207
|
+
)
|
|
208
|
+
_SEASON_TERMS = frozenset({"spring", "summer", "fall", "autumn", "winter"})
|
|
209
|
+
_ORDINAL_EVENT_TERM_RE = re.compile(
|
|
210
|
+
r"\b(?:first|second|third|fourth|fifth|last|latest)\s+"
|
|
211
|
+
r"(?:(?!(?:at|for|in|of|on|place|the)\b)[a-z0-9-]+\s+){0,3}"
|
|
212
|
+
r"(?:call-?out|competition|event|game|project|screenplay|script|"
|
|
213
|
+
r"tournament|tourney|trip)\b"
|
|
214
|
+
)
|
|
215
|
+
_RELATIVE_TIME_TERMS = (
|
|
216
|
+
frozenset(
|
|
217
|
+
{
|
|
218
|
+
"ago",
|
|
219
|
+
"again",
|
|
220
|
+
"earlier",
|
|
221
|
+
"earlier today",
|
|
222
|
+
"earliest event",
|
|
223
|
+
"early",
|
|
224
|
+
"end",
|
|
225
|
+
"first half",
|
|
226
|
+
"last night",
|
|
227
|
+
"last quarter",
|
|
228
|
+
"last week",
|
|
229
|
+
"last weekend",
|
|
230
|
+
"last month",
|
|
231
|
+
"last year",
|
|
232
|
+
"later",
|
|
233
|
+
"late",
|
|
234
|
+
"latest event",
|
|
235
|
+
"long ago",
|
|
236
|
+
"next month",
|
|
237
|
+
"next quarter",
|
|
238
|
+
"next week",
|
|
239
|
+
"next weekend",
|
|
240
|
+
"next year",
|
|
241
|
+
"previous",
|
|
242
|
+
"recent",
|
|
243
|
+
"second half",
|
|
244
|
+
"since",
|
|
245
|
+
"soon",
|
|
246
|
+
"start",
|
|
247
|
+
"this month",
|
|
248
|
+
"this afternoon",
|
|
249
|
+
"this evening",
|
|
250
|
+
"this morning",
|
|
251
|
+
"this quarter",
|
|
252
|
+
"this week",
|
|
253
|
+
"this weekend",
|
|
254
|
+
"this year",
|
|
255
|
+
"today",
|
|
256
|
+
"tonight",
|
|
257
|
+
"currently",
|
|
258
|
+
"tomorrow afternoon",
|
|
259
|
+
"tomorrow evening",
|
|
260
|
+
"tomorrow morning",
|
|
261
|
+
"tomorrow",
|
|
262
|
+
"upcoming",
|
|
263
|
+
"upcoming event",
|
|
264
|
+
"yesterday afternoon",
|
|
265
|
+
"yesterday evening",
|
|
266
|
+
"yesterday morning",
|
|
267
|
+
"yesterday",
|
|
268
|
+
}
|
|
269
|
+
)
|
|
270
|
+
| _RELATIVE_WEEKDAY_TERMS
|
|
271
|
+
| _RELATIVE_ORDINAL_PERIOD_TERMS
|
|
272
|
+
| _RELATIVE_SEASON_TERMS
|
|
273
|
+
| _SEASON_TERMS
|
|
274
|
+
)
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
def _has_ordinal_event_term(temporal_terms: tuple[str, ...]) -> bool:
|
|
278
|
+
return any(_ORDINAL_EVENT_TERM_RE.search(term) for term in temporal_terms)
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
def infer_relation_intents(
|
|
282
|
+
*,
|
|
283
|
+
question: str = "",
|
|
284
|
+
relation_terms: tuple[str, ...],
|
|
285
|
+
relation_variant_terms: tuple[str, ...],
|
|
286
|
+
time_intent: RetrievalTimeIntent,
|
|
287
|
+
visual_terms: tuple[str, ...],
|
|
288
|
+
multi_hop_markers: tuple[str, ...],
|
|
289
|
+
) -> tuple[RetrievalRelationIntent, ...]:
|
|
290
|
+
"""Classify relation terms into stable retrieval facets."""
|
|
291
|
+
|
|
292
|
+
relation_set = set(relation_terms)
|
|
293
|
+
variant_set = set(relation_variant_terms)
|
|
294
|
+
facets: list[RetrievalRelationIntent] = []
|
|
295
|
+
for category, config in _RELATION_FACET_CONFIG.items():
|
|
296
|
+
if category == "causal" and not _has_causal_support_intent(
|
|
297
|
+
question=question,
|
|
298
|
+
relation_terms=relation_terms,
|
|
299
|
+
multi_hop_markers=multi_hop_markers,
|
|
300
|
+
time_intent=time_intent,
|
|
301
|
+
) and not _has_adoption_reaction_intent(relation_terms=relation_terms):
|
|
302
|
+
continue
|
|
303
|
+
if category == "location_transition" and not _has_location_transition_intent(
|
|
304
|
+
question=question,
|
|
305
|
+
relation_terms=relation_terms,
|
|
306
|
+
):
|
|
307
|
+
continue
|
|
308
|
+
if category == "current_goal" and not _has_current_goal_intent(
|
|
309
|
+
question=question,
|
|
310
|
+
relation_terms=relation_terms,
|
|
311
|
+
):
|
|
312
|
+
continue
|
|
313
|
+
if category == "action_event" and not _has_action_event_intent(
|
|
314
|
+
question=question,
|
|
315
|
+
relation_terms=relation_terms,
|
|
316
|
+
):
|
|
317
|
+
continue
|
|
318
|
+
if category == "exchange" and not _has_exchange_intent(
|
|
319
|
+
question=question,
|
|
320
|
+
relation_terms=relation_terms,
|
|
321
|
+
):
|
|
322
|
+
continue
|
|
323
|
+
if category == "participation_event" and not _has_participation_event_intent(
|
|
324
|
+
question=question,
|
|
325
|
+
relation_terms=relation_terms,
|
|
326
|
+
):
|
|
327
|
+
continue
|
|
328
|
+
if category == "activity_profile" and not _has_activity_profile_intent(
|
|
329
|
+
question=question,
|
|
330
|
+
relation_terms=relation_terms,
|
|
331
|
+
):
|
|
332
|
+
continue
|
|
333
|
+
if category == "education_profile" and not _has_education_profile_intent(
|
|
334
|
+
question=question,
|
|
335
|
+
relation_terms=relation_terms,
|
|
336
|
+
):
|
|
337
|
+
continue
|
|
338
|
+
if category == "employment_profile" and not _has_employment_profile_intent(
|
|
339
|
+
question=question,
|
|
340
|
+
relation_terms=relation_terms,
|
|
341
|
+
):
|
|
342
|
+
continue
|
|
343
|
+
if category == "health_profile" and not _has_health_profile_intent(
|
|
344
|
+
question=question,
|
|
345
|
+
relation_terms=relation_terms,
|
|
346
|
+
):
|
|
347
|
+
continue
|
|
348
|
+
if category == "contact_profile" and not _has_contact_profile_intent(
|
|
349
|
+
question=question,
|
|
350
|
+
relation_terms=relation_terms,
|
|
351
|
+
):
|
|
352
|
+
continue
|
|
353
|
+
if category == "diet_profile" and not _has_diet_profile_intent(
|
|
354
|
+
question=question,
|
|
355
|
+
relation_terms=relation_terms,
|
|
356
|
+
):
|
|
357
|
+
continue
|
|
358
|
+
if category == "pet_profile" and not _has_pet_profile_intent(
|
|
359
|
+
question=question,
|
|
360
|
+
relation_terms=relation_terms,
|
|
361
|
+
):
|
|
362
|
+
continue
|
|
363
|
+
if category == "skill_profile" and not _has_skill_profile_intent(
|
|
364
|
+
question=question,
|
|
365
|
+
relation_terms=relation_terms,
|
|
366
|
+
):
|
|
367
|
+
continue
|
|
368
|
+
if category == "vehicle_profile" and not _has_vehicle_profile_intent(
|
|
369
|
+
question=question,
|
|
370
|
+
relation_terms=relation_terms,
|
|
371
|
+
):
|
|
372
|
+
continue
|
|
373
|
+
if category == "date_profile" and not _has_date_profile_intent(
|
|
374
|
+
question=question,
|
|
375
|
+
relation_terms=relation_terms,
|
|
376
|
+
):
|
|
377
|
+
continue
|
|
378
|
+
if category == "communication" and not _has_communication_intent(
|
|
379
|
+
question=question,
|
|
380
|
+
relation_terms=relation_terms,
|
|
381
|
+
):
|
|
382
|
+
continue
|
|
383
|
+
if category == "status_profile" and not _has_status_profile_intent(
|
|
384
|
+
question=question,
|
|
385
|
+
relation_terms=relation_terms,
|
|
386
|
+
time_intent=time_intent,
|
|
387
|
+
):
|
|
388
|
+
continue
|
|
389
|
+
if category == "support_goal" and not _has_support_goal_intent(
|
|
390
|
+
question=question,
|
|
391
|
+
relation_terms=relation_terms,
|
|
392
|
+
):
|
|
393
|
+
continue
|
|
394
|
+
if category == "community_membership" and not _has_community_membership_intent(
|
|
395
|
+
question=question,
|
|
396
|
+
relation_terms=relation_terms,
|
|
397
|
+
):
|
|
398
|
+
continue
|
|
399
|
+
if category == "commitment_profile" and not _has_commitment_profile_intent(
|
|
400
|
+
question=question,
|
|
401
|
+
relation_terms=relation_terms,
|
|
402
|
+
):
|
|
403
|
+
continue
|
|
404
|
+
contrast_intent = category == "contrast" and _has_contrast_intent(
|
|
405
|
+
question=question,
|
|
406
|
+
relation_terms=relation_terms,
|
|
407
|
+
multi_hop_markers=multi_hop_markers,
|
|
408
|
+
)
|
|
409
|
+
if category == "contrast" and not contrast_intent:
|
|
410
|
+
continue
|
|
411
|
+
terms = tuple(term for term in relation_terms if term in config["terms"])
|
|
412
|
+
variants = tuple(
|
|
413
|
+
term for term in relation_variant_terms if term in config["variants"]
|
|
414
|
+
)
|
|
415
|
+
marker_hit = bool(set(config["markers"]) & set(multi_hop_markers))
|
|
416
|
+
if not terms and not marker_hit and not contrast_intent:
|
|
417
|
+
continue
|
|
418
|
+
facets.append(
|
|
419
|
+
RetrievalRelationIntent(
|
|
420
|
+
category=category,
|
|
421
|
+
terms=terms,
|
|
422
|
+
variant_terms=variants,
|
|
423
|
+
evidence_need=str(config["evidence_need"]),
|
|
424
|
+
reason_codes=_relation_facet_reason_codes(
|
|
425
|
+
category=category,
|
|
426
|
+
question=question,
|
|
427
|
+
terms=terms,
|
|
428
|
+
variants=variants,
|
|
429
|
+
marker_hit=marker_hit,
|
|
430
|
+
),
|
|
431
|
+
)
|
|
432
|
+
)
|
|
433
|
+
if time_intent.is_temporal:
|
|
434
|
+
facets.append(
|
|
435
|
+
RetrievalRelationIntent(
|
|
436
|
+
category="temporal",
|
|
437
|
+
terms=tuple(term for term in relation_terms if term in relation_set),
|
|
438
|
+
variant_terms=tuple(
|
|
439
|
+
term
|
|
440
|
+
for term in relation_variant_terms
|
|
441
|
+
if term in variant_set and term in _TEMPORAL_SUPPORT_VARIANTS
|
|
442
|
+
),
|
|
443
|
+
evidence_need=(
|
|
444
|
+
"temporal_sequence"
|
|
445
|
+
if time_intent.kind == "temporal_sequence"
|
|
446
|
+
else "temporal_support"
|
|
447
|
+
),
|
|
448
|
+
reason_codes=("time_intent", f"time_kind:{time_intent.kind}"),
|
|
449
|
+
)
|
|
450
|
+
)
|
|
451
|
+
if visual_terms:
|
|
452
|
+
facets.append(
|
|
453
|
+
RetrievalRelationIntent(
|
|
454
|
+
category="visual",
|
|
455
|
+
terms=visual_terms,
|
|
456
|
+
variant_terms=(),
|
|
457
|
+
evidence_need="visual_evidence",
|
|
458
|
+
reason_codes=("visual_terms",),
|
|
459
|
+
)
|
|
460
|
+
)
|
|
461
|
+
return tuple(_dedupe_relation_intents(facets))
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
def infer_evidence_need(
|
|
465
|
+
*,
|
|
466
|
+
question: str = "",
|
|
467
|
+
relation_terms: tuple[str, ...],
|
|
468
|
+
time_intent: RetrievalTimeIntent,
|
|
469
|
+
visual_terms: tuple[str, ...],
|
|
470
|
+
multi_hop_markers: tuple[str, ...],
|
|
471
|
+
benchmark_category: int | None = None,
|
|
472
|
+
answer_unit_shapes: tuple[str, ...] = (),
|
|
473
|
+
) -> tuple[str, ...]:
|
|
474
|
+
needs: list[str] = []
|
|
475
|
+
relation_set = set(relation_terms)
|
|
476
|
+
answer_unit_set = set(answer_unit_shapes)
|
|
477
|
+
count_intent = _has_count_intent(question) and benchmark_category != 3
|
|
478
|
+
list_intent = _has_list_intent(question) and not _is_kinship_status_lookup(
|
|
479
|
+
question,
|
|
480
|
+
relation_terms,
|
|
481
|
+
)
|
|
482
|
+
direct_emotion_response = _has_direct_emotion_response_intent(
|
|
483
|
+
question=question,
|
|
484
|
+
relation_terms=relation_terms,
|
|
485
|
+
)
|
|
486
|
+
if multi_hop_markers and not direct_emotion_response:
|
|
487
|
+
needs.append("multi_hop")
|
|
488
|
+
if count_intent:
|
|
489
|
+
needs.append("count_support")
|
|
490
|
+
if list_intent:
|
|
491
|
+
needs.append("list_support")
|
|
492
|
+
if "quantity_dollar" in answer_unit_set and "employment" not in relation_set:
|
|
493
|
+
needs.append("value_support")
|
|
494
|
+
if time_intent.is_temporal:
|
|
495
|
+
needs.append(
|
|
496
|
+
"temporal_sequence"
|
|
497
|
+
if time_intent.kind == "temporal_sequence"
|
|
498
|
+
else "temporal_support"
|
|
499
|
+
)
|
|
500
|
+
if visual_terms:
|
|
501
|
+
needs.append("visual_evidence")
|
|
502
|
+
if {"favorite", "favourite"} & relation_set:
|
|
503
|
+
needs.append("favorite_preference")
|
|
504
|
+
if {
|
|
505
|
+
"avoid",
|
|
506
|
+
"dislike",
|
|
507
|
+
"favorite",
|
|
508
|
+
"favourite",
|
|
509
|
+
"hate",
|
|
510
|
+
"interest",
|
|
511
|
+
"prefer",
|
|
512
|
+
"preference",
|
|
513
|
+
"enjoy",
|
|
514
|
+
"like",
|
|
515
|
+
"love",
|
|
516
|
+
} & relation_set:
|
|
517
|
+
needs.append("preference")
|
|
518
|
+
if _has_contrast_intent(
|
|
519
|
+
question=question,
|
|
520
|
+
relation_terms=relation_terms,
|
|
521
|
+
multi_hop_markers=multi_hop_markers,
|
|
522
|
+
):
|
|
523
|
+
needs.append("contrast")
|
|
524
|
+
if _has_negative_absence_intent(question):
|
|
525
|
+
needs.append("negative_absence")
|
|
526
|
+
if _has_inference_support_intent(
|
|
527
|
+
question=question,
|
|
528
|
+
relation_terms=relation_terms,
|
|
529
|
+
benchmark_category=benchmark_category,
|
|
530
|
+
):
|
|
531
|
+
needs.append("inference_support")
|
|
532
|
+
if not count_intent and _has_causal_support_intent(
|
|
533
|
+
question=question,
|
|
534
|
+
relation_terms=relation_terms,
|
|
535
|
+
multi_hop_markers=multi_hop_markers,
|
|
536
|
+
time_intent=time_intent,
|
|
537
|
+
):
|
|
538
|
+
needs.append("causal_support")
|
|
539
|
+
if _has_location_transition_intent(
|
|
540
|
+
question=question,
|
|
541
|
+
relation_terms=relation_terms,
|
|
542
|
+
):
|
|
543
|
+
needs.append("location_support")
|
|
544
|
+
if not needs:
|
|
545
|
+
needs.append("single_fact")
|
|
546
|
+
return tuple(dict.fromkeys(needs))
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
def infer_bundle_evidence_roles(
|
|
550
|
+
*,
|
|
551
|
+
evidence_need: tuple[str, ...],
|
|
552
|
+
benchmark_category: int | None = None,
|
|
553
|
+
) -> tuple[str, ...]:
|
|
554
|
+
roles: list[str] = ["primary"]
|
|
555
|
+
evidence_need_set = set(evidence_need)
|
|
556
|
+
if benchmark_category == 1 or "multi_hop" in evidence_need_set:
|
|
557
|
+
roles.append("bridge")
|
|
558
|
+
if benchmark_category == 2 or {
|
|
559
|
+
"temporal_support",
|
|
560
|
+
"temporal_sequence",
|
|
561
|
+
} & evidence_need_set:
|
|
562
|
+
roles.append("temporal_support")
|
|
563
|
+
if "contrast" in evidence_need_set:
|
|
564
|
+
roles.append("contrast")
|
|
565
|
+
if "negative_absence" in evidence_need_set:
|
|
566
|
+
roles.append("negative_support")
|
|
567
|
+
if "count_support" in evidence_need_set:
|
|
568
|
+
roles.append("count_support")
|
|
569
|
+
if "list_support" in evidence_need_set:
|
|
570
|
+
roles.append("list_support")
|
|
571
|
+
if "value_support" in evidence_need_set:
|
|
572
|
+
roles.append("value_support")
|
|
573
|
+
if "location_support" in evidence_need_set:
|
|
574
|
+
roles.append("location_support")
|
|
575
|
+
if "preference" in evidence_need_set:
|
|
576
|
+
roles.append("preference_support")
|
|
577
|
+
if "favorite_preference" in evidence_need_set:
|
|
578
|
+
roles.append("favorite_support")
|
|
579
|
+
if "visual_evidence" in evidence_need_set:
|
|
580
|
+
roles.append("visual_support")
|
|
581
|
+
if "emotion_response" in evidence_need_set:
|
|
582
|
+
roles.append("emotion_response_support")
|
|
583
|
+
if "symbolic_meaning" in evidence_need_set:
|
|
584
|
+
roles.append("symbolic_meaning_support")
|
|
585
|
+
if "communication" in evidence_need_set:
|
|
586
|
+
roles.append("communication_support")
|
|
587
|
+
profile_role_by_need = {
|
|
588
|
+
"action_support": "action_support",
|
|
589
|
+
"activity_support": "activity_support",
|
|
590
|
+
"activity_profile": "activity_support",
|
|
591
|
+
"age_profile": "age_support",
|
|
592
|
+
"alias_profile": "alias_support",
|
|
593
|
+
"current_goal": "current_goal_support",
|
|
594
|
+
"date_profile": "date_support",
|
|
595
|
+
"education_profile": "education_support",
|
|
596
|
+
"employment_profile": "employment_support",
|
|
597
|
+
"health_profile": "health_support",
|
|
598
|
+
"identity_profile": "identity_support",
|
|
599
|
+
"community_membership": "community_membership_support",
|
|
600
|
+
"pet_profile": "pet_support",
|
|
601
|
+
"skill_profile": "skill_support",
|
|
602
|
+
"status_profile": "status_support",
|
|
603
|
+
"support_goal": "support_goal_support",
|
|
604
|
+
"vehicle_profile": "vehicle_support",
|
|
605
|
+
}
|
|
606
|
+
roles.extend(
|
|
607
|
+
role
|
|
608
|
+
for need, role in profile_role_by_need.items()
|
|
609
|
+
if need in evidence_need_set
|
|
610
|
+
and not (benchmark_category == 1 and need == "activity_support")
|
|
611
|
+
)
|
|
612
|
+
if "commitment_profile" in evidence_need_set:
|
|
613
|
+
roles.append("commitment_support")
|
|
614
|
+
if "contact_profile" in evidence_need_set:
|
|
615
|
+
roles.append("contact_support")
|
|
616
|
+
if "diet_profile" in evidence_need_set:
|
|
617
|
+
roles.append("diet_support")
|
|
618
|
+
if "exchange" in evidence_need_set:
|
|
619
|
+
roles.append("exchange_support")
|
|
620
|
+
if "favorite_preference" in evidence_need_set:
|
|
621
|
+
roles.append("favorite_support")
|
|
622
|
+
if {"registration_event", "participation_event"} & evidence_need_set:
|
|
623
|
+
roles.append("event_support")
|
|
624
|
+
if "causal_support" in evidence_need_set:
|
|
625
|
+
roles.append("causal_support")
|
|
626
|
+
if (
|
|
627
|
+
"inference_support" in evidence_need_set
|
|
628
|
+
and "multi_hop" not in evidence_need_set
|
|
629
|
+
):
|
|
630
|
+
roles.append("inference_support")
|
|
631
|
+
return tuple(dict.fromkeys(roles))
|
|
632
|
+
|
|
633
|
+
|
|
634
|
+
def _has_negative_absence_intent(question: str) -> bool:
|
|
635
|
+
normalized = re.sub(r"[^0-9a-z']+", " ", question.casefold()).strip()
|
|
636
|
+
if not normalized:
|
|
637
|
+
return False
|
|
638
|
+
return bool(
|
|
639
|
+
re.search(
|
|
640
|
+
r"\b(?:"
|
|
641
|
+
r"no\s+longer|not\s+yet|never|none|nobody|no\s+one|"
|
|
642
|
+
r"(?:has|have|had|with|there\s+is|there\s+are)\s+no|"
|
|
643
|
+
r"not\s+(?:valid|current|available|present|registered|attending|"
|
|
644
|
+
r"going|using|used|mentioned|included)|"
|
|
645
|
+
r"without|missing|absent"
|
|
646
|
+
r")\b",
|
|
647
|
+
normalized,
|
|
648
|
+
)
|
|
649
|
+
)
|
|
650
|
+
|
|
651
|
+
|
|
652
|
+
def merge_relation_evidence_needs(
|
|
653
|
+
evidence_need: tuple[str, ...],
|
|
654
|
+
relation_intents: tuple[RetrievalRelationIntent, ...],
|
|
655
|
+
) -> tuple[str, ...]:
|
|
656
|
+
"""Promote selected typed relation-facet needs into bundle planning."""
|
|
657
|
+
|
|
658
|
+
category_promoted_needs: set[str] = set()
|
|
659
|
+
promoted_needs = {
|
|
660
|
+
"emotion_response",
|
|
661
|
+
"commitment_profile",
|
|
662
|
+
"contact_profile",
|
|
663
|
+
"diet_profile",
|
|
664
|
+
"education_profile",
|
|
665
|
+
"employment_profile",
|
|
666
|
+
"age_profile",
|
|
667
|
+
"alias_profile",
|
|
668
|
+
"activity_profile",
|
|
669
|
+
"activity_support",
|
|
670
|
+
"action_support",
|
|
671
|
+
"date_profile",
|
|
672
|
+
"health_profile",
|
|
673
|
+
"pet_profile",
|
|
674
|
+
"skill_profile",
|
|
675
|
+
"status_profile",
|
|
676
|
+
"vehicle_profile",
|
|
677
|
+
"communication",
|
|
678
|
+
"current_goal",
|
|
679
|
+
"exchange",
|
|
680
|
+
"favorite_preference",
|
|
681
|
+
"inference_support",
|
|
682
|
+
"identity_profile",
|
|
683
|
+
"community_membership",
|
|
684
|
+
"participation_event",
|
|
685
|
+
"registration_event",
|
|
686
|
+
"support_goal",
|
|
687
|
+
"symbolic_meaning",
|
|
688
|
+
}
|
|
689
|
+
relation_needs: list[str] = []
|
|
690
|
+
for intent in relation_intents:
|
|
691
|
+
if intent.category in category_promoted_needs:
|
|
692
|
+
if "inference_support" not in evidence_need:
|
|
693
|
+
continue
|
|
694
|
+
relation_need = intent.category
|
|
695
|
+
else:
|
|
696
|
+
relation_need = intent.evidence_need
|
|
697
|
+
if relation_need in promoted_needs and relation_need != "inference_support":
|
|
698
|
+
if relation_need == "activity_support" and any(
|
|
699
|
+
relation_intent.category == "activity_profile"
|
|
700
|
+
for relation_intent in relation_intents
|
|
701
|
+
):
|
|
702
|
+
continue
|
|
703
|
+
if relation_need == "activity_support" and "preference" in evidence_need:
|
|
704
|
+
continue
|
|
705
|
+
if (
|
|
706
|
+
relation_need == "support_goal"
|
|
707
|
+
and {"causal_support", "multi_hop"} & set(evidence_need)
|
|
708
|
+
and not _is_direct_support_relation_intent(intent)
|
|
709
|
+
):
|
|
710
|
+
continue
|
|
711
|
+
relation_needs.append(relation_need)
|
|
712
|
+
if not relation_needs:
|
|
713
|
+
return evidence_need
|
|
714
|
+
base_needs = tuple(need for need in evidence_need if need != "single_fact")
|
|
715
|
+
return tuple(dict.fromkeys((*base_needs, *relation_needs)))
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
def _has_contrast_intent(
|
|
719
|
+
*,
|
|
720
|
+
question: str = "",
|
|
721
|
+
relation_terms: tuple[str, ...],
|
|
722
|
+
multi_hop_markers: tuple[str, ...],
|
|
723
|
+
) -> bool:
|
|
724
|
+
normalized = " ".join(str(question or "").casefold().split())
|
|
725
|
+
if _has_commonality_intent(normalized) and not _has_explicit_difference_intent(
|
|
726
|
+
normalized
|
|
727
|
+
):
|
|
728
|
+
return False
|
|
729
|
+
relation_set = set(relation_terms)
|
|
730
|
+
return bool(
|
|
731
|
+
{"between", "compare", "different", "difference", "former", "previous"}
|
|
732
|
+
& relation_set
|
|
733
|
+
or {"compare", "between", "before", "after"} & set(multi_hop_markers)
|
|
734
|
+
or _has_comparative_choice_intent(normalized)
|
|
735
|
+
)
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
_COMMONALITY_INTENT_RE = re.compile(
|
|
739
|
+
r"\b(?:both|common|connects?|mutual|overlap|same|shared|similar)\b|"
|
|
740
|
+
r"\bin\s+common\b"
|
|
741
|
+
)
|
|
742
|
+
_EXPLICIT_DIFFERENCE_INTENT_RE = re.compile(
|
|
743
|
+
r"\b(?:compare|compared|contrast|different|difference)\b"
|
|
744
|
+
)
|
|
745
|
+
_COMPARATIVE_CHOICE_INTENT_RE = re.compile(
|
|
746
|
+
r"\b(?:which\s+(?:one|person)|who)\b"
|
|
747
|
+
r".{0,100}\b(?:chang(?:e|ed|es|ing)?|prefer(?:s|red|ring)?|"
|
|
748
|
+
r"lik(?:e|es|ed|ing)?|enjoy(?:s|ed|ing)?|lov(?:e|es|ed|ing)?)\b"
|
|
749
|
+
r".{0,60}\b(?:more|less|most|least)\b"
|
|
750
|
+
)
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
def _has_commonality_intent(normalized_question: str) -> bool:
|
|
754
|
+
return bool(
|
|
755
|
+
normalized_question and _COMMONALITY_INTENT_RE.search(normalized_question)
|
|
756
|
+
)
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
def _has_explicit_difference_intent(normalized_question: str) -> bool:
|
|
760
|
+
return bool(
|
|
761
|
+
normalized_question
|
|
762
|
+
and _EXPLICIT_DIFFERENCE_INTENT_RE.search(normalized_question)
|
|
763
|
+
)
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
def _has_comparative_choice_intent(normalized_question: str) -> bool:
|
|
767
|
+
return bool(
|
|
768
|
+
normalized_question
|
|
769
|
+
and _COMPARATIVE_CHOICE_INTENT_RE.search(normalized_question)
|
|
770
|
+
)
|
|
771
|
+
|
|
772
|
+
|
|
773
|
+
def _has_count_intent(question: str) -> bool:
|
|
774
|
+
normalized = " ".join(str(question or "").casefold().split())
|
|
775
|
+
return bool(
|
|
776
|
+
normalized
|
|
777
|
+
and re.search(
|
|
778
|
+
r"\b(?:how\s+many|number\s+of|count\s+of|total\s+(?:number|count))\b",
|
|
779
|
+
normalized,
|
|
780
|
+
)
|
|
781
|
+
)
|
|
782
|
+
|
|
783
|
+
|
|
784
|
+
def _has_list_intent(question: str) -> bool:
|
|
785
|
+
normalized = " ".join(str(question or "").casefold().split())
|
|
786
|
+
if not normalized:
|
|
787
|
+
return False
|
|
788
|
+
return bool(
|
|
789
|
+
re.search(
|
|
790
|
+
r"\b(?:list|names|items)\b.+\b(?:are|were|of|for)\b|"
|
|
791
|
+
r"\b(?:what|which)\s+(?:are|were)\s+(?:the\s+)?"
|
|
792
|
+
r"(?:names?|items?|things?|activities|hobbies|books|songs|"
|
|
793
|
+
r"movies|places|people|friends|pets|dogs|cats|children|kids)\b|"
|
|
794
|
+
r"\bwhich\s+(?:names?|items?|things?|activities|hobbies|books|"
|
|
795
|
+
r"songs|movies|places|people|friends|pets|dogs|cats|children|kids)\s+"
|
|
796
|
+
r"(?:do|does|did|has|have|had|is|are|was|were)\b|"
|
|
797
|
+
r"\bwho\s+(?:are|were)\b",
|
|
798
|
+
normalized,
|
|
799
|
+
)
|
|
800
|
+
)
|
|
801
|
+
|
|
802
|
+
|
|
803
|
+
def _is_kinship_status_lookup(
|
|
804
|
+
question: str,
|
|
805
|
+
relation_terms: Sequence[str],
|
|
806
|
+
) -> bool:
|
|
807
|
+
normalized = " ".join(str(question or "").casefold().split())
|
|
808
|
+
if not re.search(r"\bwho\s+(?:are|were)\b", normalized):
|
|
809
|
+
return False
|
|
810
|
+
if re.search(r"\b(?:list|names?|items?)\b", normalized):
|
|
811
|
+
return False
|
|
812
|
+
return bool(
|
|
813
|
+
{
|
|
814
|
+
"brother",
|
|
815
|
+
"child",
|
|
816
|
+
"children",
|
|
817
|
+
"cousin",
|
|
818
|
+
"daughter",
|
|
819
|
+
"father",
|
|
820
|
+
"grandfather",
|
|
821
|
+
"grandmother",
|
|
822
|
+
"husband",
|
|
823
|
+
"kid",
|
|
824
|
+
"mother",
|
|
825
|
+
"parent",
|
|
826
|
+
"sibling",
|
|
827
|
+
"sister",
|
|
828
|
+
"son",
|
|
829
|
+
"spouse",
|
|
830
|
+
"wife",
|
|
831
|
+
}
|
|
832
|
+
& set(relation_terms)
|
|
833
|
+
)
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
def _has_causal_support_intent(
|
|
837
|
+
*,
|
|
838
|
+
question: str,
|
|
839
|
+
relation_terms: tuple[str, ...],
|
|
840
|
+
multi_hop_markers: tuple[str, ...],
|
|
841
|
+
time_intent: RetrievalTimeIntent,
|
|
842
|
+
) -> bool:
|
|
843
|
+
relation_set = set(relation_terms)
|
|
844
|
+
marker_set = set(multi_hop_markers)
|
|
845
|
+
if _has_direct_emotion_response_intent(
|
|
846
|
+
question=question,
|
|
847
|
+
relation_terms=relation_terms,
|
|
848
|
+
):
|
|
849
|
+
return False
|
|
850
|
+
normalized = " ".join(str(question or "").casefold().split())
|
|
851
|
+
if "motivation" in relation_set and _has_motivation_artifact_lookup(normalized):
|
|
852
|
+
return False
|
|
853
|
+
if {"why"} & marker_set:
|
|
854
|
+
return True
|
|
855
|
+
if not time_intent.is_temporal and ({"how"} & marker_set or {"how"} & relation_set):
|
|
856
|
+
return True
|
|
857
|
+
if "prompt" in relation_set and re.search(
|
|
858
|
+
r"\bprompt(?:ed|ing)?\b.+\b(?:to|into)\b"
|
|
859
|
+
r"|\bthat\s+prompt(?:ed|ing)?\b",
|
|
860
|
+
normalized,
|
|
861
|
+
):
|
|
862
|
+
return True
|
|
863
|
+
direct_causal_terms = {
|
|
864
|
+
"because",
|
|
865
|
+
"caus",
|
|
866
|
+
"cause",
|
|
867
|
+
"inspir",
|
|
868
|
+
"motivat",
|
|
869
|
+
"motivate",
|
|
870
|
+
"realize",
|
|
871
|
+
"reason",
|
|
872
|
+
"why",
|
|
873
|
+
}
|
|
874
|
+
if direct_causal_terms & relation_set:
|
|
875
|
+
return True
|
|
876
|
+
if "motivation" not in relation_set:
|
|
877
|
+
return False
|
|
878
|
+
return bool(
|
|
879
|
+
re.search(
|
|
880
|
+
r"\bwhat\s+(?:is|was)\b.+\bmotivation\s+for\s+"
|
|
881
|
+
r"(?:chang|changing|creat|creating|get|getting|keep|keeping|"
|
|
882
|
+
r"leav|leaving|mak|making|pursu|pursuing|runn|running|"
|
|
883
|
+
r"tak|taking|writ|writing)\b",
|
|
884
|
+
normalized,
|
|
885
|
+
)
|
|
886
|
+
or re.search(
|
|
887
|
+
r"\b(?:boost|boosts|boosted|boosting|keep|keeping|stay|staying)\b"
|
|
888
|
+
r".+\bmotivation\b",
|
|
889
|
+
normalized,
|
|
890
|
+
)
|
|
891
|
+
)
|
|
892
|
+
|
|
893
|
+
|
|
894
|
+
def _has_adoption_reaction_intent(*, relation_terms: tuple[str, ...]) -> bool:
|
|
895
|
+
return {"think", "decision", "adopt"}.issubset(set(relation_terms))
|
|
896
|
+
|
|
897
|
+
|
|
898
|
+
def _has_motivation_artifact_lookup(normalized_question: str) -> bool:
|
|
899
|
+
return bool(
|
|
900
|
+
normalized_question
|
|
901
|
+
and re.search(
|
|
902
|
+
r"\b(?:displayed|shown|wrote|written|quote|quotes|plaque|board|"
|
|
903
|
+
r"cork\s+board|whiteboard|journal|spread|schedule)\b"
|
|
904
|
+
r".+\bmotivation(?:al)?\b"
|
|
905
|
+
r"|\bmotivation(?:al)?\b.+"
|
|
906
|
+
r"\b(?:quote|quotes|plaque|board|cork\s+board|whiteboard|"
|
|
907
|
+
r"journal|spread|schedule)\b",
|
|
908
|
+
normalized_question,
|
|
909
|
+
)
|
|
910
|
+
)
|
|
911
|
+
|
|
912
|
+
|
|
913
|
+
def _has_location_transition_intent(
|
|
914
|
+
*,
|
|
915
|
+
question: str,
|
|
916
|
+
relation_terms: tuple[str, ...],
|
|
917
|
+
) -> bool:
|
|
918
|
+
relation_set = set(relation_terms)
|
|
919
|
+
if not {
|
|
920
|
+
"grow",
|
|
921
|
+
"based",
|
|
922
|
+
"live",
|
|
923
|
+
"move",
|
|
924
|
+
"origin",
|
|
925
|
+
"relocate",
|
|
926
|
+
"relocated",
|
|
927
|
+
"roadtrip",
|
|
928
|
+
"camp",
|
|
929
|
+
"employment",
|
|
930
|
+
"travel",
|
|
931
|
+
"trip",
|
|
932
|
+
"venue",
|
|
933
|
+
"visit",
|
|
934
|
+
"stay",
|
|
935
|
+
"attend",
|
|
936
|
+
} & relation_set:
|
|
937
|
+
return False
|
|
938
|
+
normalized = " ".join(str(question or "").casefold().split())
|
|
939
|
+
if "employment" in relation_set and not (
|
|
940
|
+
relation_set
|
|
941
|
+
& {
|
|
942
|
+
"based",
|
|
943
|
+
"live",
|
|
944
|
+
"move",
|
|
945
|
+
"origin",
|
|
946
|
+
"relocate",
|
|
947
|
+
"relocated",
|
|
948
|
+
"stay",
|
|
949
|
+
"travel",
|
|
950
|
+
"trip",
|
|
951
|
+
"visit",
|
|
952
|
+
}
|
|
953
|
+
) and not re.search(
|
|
954
|
+
r"\b(?:which\s+(?:city|country|place)|what\s+place)\b"
|
|
955
|
+
r".+\b(?:work|worked|working)\b|"
|
|
956
|
+
r"\b(?:work|worked|working)\b.+"
|
|
957
|
+
r"\b(?:which\s+(?:city|country|place)|what\s+place)\b",
|
|
958
|
+
normalized,
|
|
959
|
+
):
|
|
960
|
+
return False
|
|
961
|
+
if not normalized:
|
|
962
|
+
return False
|
|
963
|
+
if _has_future_home_move_goal_intent(normalized):
|
|
964
|
+
return False
|
|
965
|
+
if re.search(
|
|
966
|
+
r"\b(?:move|moved|moving|relocate|relocated)\s+"
|
|
967
|
+
r"(?:the\s+)?(?:meeting|call|note|document|file|deadline|appointment|"
|
|
968
|
+
r"task|ticket|event|conversation)\b",
|
|
969
|
+
normalized,
|
|
970
|
+
):
|
|
971
|
+
return False
|
|
972
|
+
return bool(
|
|
973
|
+
re.search(
|
|
974
|
+
r"\b(?:where|which\s+(?:city|country|place)|from|origin|"
|
|
975
|
+
r"what\s+(?:type\s+of\s+|kind\s+of\s+)?(?:place|venue)|"
|
|
976
|
+
r"home\s+country|hometown|born|raised|"
|
|
977
|
+
r"childhood|originally|relocat(?:e|ed|ion)|"
|
|
978
|
+
r"current\s+(?:city|home|location))\b",
|
|
979
|
+
normalized,
|
|
980
|
+
)
|
|
981
|
+
or re.search(
|
|
982
|
+
r"\b(?:move|moved|moving|relocate|relocated|live|lived|living|based|"
|
|
983
|
+
r"stay|stayed|staying|grow|grew|camp|camped|camping|travel|"
|
|
984
|
+
r"traveled|travelled|traveling|travelling|visit|visited|visiting|"
|
|
985
|
+
r"attend|attended|attending)\s+"
|
|
986
|
+
r"(?:from|in|at|near|around|up\b)",
|
|
987
|
+
normalized,
|
|
988
|
+
)
|
|
989
|
+
or re.search(
|
|
990
|
+
r"\b(?:where|which\s+(?:place|venue)|what\s+(?:place|venue))\b"
|
|
991
|
+
r".+\b(?:attend|attended|attending)\b|"
|
|
992
|
+
r"\b(?:attend|attended|attending)\b.+"
|
|
993
|
+
r"\b(?:where|which\s+(?:place|venue)|what\s+(?:place|venue))\b",
|
|
994
|
+
normalized,
|
|
995
|
+
)
|
|
996
|
+
or re.search(
|
|
997
|
+
r"\b(?:where|which\s+(?:city|country|place)|what\s+place)\b"
|
|
998
|
+
r".+\b(?:work|worked|working)\b|"
|
|
999
|
+
r"\b(?:work|worked|working)\b.+"
|
|
1000
|
+
r"\b(?:where|which\s+(?:city|country|place)|what\s+place)\b",
|
|
1001
|
+
normalized,
|
|
1002
|
+
)
|
|
1003
|
+
)
|
|
1004
|
+
|
|
1005
|
+
|
|
1006
|
+
def _has_current_goal_intent(
|
|
1007
|
+
*,
|
|
1008
|
+
question: str,
|
|
1009
|
+
relation_terms: tuple[str, ...],
|
|
1010
|
+
) -> bool:
|
|
1011
|
+
if not {"want", "plan"} & set(relation_terms):
|
|
1012
|
+
return False
|
|
1013
|
+
normalized = " ".join(str(question or "").casefold().split())
|
|
1014
|
+
if re.search(r"\b(?:if|hadn t|had not)\b", normalized):
|
|
1015
|
+
return False
|
|
1016
|
+
if re.search(r"\b(?:cancel(?:ed|led|s)?|reschedul(?:e|ed|es|ing)?)\b", normalized):
|
|
1017
|
+
return False
|
|
1018
|
+
if "plan" in set(relation_terms) and re.search(
|
|
1019
|
+
r"\b(?:plan|plans|planned|planning)\b",
|
|
1020
|
+
normalized,
|
|
1021
|
+
):
|
|
1022
|
+
return True
|
|
1023
|
+
if "want" in set(relation_terms) and re.search(
|
|
1024
|
+
r"\b(?:want|wants|wanted|wanting)\s+to\s+"
|
|
1025
|
+
r"(?:create|build|make|teach|keep|expand|move|meet|work|go|do|try|"
|
|
1026
|
+
r"share|learn|pursue|start|open|organize|visit|live)\b",
|
|
1027
|
+
normalized,
|
|
1028
|
+
):
|
|
1029
|
+
return True
|
|
1030
|
+
return bool(
|
|
1031
|
+
normalized
|
|
1032
|
+
and (
|
|
1033
|
+
_has_future_home_move_goal_intent(normalized)
|
|
1034
|
+
or re.search(r"\b(?:current\s+goal|future|soon)\b", normalized)
|
|
1035
|
+
)
|
|
1036
|
+
)
|
|
1037
|
+
|
|
1038
|
+
|
|
1039
|
+
def _has_support_goal_intent(
|
|
1040
|
+
*,
|
|
1041
|
+
question: str,
|
|
1042
|
+
relation_terms: tuple[str, ...],
|
|
1043
|
+
) -> bool:
|
|
1044
|
+
relation_set = set(relation_terms)
|
|
1045
|
+
if not {
|
|
1046
|
+
"adopt",
|
|
1047
|
+
"adoption",
|
|
1048
|
+
"agency",
|
|
1049
|
+
"career",
|
|
1050
|
+
"counsel",
|
|
1051
|
+
"field",
|
|
1052
|
+
"grow",
|
|
1053
|
+
"help",
|
|
1054
|
+
"path",
|
|
1055
|
+
"pursue",
|
|
1056
|
+
"receive",
|
|
1057
|
+
"support",
|
|
1058
|
+
"work",
|
|
1059
|
+
"write",
|
|
1060
|
+
} & relation_set:
|
|
1061
|
+
return False
|
|
1062
|
+
normalized_question = " ".join(str(question or "").casefold().split())
|
|
1063
|
+
if re.search(
|
|
1064
|
+
r"\b(?:different|difference|compare|compared|before|former|previous)\b",
|
|
1065
|
+
normalized_question,
|
|
1066
|
+
):
|
|
1067
|
+
return False
|
|
1068
|
+
if _has_direct_support_role_question(normalized_question):
|
|
1069
|
+
return True
|
|
1070
|
+
return bool(
|
|
1071
|
+
normalized_question
|
|
1072
|
+
and (
|
|
1073
|
+
re.search(
|
|
1074
|
+
r"\b(?:support|supported|growing\s+up|"
|
|
1075
|
+
r"adoption\s+agency|agency\b.+\bsupport|support\b.+\bagency)\b",
|
|
1076
|
+
normalized_question,
|
|
1077
|
+
)
|
|
1078
|
+
or re.search(
|
|
1079
|
+
r"\bhelp(?:ed|ing)?\s+(?:children|kids|people|others|students|"
|
|
1080
|
+
r"community|individuals|folks)\b",
|
|
1081
|
+
normalized_question,
|
|
1082
|
+
)
|
|
1083
|
+
or re.search(
|
|
1084
|
+
r"\b(?:career|field|path|profession|work|job|write|writing|"
|
|
1085
|
+
r"counsel(?:ing|or)?|pursue)\b",
|
|
1086
|
+
normalized_question,
|
|
1087
|
+
)
|
|
1088
|
+
)
|
|
1089
|
+
)
|
|
1090
|
+
|
|
1091
|
+
|
|
1092
|
+
def _has_community_membership_intent(
|
|
1093
|
+
*,
|
|
1094
|
+
question: str,
|
|
1095
|
+
relation_terms: tuple[str, ...],
|
|
1096
|
+
) -> bool:
|
|
1097
|
+
normalized_question = " ".join(str(question or "").casefold().split())
|
|
1098
|
+
relation_set = set(relation_terms)
|
|
1099
|
+
membership_terms = {
|
|
1100
|
+
"belong",
|
|
1101
|
+
"belongs",
|
|
1102
|
+
"identified",
|
|
1103
|
+
"identifies",
|
|
1104
|
+
"identify",
|
|
1105
|
+
"member",
|
|
1106
|
+
"membership",
|
|
1107
|
+
"part",
|
|
1108
|
+
}
|
|
1109
|
+
community_terms = {
|
|
1110
|
+
"community",
|
|
1111
|
+
"lgbt",
|
|
1112
|
+
"lgbtq",
|
|
1113
|
+
"queer",
|
|
1114
|
+
"trans",
|
|
1115
|
+
"transgender",
|
|
1116
|
+
}
|
|
1117
|
+
return bool(
|
|
1118
|
+
membership_terms & relation_set
|
|
1119
|
+
and community_terms & relation_set
|
|
1120
|
+
and not re.search(
|
|
1121
|
+
r"\b(?:ally|supportive|supporting)\b",
|
|
1122
|
+
normalized_question,
|
|
1123
|
+
)
|
|
1124
|
+
)
|
|
1125
|
+
|
|
1126
|
+
|
|
1127
|
+
def _is_direct_support_relation_intent(intent: RetrievalRelationIntent) -> bool:
|
|
1128
|
+
return "direct_support_question" in set(intent.reason_codes)
|
|
1129
|
+
|
|
1130
|
+
|
|
1131
|
+
def _has_direct_support_role_question(normalized_question: str) -> bool:
|
|
1132
|
+
support_action = r"(?:help(?:ed|ing)?|assist(?:ed|ing)?|support(?:s|ed|ing)?)"
|
|
1133
|
+
return bool(
|
|
1134
|
+
re.search(
|
|
1135
|
+
rf"\b(?:who|whom)\b.+\b{support_action}\b",
|
|
1136
|
+
normalized_question,
|
|
1137
|
+
)
|
|
1138
|
+
or re.search(
|
|
1139
|
+
r"\bhow\b.+\b(?:get|got|receive|received|find|found)\b.+\bsupport\b"
|
|
1140
|
+
r".+\b(?:after|through|when|with|from)\b",
|
|
1141
|
+
normalized_question,
|
|
1142
|
+
)
|
|
1143
|
+
or re.search(
|
|
1144
|
+
rf"\b{support_action}\b.+\b(?:after|through|when|with)\b",
|
|
1145
|
+
normalized_question,
|
|
1146
|
+
)
|
|
1147
|
+
)
|
|
1148
|
+
|
|
1149
|
+
|
|
1150
|
+
def _has_future_home_move_goal_intent(normalized_question: str) -> bool:
|
|
1151
|
+
if re.search(r"\b(?:where|which\s+(?:city|country|place)|from|origin)\b", normalized_question):
|
|
1152
|
+
return False
|
|
1153
|
+
return bool(
|
|
1154
|
+
re.search(r"\b(?:would|want|wants|wanted|hope|hoping|plan|plans)\b", normalized_question)
|
|
1155
|
+
and re.search(r"\bmove\s+back\b", normalized_question)
|
|
1156
|
+
and re.search(r"\bhome\s+country\b", normalized_question)
|
|
1157
|
+
)
|
|
1158
|
+
|
|
1159
|
+
|
|
1160
|
+
def _has_inference_support_intent(
|
|
1161
|
+
*,
|
|
1162
|
+
question: str,
|
|
1163
|
+
relation_terms: tuple[str, ...],
|
|
1164
|
+
benchmark_category: int | None,
|
|
1165
|
+
) -> bool:
|
|
1166
|
+
if benchmark_category == 3:
|
|
1167
|
+
return True
|
|
1168
|
+
relation_set = set(relation_terms)
|
|
1169
|
+
if {"relationship", "status"}.issubset(relation_set):
|
|
1170
|
+
return True
|
|
1171
|
+
if "decision" in relation_set:
|
|
1172
|
+
return True
|
|
1173
|
+
normalized = " ".join(str(question or "").casefold().split())
|
|
1174
|
+
return bool(
|
|
1175
|
+
re.search(r"\b(?:would|likely|might|could)\b", normalized)
|
|
1176
|
+
and relation_set
|
|
1177
|
+
)
|
|
1178
|
+
|
|
1179
|
+
|
|
1180
|
+
def _has_action_event_intent(
|
|
1181
|
+
*,
|
|
1182
|
+
question: str,
|
|
1183
|
+
relation_terms: tuple[str, ...],
|
|
1184
|
+
) -> bool:
|
|
1185
|
+
if "action" not in set(relation_terms):
|
|
1186
|
+
return False
|
|
1187
|
+
normalized_question = re.sub(r"[^0-9a-z]+", " ", question.casefold()).strip()
|
|
1188
|
+
return bool(
|
|
1189
|
+
re.search(
|
|
1190
|
+
r"\bwhat\s+did\b.+\b(?:"
|
|
1191
|
+
r"bring|brought|take|took|send|sent|share|shared|paint|painted|"
|
|
1192
|
+
r"draw|drew|make|made|book|booked|schedule|scheduled|prepare|prepared|"
|
|
1193
|
+
r"complete|completed|fix|fixed|repair|repaired|create|created"
|
|
1194
|
+
r")\b",
|
|
1195
|
+
normalized_question,
|
|
1196
|
+
)
|
|
1197
|
+
)
|
|
1198
|
+
|
|
1199
|
+
|
|
1200
|
+
def _has_exchange_intent(
|
|
1201
|
+
*,
|
|
1202
|
+
question: str,
|
|
1203
|
+
relation_terms: tuple[str, ...],
|
|
1204
|
+
) -> bool:
|
|
1205
|
+
relation_set = set(relation_terms)
|
|
1206
|
+
exchange_terms = {
|
|
1207
|
+
"bought",
|
|
1208
|
+
"bring",
|
|
1209
|
+
"brought",
|
|
1210
|
+
"give",
|
|
1211
|
+
"get",
|
|
1212
|
+
"got",
|
|
1213
|
+
"gift",
|
|
1214
|
+
"offer",
|
|
1215
|
+
"purchas",
|
|
1216
|
+
"purchase",
|
|
1217
|
+
"receive",
|
|
1218
|
+
}
|
|
1219
|
+
if not exchange_terms & relation_set:
|
|
1220
|
+
return False
|
|
1221
|
+
if "give" in relation_set and {"school", "speech", "talk", "presentation"} & relation_set:
|
|
1222
|
+
return False
|
|
1223
|
+
if {"support", "grow", "counsel", "help"} & relation_set and {
|
|
1224
|
+
"get",
|
|
1225
|
+
"got",
|
|
1226
|
+
"receive",
|
|
1227
|
+
} & relation_set:
|
|
1228
|
+
return False
|
|
1229
|
+
if {"get", "got"} & relation_set:
|
|
1230
|
+
normalized_question = re.sub(r"[^0-9a-z]+", " ", question.casefold()).strip()
|
|
1231
|
+
return bool(
|
|
1232
|
+
re.search(
|
|
1233
|
+
r"\b(?:what|which)(?:\s+\w+){0,3}\s+"
|
|
1234
|
+
r"(?:did|do|does|had|has|have|will|would|could|should)\b"
|
|
1235
|
+
r".+\b(?:get|got)\b",
|
|
1236
|
+
normalized_question,
|
|
1237
|
+
)
|
|
1238
|
+
or re.search(r"\b(?:get|got)\b.+\bfrom\b", normalized_question)
|
|
1239
|
+
)
|
|
1240
|
+
return True
|
|
1241
|
+
|
|
1242
|
+
|
|
1243
|
+
def _has_participation_event_intent(
|
|
1244
|
+
*,
|
|
1245
|
+
question: str,
|
|
1246
|
+
relation_terms: tuple[str, ...],
|
|
1247
|
+
) -> bool:
|
|
1248
|
+
relation_set = set(relation_terms)
|
|
1249
|
+
if not {
|
|
1250
|
+
"attend",
|
|
1251
|
+
"join",
|
|
1252
|
+
"meet",
|
|
1253
|
+
"participate",
|
|
1254
|
+
"travel",
|
|
1255
|
+
"visit",
|
|
1256
|
+
} & relation_set:
|
|
1257
|
+
return False
|
|
1258
|
+
normalized_question = re.sub(r"[^0-9a-z]+", " ", question.casefold()).strip()
|
|
1259
|
+
if "meet" in relation_set:
|
|
1260
|
+
if re.search(
|
|
1261
|
+
r"\bmeet(?:ing)?\s+(?:agenda|notes|minutes|summary)\b|"
|
|
1262
|
+
r"\bmeet\s+"
|
|
1263
|
+
r"(?:expectation|expectations|goal|goals|requirement|requirements)\b",
|
|
1264
|
+
normalized_question,
|
|
1265
|
+
):
|
|
1266
|
+
return False
|
|
1267
|
+
return bool(
|
|
1268
|
+
re.search(
|
|
1269
|
+
r"\b(?:who|when|where)\b.+\bmeet\b|"
|
|
1270
|
+
r"\bmeet\s+up\b|\bmet\s+(?:with|up)\b|"
|
|
1271
|
+
r"\bmeeting\s+with\b|\bmeet(?:ing)?\b.+\b(?:friend|family|mentor|"
|
|
1272
|
+
r"colleague|coworker|team|group)\b",
|
|
1273
|
+
normalized_question,
|
|
1274
|
+
)
|
|
1275
|
+
)
|
|
1276
|
+
if "travel" not in relation_set:
|
|
1277
|
+
return True
|
|
1278
|
+
if re.search(
|
|
1279
|
+
r"\btravel\s+(?:book|guide|story|documentary|show)\b",
|
|
1280
|
+
normalized_question,
|
|
1281
|
+
):
|
|
1282
|
+
return False
|
|
1283
|
+
return bool(
|
|
1284
|
+
re.search(
|
|
1285
|
+
r"\bwhere\b.+\btravel\b|\btravel(?:ed|ing)?\s+to\b|"
|
|
1286
|
+
r"\b(?:what|which)\s+(?:country|city|place)\b.+\btravel\b|"
|
|
1287
|
+
r"\b(?:trip|vacation)\b",
|
|
1288
|
+
normalized_question,
|
|
1289
|
+
)
|
|
1290
|
+
)
|
|
1291
|
+
|
|
1292
|
+
|
|
1293
|
+
def _has_activity_profile_intent(
|
|
1294
|
+
*,
|
|
1295
|
+
question: str,
|
|
1296
|
+
relation_terms: tuple[str, ...],
|
|
1297
|
+
) -> bool:
|
|
1298
|
+
relation_set = set(relation_terms)
|
|
1299
|
+
if not {"activity", "exercise", "hobby", "sport"} & relation_set:
|
|
1300
|
+
return False
|
|
1301
|
+
normalized_question = re.sub(r"[^0-9a-z]+", " ", question.casefold()).strip()
|
|
1302
|
+
if re.search(r"\bsports?\s+(?:team|score|game|match|event)\b", normalized_question):
|
|
1303
|
+
return False
|
|
1304
|
+
if "activity" in relation_set and not {"exercise", "hobby", "sport"} & relation_set:
|
|
1305
|
+
return bool(
|
|
1306
|
+
re.search(
|
|
1307
|
+
r"\b(?:hobby|hobbies|pastime|free\s+time|for\s+fun)\b|"
|
|
1308
|
+
r"\bwhat\b.+\b(?:do|does)\b.+\b(?:for\s+fun|free\s+time|relax)\b|"
|
|
1309
|
+
r"\b(?:exercise|workout)\b",
|
|
1310
|
+
normalized_question,
|
|
1311
|
+
)
|
|
1312
|
+
)
|
|
1313
|
+
return bool(
|
|
1314
|
+
re.search(
|
|
1315
|
+
r"\b(?:what|which)\s+(?:activity|activities|hobby|hobbies|sport|sports)\b|"
|
|
1316
|
+
r"\b(?:hobby|hobbies|pastime|free\s+time|for\s+fun)\b|"
|
|
1317
|
+
r"\bwhat\b.+\b(?:do|does)\b.+\b(?:for\s+fun|free\s+time|relax)\b|"
|
|
1318
|
+
r"\b(?:exercise|workout)\b",
|
|
1319
|
+
normalized_question,
|
|
1320
|
+
)
|
|
1321
|
+
)
|
|
1322
|
+
|
|
1323
|
+
|
|
1324
|
+
def _has_communication_intent(
|
|
1325
|
+
*,
|
|
1326
|
+
question: str,
|
|
1327
|
+
relation_terms: tuple[str, ...],
|
|
1328
|
+
) -> bool:
|
|
1329
|
+
relation_set = set(relation_terms)
|
|
1330
|
+
if (
|
|
1331
|
+
{
|
|
1332
|
+
"advise",
|
|
1333
|
+
"ask",
|
|
1334
|
+
"invit",
|
|
1335
|
+
"invitation",
|
|
1336
|
+
"invite",
|
|
1337
|
+
"recommend",
|
|
1338
|
+
"remind",
|
|
1339
|
+
"reminded",
|
|
1340
|
+
"request",
|
|
1341
|
+
"suggest",
|
|
1342
|
+
"tell",
|
|
1343
|
+
"told",
|
|
1344
|
+
"warn",
|
|
1345
|
+
"warned",
|
|
1346
|
+
}
|
|
1347
|
+
& relation_set
|
|
1348
|
+
):
|
|
1349
|
+
return True
|
|
1350
|
+
normalized_question = re.sub(r"[^0-9a-z]+", " ", question.casefold()).strip()
|
|
1351
|
+
if {"chat", "discus", "discuss", "talk"} & relation_set:
|
|
1352
|
+
if re.search(
|
|
1353
|
+
r"\bwhy\b.+\b(?:after|before|while)\s+"
|
|
1354
|
+
r"(?:chat(?:ted|ting)?|discuss(?:ed|ing)?|talk(?:ed|ing)?)\b",
|
|
1355
|
+
normalized_question,
|
|
1356
|
+
):
|
|
1357
|
+
return False
|
|
1358
|
+
if re.search(
|
|
1359
|
+
r"\b(?:give|gave|giving|present|presented|presentation|speech)\b"
|
|
1360
|
+
r".{0,40}\b(?:talk|discussion)\b"
|
|
1361
|
+
r"|\b(?:talk|discussion)\b.{0,40}\b(?:school|speech|event|presentation)\b",
|
|
1362
|
+
normalized_question,
|
|
1363
|
+
):
|
|
1364
|
+
return False
|
|
1365
|
+
return bool(
|
|
1366
|
+
re.search(
|
|
1367
|
+
r"\b(?:who|whom|what)\b.+\b(?:chat|discuss|talk)\b",
|
|
1368
|
+
normalized_question,
|
|
1369
|
+
)
|
|
1370
|
+
or re.search(
|
|
1371
|
+
r"\b(?:chat|discuss|talk)(?:ed|ing)?\b.+\b(?:about|to|with)\b",
|
|
1372
|
+
normalized_question,
|
|
1373
|
+
)
|
|
1374
|
+
)
|
|
1375
|
+
if {"call", "message", "messag", "send", "sent", "text"} & relation_set:
|
|
1376
|
+
if "call" in relation_set and {"miss", "missed"} & relation_set:
|
|
1377
|
+
return False
|
|
1378
|
+
if re.search(r"\bwhat\s+did\b.+\bcall\b(?!.*\b(?:about|to|with)\b)", normalized_question):
|
|
1379
|
+
return False
|
|
1380
|
+
return bool(
|
|
1381
|
+
re.search(
|
|
1382
|
+
r"\b(?:who|whom|when)\b.+\b(?:call|message|send|sent|text)\b",
|
|
1383
|
+
normalized_question,
|
|
1384
|
+
)
|
|
1385
|
+
or re.search(
|
|
1386
|
+
r"\b(?:call|message|messag|send|sent|text)(?:ed|ing)?\b"
|
|
1387
|
+
r".+\b(?:about|to|with)\b",
|
|
1388
|
+
normalized_question,
|
|
1389
|
+
)
|
|
1390
|
+
)
|
|
1391
|
+
if {"say", "said"} & relation_set:
|
|
1392
|
+
if {"personality", "trait"} & relation_set:
|
|
1393
|
+
return False
|
|
1394
|
+
if re.search(
|
|
1395
|
+
r"\b(?:what|which)\s+(?:do|does|did)\s+(?:the\s+)?"
|
|
1396
|
+
r"(?:book|card|document|label|letter|note|sign|text)\s+"
|
|
1397
|
+
r"(?:say|said)\b",
|
|
1398
|
+
normalized_question,
|
|
1399
|
+
):
|
|
1400
|
+
return False
|
|
1401
|
+
return bool(
|
|
1402
|
+
re.search(r"\b(?:what|who|whom)\b.+\b(?:say|said)\b", normalized_question)
|
|
1403
|
+
or re.search(
|
|
1404
|
+
r"\b(?:say|said)\b.+\b(?:about|that|to|with)\b",
|
|
1405
|
+
normalized_question,
|
|
1406
|
+
)
|
|
1407
|
+
)
|
|
1408
|
+
if "mention" not in relation_set:
|
|
1409
|
+
return False
|
|
1410
|
+
return bool(
|
|
1411
|
+
re.search(
|
|
1412
|
+
r"\b(?:who|whom)\b.+\bmention\b|\bmention(?:ed)?\b.+\b(?:to|with)\b",
|
|
1413
|
+
normalized_question,
|
|
1414
|
+
)
|
|
1415
|
+
)
|
|
1416
|
+
|
|
1417
|
+
|
|
1418
|
+
def _has_direct_emotion_response_intent(
|
|
1419
|
+
*,
|
|
1420
|
+
question: str,
|
|
1421
|
+
relation_terms: tuple[str, ...],
|
|
1422
|
+
) -> bool:
|
|
1423
|
+
relation_set = set(relation_terms)
|
|
1424
|
+
if not {"excite", "feel"} & relation_set:
|
|
1425
|
+
return False
|
|
1426
|
+
if {"cause", "decide", "decision", "realize", "think", "why"} & relation_set:
|
|
1427
|
+
return False
|
|
1428
|
+
normalized_question = re.sub(r"[^0-9a-z]+", " ", question.casefold()).strip()
|
|
1429
|
+
if re.search(r"\bwhy\b|\bwhat\s+(?:made|caused)\b", normalized_question):
|
|
1430
|
+
return False
|
|
1431
|
+
return bool(
|
|
1432
|
+
re.search(r"\bhow\b.+\b(?:feel|feeling|felt)\b", normalized_question)
|
|
1433
|
+
or re.search(r"\bwhat\b.+\bexcited\b", normalized_question)
|
|
1434
|
+
)
|
|
1435
|
+
|
|
1436
|
+
|
|
1437
|
+
def _has_status_profile_intent(
|
|
1438
|
+
*,
|
|
1439
|
+
question: str,
|
|
1440
|
+
relation_terms: tuple[str, ...],
|
|
1441
|
+
time_intent: RetrievalTimeIntent,
|
|
1442
|
+
) -> bool:
|
|
1443
|
+
relation_set = set(relation_terms)
|
|
1444
|
+
status_terms = {
|
|
1445
|
+
"boyfriend",
|
|
1446
|
+
"boss",
|
|
1447
|
+
"brother",
|
|
1448
|
+
"child",
|
|
1449
|
+
"children",
|
|
1450
|
+
"colleague",
|
|
1451
|
+
"cousin",
|
|
1452
|
+
"coworker",
|
|
1453
|
+
"dating",
|
|
1454
|
+
"daughter",
|
|
1455
|
+
"engag",
|
|
1456
|
+
"engaged",
|
|
1457
|
+
"family",
|
|
1458
|
+
"father",
|
|
1459
|
+
"fiance",
|
|
1460
|
+
"fiancee",
|
|
1461
|
+
"friend",
|
|
1462
|
+
"girlfriend",
|
|
1463
|
+
"grandfather",
|
|
1464
|
+
"grandmother",
|
|
1465
|
+
"husband",
|
|
1466
|
+
"manager",
|
|
1467
|
+
"member",
|
|
1468
|
+
"mentor",
|
|
1469
|
+
"marital",
|
|
1470
|
+
"marri",
|
|
1471
|
+
"marry",
|
|
1472
|
+
"married",
|
|
1473
|
+
"mother",
|
|
1474
|
+
"neighbor",
|
|
1475
|
+
"parent",
|
|
1476
|
+
"partner",
|
|
1477
|
+
"relationship",
|
|
1478
|
+
"roommate",
|
|
1479
|
+
"sibling",
|
|
1480
|
+
"sister",
|
|
1481
|
+
"son",
|
|
1482
|
+
"spouse",
|
|
1483
|
+
"status",
|
|
1484
|
+
"team",
|
|
1485
|
+
"teammate",
|
|
1486
|
+
"wife",
|
|
1487
|
+
}
|
|
1488
|
+
if not status_terms & relation_set:
|
|
1489
|
+
return False
|
|
1490
|
+
if time_intent.is_temporal:
|
|
1491
|
+
return False
|
|
1492
|
+
normalized_question = re.sub(r"[^0-9a-z]+", " ", question.casefold()).strip()
|
|
1493
|
+
if re.search(r"\bgroup\s+of\s+friends\b", normalized_question):
|
|
1494
|
+
return False
|
|
1495
|
+
if re.search(
|
|
1496
|
+
r"\bpartner(?:ed)?\s+with\b.+\b(?:project|work|assignment|team|"
|
|
1497
|
+
r"presentation|report)\b|"
|
|
1498
|
+
r"\bwho\s+did\b.+\bpartner\s+with\b|"
|
|
1499
|
+
r"\b(?:project|work|assignment|team|presentation|report)\s+"
|
|
1500
|
+
r"partner\s+s\s+name\b",
|
|
1501
|
+
normalized_question,
|
|
1502
|
+
):
|
|
1503
|
+
return False
|
|
1504
|
+
return bool(
|
|
1505
|
+
re.search(r"\b(?:relationship|marital)\s+status\b", normalized_question)
|
|
1506
|
+
or re.search(
|
|
1507
|
+
r"\bwho\b.+\b(?:boyfriend|boss|brother|child|children|colleague|"
|
|
1508
|
+
r"cousin|coworker|daughter|father|fiancee?|friend|girlfriend|"
|
|
1509
|
+
r"grandfather|grandmother|husband|"
|
|
1510
|
+
r"kids|manager|mentor|mother|neighbor|parent|parents|partner|roommate|sibling|"
|
|
1511
|
+
r"sister|son|spouse|team|team\s+member|teammate|wife)\b",
|
|
1512
|
+
normalized_question,
|
|
1513
|
+
)
|
|
1514
|
+
or re.search(
|
|
1515
|
+
r"\b(?:does|do|did)\b.+\bhave\b.+"
|
|
1516
|
+
r"\b(?:child|children|kids|son|daughter)\b",
|
|
1517
|
+
normalized_question,
|
|
1518
|
+
)
|
|
1519
|
+
or re.search(
|
|
1520
|
+
r"\bwhat\s+(?:is|are|was|were)\b.+"
|
|
1521
|
+
r"\b(?:boyfriend|boss|brother|child|children|colleague|cousin|"
|
|
1522
|
+
r"coworker|daughter|father|fiancee?|friend|girlfriend|grandfather|"
|
|
1523
|
+
r"grandmother|husband|kids|manager|mentor|mother|neighbor|parent|"
|
|
1524
|
+
r"parents|partner|roommate|sibling|sister|son|spouse|team|"
|
|
1525
|
+
r"team\s+member|teammate|wife)"
|
|
1526
|
+
r"\s+s\s+names?\b",
|
|
1527
|
+
normalized_question,
|
|
1528
|
+
)
|
|
1529
|
+
or re.search(
|
|
1530
|
+
r"\b(?:who|whom)\b.+\b(?:team\s+member|teammate)\b|"
|
|
1531
|
+
r"\b(?:who|whom)\b.+\bon\b.+\bteam\b|"
|
|
1532
|
+
r"\bwhat\b.+\bteam\b.+\b(?:on|member|teammate)\b",
|
|
1533
|
+
normalized_question,
|
|
1534
|
+
)
|
|
1535
|
+
or re.search(
|
|
1536
|
+
r"\b(?:is|are|was|were)\b.+\b(?:dating|engaged|married|single|"
|
|
1537
|
+
r"divorced)\b",
|
|
1538
|
+
normalized_question,
|
|
1539
|
+
)
|
|
1540
|
+
)
|
|
1541
|
+
|
|
1542
|
+
|
|
1543
|
+
def _has_commitment_profile_intent(
|
|
1544
|
+
*,
|
|
1545
|
+
question: str,
|
|
1546
|
+
relation_terms: tuple[str, ...],
|
|
1547
|
+
) -> bool:
|
|
1548
|
+
if not {
|
|
1549
|
+
"cancel",
|
|
1550
|
+
"deadline",
|
|
1551
|
+
"promise",
|
|
1552
|
+
"remember",
|
|
1553
|
+
"reschedule",
|
|
1554
|
+
"task",
|
|
1555
|
+
} & set(relation_terms):
|
|
1556
|
+
return False
|
|
1557
|
+
normalized_question = re.sub(r"[^0-9a-z]+", " ", question.casefold()).strip()
|
|
1558
|
+
if re.search(
|
|
1559
|
+
r"\bremember(?:ed|s|ing)?\s+(?:childhood|story|trip|vacation|birthday)\b|"
|
|
1560
|
+
r"\bpromise\s+ring\b",
|
|
1561
|
+
normalized_question,
|
|
1562
|
+
):
|
|
1563
|
+
return False
|
|
1564
|
+
return bool(
|
|
1565
|
+
re.search(
|
|
1566
|
+
r"\b(?:deadline|due\s+date|when\b.+\bdue|"
|
|
1567
|
+
r"what\b.+\b(?:task|todo|to do|to-do)|"
|
|
1568
|
+
r"what\b.+\bpromise(?:d)?|"
|
|
1569
|
+
r"(?:task|todo|to do|to-do|plan|promise|deadline)\b.+"
|
|
1570
|
+
r"\b(?:cancel(?:ed|led|s)?|reschedul(?:e|ed|es|ing)?)\b|"
|
|
1571
|
+
r"(?:cancel(?:ed|led|s)?|reschedul(?:e|ed|es|ing)?)\b.+"
|
|
1572
|
+
r"\b(?:task|todo|to do|to-do|plan|promise|deadline)\b|"
|
|
1573
|
+
r"(?:need|needs|needed)\s+to\s+remember|"
|
|
1574
|
+
r"remember\s+to)\b",
|
|
1575
|
+
normalized_question,
|
|
1576
|
+
)
|
|
1577
|
+
)
|
|
1578
|
+
|
|
1579
|
+
|
|
1580
|
+
def _has_education_profile_intent(
|
|
1581
|
+
*,
|
|
1582
|
+
question: str,
|
|
1583
|
+
relation_terms: tuple[str, ...],
|
|
1584
|
+
) -> bool:
|
|
1585
|
+
if not {"class", "education"} & set(relation_terms):
|
|
1586
|
+
return False
|
|
1587
|
+
normalized_question = re.sub(r"[^0-9a-z]+", " ", question.casefold()).strip()
|
|
1588
|
+
return bool(
|
|
1589
|
+
re.search(
|
|
1590
|
+
r"\b(?:what|which)\s+school\b|"
|
|
1591
|
+
r"\b(?:college|university)\b|"
|
|
1592
|
+
r"\b(?:study|studies|studying|majoring)\b|"
|
|
1593
|
+
r"\bwhat\s+(?:is|was)\b.+\bmajor\b(?:\s+(?:in|at)\b|$)|"
|
|
1594
|
+
r"\bwhat\s+(?:is|was)\b.+\bdegree\b(?:\s+(?:in|from)\b|$)|"
|
|
1595
|
+
r"\bwhat\s+degree\s+(?:does|did|is|was|has|have)\b|"
|
|
1596
|
+
r"\bdegree\s+(?:does|did)\b.+\bhave\b|"
|
|
1597
|
+
r"\b(?:major|degree)\s+in\b|"
|
|
1598
|
+
r"\b(?:where|when|what\s+school)\b.+\bgraduat(?:e|ed|ion)\b|"
|
|
1599
|
+
r"\bgraduat(?:e|ed|ion)\b.+\b(?:from|school|college|university)\b|"
|
|
1600
|
+
r"\bwhat\s+class\b",
|
|
1601
|
+
normalized_question,
|
|
1602
|
+
)
|
|
1603
|
+
)
|
|
1604
|
+
|
|
1605
|
+
|
|
1606
|
+
def _has_employment_profile_intent(
|
|
1607
|
+
*,
|
|
1608
|
+
question: str,
|
|
1609
|
+
relation_terms: tuple[str, ...],
|
|
1610
|
+
) -> bool:
|
|
1611
|
+
if "employment" not in set(relation_terms):
|
|
1612
|
+
return False
|
|
1613
|
+
normalized_question = re.sub(r"[^0-9a-z]+", " ", question.casefold()).strip()
|
|
1614
|
+
return bool(
|
|
1615
|
+
re.search(
|
|
1616
|
+
r"\b(?:what|which)\s+"
|
|
1617
|
+
r"(?:company|employer|job|occupation|profession|workplace)\b|"
|
|
1618
|
+
r"\bwho\s+(?:is|was)\b.+\bemployer\b|"
|
|
1619
|
+
r"\bwhat\s+(?:is|was)\b.+\b(?:salary|wage|pay\s+rate|hourly\s+rate)\b|"
|
|
1620
|
+
r"\b(?:job|occupation|profession|workplace)\b|"
|
|
1621
|
+
r"\bwhere\b.+\bwork\b|"
|
|
1622
|
+
r"\bwhat\b.+\bdo\b.+\bfor\s+work\b|"
|
|
1623
|
+
r"\bwork\b.+\b(?:company|for)\b",
|
|
1624
|
+
normalized_question,
|
|
1625
|
+
)
|
|
1626
|
+
)
|
|
1627
|
+
|
|
1628
|
+
|
|
1629
|
+
def _has_health_profile_intent(
|
|
1630
|
+
*,
|
|
1631
|
+
question: str,
|
|
1632
|
+
relation_terms: tuple[str, ...],
|
|
1633
|
+
) -> bool:
|
|
1634
|
+
if "health" not in set(relation_terms):
|
|
1635
|
+
return False
|
|
1636
|
+
normalized_question = re.sub(r"[^0-9a-z]+", " ", question.casefold()).strip()
|
|
1637
|
+
return bool(
|
|
1638
|
+
re.search(
|
|
1639
|
+
r"\b(?:doctor|physician|therapist|medication|medicine|prescription|allerg"
|
|
1640
|
+
r"(?:y|ic)|health\s+issue|condition|dentist|dental)\b"
|
|
1641
|
+
r"|\bblood\s+type\b"
|
|
1642
|
+
r"|\bprimary\s+care\s+(?:doctor|physician|provider)\b"
|
|
1643
|
+
r"|\b(?:medical|doctor(?:'s)?|dentist(?:'s)?|therapy|clinic)\s+"
|
|
1644
|
+
r"appointment\b",
|
|
1645
|
+
normalized_question,
|
|
1646
|
+
)
|
|
1647
|
+
)
|
|
1648
|
+
|
|
1649
|
+
|
|
1650
|
+
def _has_contact_profile_intent(
|
|
1651
|
+
*,
|
|
1652
|
+
question: str,
|
|
1653
|
+
relation_terms: tuple[str, ...],
|
|
1654
|
+
) -> bool:
|
|
1655
|
+
if "contact" not in set(relation_terms):
|
|
1656
|
+
return False
|
|
1657
|
+
normalized_question = re.sub(r"[^0-9a-z]+", " ", question.casefold()).strip()
|
|
1658
|
+
if re.search(
|
|
1659
|
+
r"\baddress(?:ed|es|ing)?\s+(?:a|an|the|their|his|her|my|our)?\s*"
|
|
1660
|
+
r"(?:concern|issue|problem|question|risk|topic)\b|"
|
|
1661
|
+
r"\b(?:concern|issue|problem|question|risk|topic)\b.+"
|
|
1662
|
+
r"\baddress(?:ed|es|ing)?\b|"
|
|
1663
|
+
r"\baddress(?:ed|es|ing)?\b.+\bwith\b",
|
|
1664
|
+
normalized_question,
|
|
1665
|
+
):
|
|
1666
|
+
return False
|
|
1667
|
+
return bool(
|
|
1668
|
+
re.search(
|
|
1669
|
+
r"\b(?:contact\s+(?:info|information|details)|"
|
|
1670
|
+
r"emergency\s+contact|"
|
|
1671
|
+
r"email|e mail|phone|telephone|cell|mobile|address)\b|"
|
|
1672
|
+
r"\b(?:phone|telephone|cell|mobile)\s+number\b|"
|
|
1673
|
+
r"\b(?:instagram|signal|slack|telegram|whatsapp)\s+"
|
|
1674
|
+
r"(?:handle|username|number)\b|"
|
|
1675
|
+
r"\bwhat\s+is\s+(?:[a-z0-9]+(?:\s+s)?|my|his|her|their|our|your)\s+"
|
|
1676
|
+
r"(?:handle|number|username)\b|"
|
|
1677
|
+
r"\bhow\s+(?:can|could|do|does|did)\s+(?:i|we|you)\s+"
|
|
1678
|
+
r"(?:contact|reach)\b",
|
|
1679
|
+
normalized_question,
|
|
1680
|
+
)
|
|
1681
|
+
)
|
|
1682
|
+
|
|
1683
|
+
|
|
1684
|
+
def _has_diet_profile_intent(
|
|
1685
|
+
*,
|
|
1686
|
+
question: str,
|
|
1687
|
+
relation_terms: tuple[str, ...],
|
|
1688
|
+
) -> bool:
|
|
1689
|
+
if "diet" not in set(relation_terms):
|
|
1690
|
+
return False
|
|
1691
|
+
normalized_question = re.sub(r"[^0-9a-z]+", " ", question.casefold()).strip()
|
|
1692
|
+
return bool(
|
|
1693
|
+
re.search(
|
|
1694
|
+
r"\b(?:dietary\s+(?:restriction|restrictions)|"
|
|
1695
|
+
r"vegetarian|vegan|gluten\s?free|dairy\s?free)\b|"
|
|
1696
|
+
r"\b(?:avoid|avoids|can t|cannot|can\s+not|doesn t|does\s+not|don t|do\s+not)\s+eat\b|"
|
|
1697
|
+
r"\bwhat\s+can\b.+\bnot\s+eat\b|"
|
|
1698
|
+
r"\bavoid(?:s|ed)?\s+eating\b|"
|
|
1699
|
+
r"\bwhat\s+food\b.+\b(?:avoid|eat)\b",
|
|
1700
|
+
normalized_question,
|
|
1701
|
+
)
|
|
1702
|
+
)
|
|
1703
|
+
|
|
1704
|
+
|
|
1705
|
+
def _has_pet_profile_intent(
|
|
1706
|
+
*,
|
|
1707
|
+
question: str,
|
|
1708
|
+
relation_terms: tuple[str, ...],
|
|
1709
|
+
) -> bool:
|
|
1710
|
+
if "pet" not in set(relation_terms):
|
|
1711
|
+
return False
|
|
1712
|
+
normalized_question = re.sub(r"[^0-9a-z]+", " ", question.casefold()).strip()
|
|
1713
|
+
return bool(
|
|
1714
|
+
re.search(
|
|
1715
|
+
r"\bwhat\s+pet\b|\b(?:dog|cat|pet)\b.+\bnamed?\b|"
|
|
1716
|
+
r"\bname\b.+\b(?:dog|cat|pet)\b|"
|
|
1717
|
+
r"\bbreed\b.+\b(?:dog|cat|pet)\b|\b(?:dog|cat|pet)\b.+\bbreed\b|"
|
|
1718
|
+
r"\b(?:dog|cat|pet|puppy|kitten)\b.+\bmicrochip\b|"
|
|
1719
|
+
r"\bmicrochip\b.+\b(?:dog|cat|pet|puppy|kitten)\b",
|
|
1720
|
+
normalized_question,
|
|
1721
|
+
)
|
|
1722
|
+
)
|
|
1723
|
+
|
|
1724
|
+
|
|
1725
|
+
def _has_skill_profile_intent(
|
|
1726
|
+
*,
|
|
1727
|
+
question: str,
|
|
1728
|
+
relation_terms: tuple[str, ...],
|
|
1729
|
+
) -> bool:
|
|
1730
|
+
if "skill" not in set(relation_terms):
|
|
1731
|
+
return False
|
|
1732
|
+
normalized_question = re.sub(r"[^0-9a-z]+", " ", question.casefold()).strip()
|
|
1733
|
+
return bool(
|
|
1734
|
+
re.search(
|
|
1735
|
+
r"\blanguages?\b.+\b(?:speak|know|fluent|bilingual)\b|"
|
|
1736
|
+
r"\b(?:speak|know)\b.+\blanguages?\b|"
|
|
1737
|
+
r"\b(?:fluent|bilingual)\b.+\blanguages?\b|"
|
|
1738
|
+
r"\blanguages?\b.+\blearn(?:ed|ing)?\b|"
|
|
1739
|
+
r"\blearn(?:ed|ing)?\b.+\blanguages?\b|"
|
|
1740
|
+
r"\bprogramming\s+languages?\b|\blanguages?\b.+\bprogramming\b|"
|
|
1741
|
+
r"\bskill\b.+\blearn(?:ed|ing)?\b|"
|
|
1742
|
+
r"\blearn(?:ed|ing)?\b.+\bskill\b|"
|
|
1743
|
+
r"\b(?:certification|credential)\b|"
|
|
1744
|
+
r"\bcertified\s+in\b|"
|
|
1745
|
+
r"\binstrument\b.+\bplay\b|\bplay\b.+\binstrument\b|"
|
|
1746
|
+
r"\bplay\s+(?:guitar|piano|violin|drums?)\b",
|
|
1747
|
+
normalized_question,
|
|
1748
|
+
)
|
|
1749
|
+
)
|
|
1750
|
+
|
|
1751
|
+
|
|
1752
|
+
def _has_vehicle_profile_intent(
|
|
1753
|
+
*,
|
|
1754
|
+
question: str,
|
|
1755
|
+
relation_terms: tuple[str, ...],
|
|
1756
|
+
) -> bool:
|
|
1757
|
+
if "vehicle" not in set(relation_terms):
|
|
1758
|
+
return False
|
|
1759
|
+
normalized_question = re.sub(r"[^0-9a-z]+", " ", question.casefold()).strip()
|
|
1760
|
+
return bool(
|
|
1761
|
+
re.search(
|
|
1762
|
+
r"\blicen[cs]e\s+plate\b|"
|
|
1763
|
+
r"\b(?:what|which|kind\s+of|color)\b.+"
|
|
1764
|
+
r"\b(?:car|vehicle|truck|suv|sedan|van)\b|"
|
|
1765
|
+
r"\b(?:car|vehicle|truck|suv|sedan|van)\b.+"
|
|
1766
|
+
r"\b(?:drive|have|has|own|color)\b|"
|
|
1767
|
+
r"\bdrive\s+(?:a|an|the|my|his|her|their)\s+"
|
|
1768
|
+
r"(?:car|vehicle|truck|suv|sedan|van)\b",
|
|
1769
|
+
normalized_question,
|
|
1770
|
+
)
|
|
1771
|
+
)
|
|
1772
|
+
|
|
1773
|
+
|
|
1774
|
+
def _has_date_profile_intent(
|
|
1775
|
+
*,
|
|
1776
|
+
question: str,
|
|
1777
|
+
relation_terms: tuple[str, ...],
|
|
1778
|
+
) -> bool:
|
|
1779
|
+
if not {"anniversary", "birthday"} & set(relation_terms):
|
|
1780
|
+
return False
|
|
1781
|
+
normalized_question = re.sub(r"[^0-9a-z]+", " ", question.casefold()).strip()
|
|
1782
|
+
return bool(
|
|
1783
|
+
re.search(
|
|
1784
|
+
r"\bwhen\b.+\b(?:anniversary|birthday)\b|"
|
|
1785
|
+
r"\bwhat\s+(?:is|was)\b.+\b(?:anniversary|birthday)\b|"
|
|
1786
|
+
r"\b(?:what|which)\s+(?:date|day|month)\b.+"
|
|
1787
|
+
r"\b(?:anniversary|birthday)\b|"
|
|
1788
|
+
r"\b(?:anniversary|birthday)\b.+\b(?:date|when)\b|"
|
|
1789
|
+
r"\bwedding\s+date\b|"
|
|
1790
|
+
r"\b(?:date\s+of\s+birth|birth\s+date|birthdate|dob)\b",
|
|
1791
|
+
normalized_question,
|
|
1792
|
+
)
|
|
1793
|
+
)
|
|
1794
|
+
|
|
1795
|
+
|
|
1796
|
+
def infer_risk_flags(
|
|
1797
|
+
*,
|
|
1798
|
+
entity_count: int,
|
|
1799
|
+
relation_terms: tuple[str, ...],
|
|
1800
|
+
relation_variant_terms: tuple[str, ...],
|
|
1801
|
+
time_intent: RetrievalTimeIntent,
|
|
1802
|
+
) -> tuple[str, ...]:
|
|
1803
|
+
flags: list[str] = []
|
|
1804
|
+
if entity_count == 0:
|
|
1805
|
+
flags.append("no_entity")
|
|
1806
|
+
if entity_count > 2:
|
|
1807
|
+
flags.append("ambiguous_entity_scope")
|
|
1808
|
+
if not relation_terms and not time_intent.is_temporal:
|
|
1809
|
+
flags.append("broad_query")
|
|
1810
|
+
if len(relation_variant_terms) > 18:
|
|
1811
|
+
flags.append("wide_relation_expansion")
|
|
1812
|
+
return tuple(flags)
|
|
1813
|
+
|
|
1814
|
+
|
|
1815
|
+
_TEMPORAL_SUPPORT_VARIANTS = frozenset(
|
|
1816
|
+
{
|
|
1817
|
+
"age",
|
|
1818
|
+
"ago",
|
|
1819
|
+
"anniversary",
|
|
1820
|
+
"birthday",
|
|
1821
|
+
"born",
|
|
1822
|
+
"current",
|
|
1823
|
+
"date",
|
|
1824
|
+
"duration",
|
|
1825
|
+
"event",
|
|
1826
|
+
"month",
|
|
1827
|
+
"planned",
|
|
1828
|
+
"registered",
|
|
1829
|
+
"session",
|
|
1830
|
+
"signed",
|
|
1831
|
+
"time",
|
|
1832
|
+
"week",
|
|
1833
|
+
"weekend",
|
|
1834
|
+
"year",
|
|
1835
|
+
"years",
|
|
1836
|
+
}
|
|
1837
|
+
)
|
|
1838
|
+
_RELATION_FACET_CONFIG: dict[str, dict[str, object]] = {
|
|
1839
|
+
"activity": {
|
|
1840
|
+
"terms": frozenset(
|
|
1841
|
+
{
|
|
1842
|
+
"activity",
|
|
1843
|
+
"book",
|
|
1844
|
+
"bookshelf",
|
|
1845
|
+
"camp",
|
|
1846
|
+
"destress",
|
|
1847
|
+
"hike",
|
|
1848
|
+
"music",
|
|
1849
|
+
"paint",
|
|
1850
|
+
"park",
|
|
1851
|
+
"read",
|
|
1852
|
+
"roadtrip",
|
|
1853
|
+
"run",
|
|
1854
|
+
"song",
|
|
1855
|
+
}
|
|
1856
|
+
),
|
|
1857
|
+
"variants": frozenset(
|
|
1858
|
+
{
|
|
1859
|
+
"activities",
|
|
1860
|
+
"book",
|
|
1861
|
+
"books",
|
|
1862
|
+
"camping",
|
|
1863
|
+
"class",
|
|
1864
|
+
"creative",
|
|
1865
|
+
"express",
|
|
1866
|
+
"hobby",
|
|
1867
|
+
"hiking",
|
|
1868
|
+
"music",
|
|
1869
|
+
"outdoors",
|
|
1870
|
+
"photo",
|
|
1871
|
+
"pic",
|
|
1872
|
+
"reading",
|
|
1873
|
+
"running",
|
|
1874
|
+
"spot",
|
|
1875
|
+
"stories",
|
|
1876
|
+
"summer",
|
|
1877
|
+
"trail",
|
|
1878
|
+
"trip",
|
|
1879
|
+
"violin",
|
|
1880
|
+
"waterfall",
|
|
1881
|
+
"weekend",
|
|
1882
|
+
"went",
|
|
1883
|
+
}
|
|
1884
|
+
),
|
|
1885
|
+
"markers": frozenset(),
|
|
1886
|
+
"evidence_need": "activity_support",
|
|
1887
|
+
},
|
|
1888
|
+
"action_event": {
|
|
1889
|
+
"terms": frozenset({"action"}),
|
|
1890
|
+
"variants": frozenset(
|
|
1891
|
+
{
|
|
1892
|
+
"book",
|
|
1893
|
+
"booked",
|
|
1894
|
+
"bring",
|
|
1895
|
+
"brought",
|
|
1896
|
+
"complete",
|
|
1897
|
+
"completed",
|
|
1898
|
+
"create",
|
|
1899
|
+
"created",
|
|
1900
|
+
"draw",
|
|
1901
|
+
"drew",
|
|
1902
|
+
"fix",
|
|
1903
|
+
"fixed",
|
|
1904
|
+
"made",
|
|
1905
|
+
"make",
|
|
1906
|
+
"paint",
|
|
1907
|
+
"painted",
|
|
1908
|
+
"prepare",
|
|
1909
|
+
"prepared",
|
|
1910
|
+
"repair",
|
|
1911
|
+
"repaired",
|
|
1912
|
+
"schedule",
|
|
1913
|
+
"scheduled",
|
|
1914
|
+
"send",
|
|
1915
|
+
"sent",
|
|
1916
|
+
"share",
|
|
1917
|
+
"shared",
|
|
1918
|
+
"take",
|
|
1919
|
+
"took",
|
|
1920
|
+
}
|
|
1921
|
+
),
|
|
1922
|
+
"markers": frozenset(),
|
|
1923
|
+
"evidence_need": "action_support",
|
|
1924
|
+
},
|
|
1925
|
+
"favorite_preference": {
|
|
1926
|
+
"terms": frozenset({"favorite", "favourite"}),
|
|
1927
|
+
"variants": frozenset(
|
|
1928
|
+
{
|
|
1929
|
+
"book",
|
|
1930
|
+
"choice",
|
|
1931
|
+
"color",
|
|
1932
|
+
"favorite",
|
|
1933
|
+
"favourite",
|
|
1934
|
+
"food",
|
|
1935
|
+
"go-to",
|
|
1936
|
+
"movie",
|
|
1937
|
+
"movies",
|
|
1938
|
+
"music",
|
|
1939
|
+
"prefer",
|
|
1940
|
+
"preferred",
|
|
1941
|
+
"restaurant",
|
|
1942
|
+
"song",
|
|
1943
|
+
}
|
|
1944
|
+
),
|
|
1945
|
+
"markers": frozenset(),
|
|
1946
|
+
"evidence_need": "favorite_preference",
|
|
1947
|
+
},
|
|
1948
|
+
"preference": {
|
|
1949
|
+
"terms": frozenset(
|
|
1950
|
+
{
|
|
1951
|
+
"avoid",
|
|
1952
|
+
"dislike",
|
|
1953
|
+
"enjoy",
|
|
1954
|
+
"favorite",
|
|
1955
|
+
"favourite",
|
|
1956
|
+
"hate",
|
|
1957
|
+
"interest",
|
|
1958
|
+
"like",
|
|
1959
|
+
"love",
|
|
1960
|
+
"prefer",
|
|
1961
|
+
"preference",
|
|
1962
|
+
"prioritize",
|
|
1963
|
+
"self-care",
|
|
1964
|
+
"want",
|
|
1965
|
+
}
|
|
1966
|
+
),
|
|
1967
|
+
"variants": frozenset(
|
|
1968
|
+
{
|
|
1969
|
+
"avoid",
|
|
1970
|
+
"avoided",
|
|
1971
|
+
"avoids",
|
|
1972
|
+
"balance",
|
|
1973
|
+
"dislik",
|
|
1974
|
+
"dislike",
|
|
1975
|
+
"disliked",
|
|
1976
|
+
"enjoyed",
|
|
1977
|
+
"fan",
|
|
1978
|
+
"favorite",
|
|
1979
|
+
"favourite",
|
|
1980
|
+
"hat",
|
|
1981
|
+
"hate",
|
|
1982
|
+
"hated",
|
|
1983
|
+
"hates",
|
|
1984
|
+
"interested",
|
|
1985
|
+
"like",
|
|
1986
|
+
"liked",
|
|
1987
|
+
"love",
|
|
1988
|
+
"outdoors",
|
|
1989
|
+
"prefer",
|
|
1990
|
+
"refresh",
|
|
1991
|
+
"relax",
|
|
1992
|
+
"routine",
|
|
1993
|
+
"wellness",
|
|
1994
|
+
}
|
|
1995
|
+
),
|
|
1996
|
+
"markers": frozenset(),
|
|
1997
|
+
"evidence_need": "preference",
|
|
1998
|
+
},
|
|
1999
|
+
"activity_profile": {
|
|
2000
|
+
"terms": frozenset({"activity", "exercise", "hobby", "sport"}),
|
|
2001
|
+
"variants": frozenset(
|
|
2002
|
+
{
|
|
2003
|
+
"activities",
|
|
2004
|
+
"camping",
|
|
2005
|
+
"exercise",
|
|
2006
|
+
"fun",
|
|
2007
|
+
"hike",
|
|
2008
|
+
"hobbies",
|
|
2009
|
+
"hobby",
|
|
2010
|
+
"leisure",
|
|
2011
|
+
"outdoors",
|
|
2012
|
+
"paint",
|
|
2013
|
+
"painting",
|
|
2014
|
+
"pastime",
|
|
2015
|
+
"run",
|
|
2016
|
+
"running",
|
|
2017
|
+
"sport",
|
|
2018
|
+
"tennis",
|
|
2019
|
+
"yoga",
|
|
2020
|
+
}
|
|
2021
|
+
),
|
|
2022
|
+
"markers": frozenset(),
|
|
2023
|
+
"evidence_need": "activity_profile",
|
|
2024
|
+
},
|
|
2025
|
+
"current_goal": {
|
|
2026
|
+
"terms": frozenset({"plan", "want"}),
|
|
2027
|
+
"variants": frozenset(
|
|
2028
|
+
{
|
|
2029
|
+
"future",
|
|
2030
|
+
"goal",
|
|
2031
|
+
"hop",
|
|
2032
|
+
"hope",
|
|
2033
|
+
"plan",
|
|
2034
|
+
"planned",
|
|
2035
|
+
"soon",
|
|
2036
|
+
}
|
|
2037
|
+
),
|
|
2038
|
+
"markers": frozenset(),
|
|
2039
|
+
"evidence_need": "current_goal",
|
|
2040
|
+
},
|
|
2041
|
+
"identity_profile": {
|
|
2042
|
+
"terms": frozenset(
|
|
2043
|
+
{"ally", "identity", "personality", "political", "religious"}
|
|
2044
|
+
),
|
|
2045
|
+
"variants": frozenset(
|
|
2046
|
+
{
|
|
2047
|
+
"accept",
|
|
2048
|
+
"accepted",
|
|
2049
|
+
"activism",
|
|
2050
|
+
"background",
|
|
2051
|
+
"belief",
|
|
2052
|
+
"care",
|
|
2053
|
+
"church",
|
|
2054
|
+
"community",
|
|
2055
|
+
"concern",
|
|
2056
|
+
"conservative",
|
|
2057
|
+
"courage",
|
|
2058
|
+
"faith",
|
|
2059
|
+
"gender",
|
|
2060
|
+
"journey",
|
|
2061
|
+
"lgbtq",
|
|
2062
|
+
"person",
|
|
2063
|
+
"pride",
|
|
2064
|
+
"right",
|
|
2065
|
+
"rights",
|
|
2066
|
+
"self",
|
|
2067
|
+
"story",
|
|
2068
|
+
"support",
|
|
2069
|
+
"transition",
|
|
2070
|
+
"values",
|
|
2071
|
+
}
|
|
2072
|
+
),
|
|
2073
|
+
"markers": frozenset(),
|
|
2074
|
+
"evidence_need": "identity_profile",
|
|
2075
|
+
},
|
|
2076
|
+
"community_membership": {
|
|
2077
|
+
"terms": frozenset(
|
|
2078
|
+
{
|
|
2079
|
+
"belong",
|
|
2080
|
+
"belongs",
|
|
2081
|
+
"community",
|
|
2082
|
+
"identified",
|
|
2083
|
+
"identifies",
|
|
2084
|
+
"identify",
|
|
2085
|
+
"lgbt",
|
|
2086
|
+
"lgbtq",
|
|
2087
|
+
"member",
|
|
2088
|
+
"membership",
|
|
2089
|
+
"part",
|
|
2090
|
+
"queer",
|
|
2091
|
+
"trans",
|
|
2092
|
+
"transgender",
|
|
2093
|
+
}
|
|
2094
|
+
),
|
|
2095
|
+
"variants": frozenset(
|
|
2096
|
+
{
|
|
2097
|
+
"belonged",
|
|
2098
|
+
"belonging",
|
|
2099
|
+
"came",
|
|
2100
|
+
"community",
|
|
2101
|
+
"identify",
|
|
2102
|
+
"joined",
|
|
2103
|
+
"lgbt",
|
|
2104
|
+
"lgbtq",
|
|
2105
|
+
"member",
|
|
2106
|
+
"membership",
|
|
2107
|
+
"part",
|
|
2108
|
+
"pride",
|
|
2109
|
+
"queer",
|
|
2110
|
+
"support",
|
|
2111
|
+
"trans",
|
|
2112
|
+
"transgender",
|
|
2113
|
+
}
|
|
2114
|
+
),
|
|
2115
|
+
"markers": frozenset(),
|
|
2116
|
+
"evidence_need": "community_membership",
|
|
2117
|
+
},
|
|
2118
|
+
"status_profile": {
|
|
2119
|
+
"terms": frozenset(
|
|
2120
|
+
{
|
|
2121
|
+
"child",
|
|
2122
|
+
"children",
|
|
2123
|
+
"boyfriend",
|
|
2124
|
+
"brother",
|
|
2125
|
+
"cousin",
|
|
2126
|
+
"daughter",
|
|
2127
|
+
"dating",
|
|
2128
|
+
"engag",
|
|
2129
|
+
"engaged",
|
|
2130
|
+
"family",
|
|
2131
|
+
"father",
|
|
2132
|
+
"fiance",
|
|
2133
|
+
"fiancee",
|
|
2134
|
+
"friend",
|
|
2135
|
+
"girlfriend",
|
|
2136
|
+
"grandfather",
|
|
2137
|
+
"grandmother",
|
|
2138
|
+
"husband",
|
|
2139
|
+
"boss",
|
|
2140
|
+
"colleague",
|
|
2141
|
+
"coworker",
|
|
2142
|
+
"manager",
|
|
2143
|
+
"member",
|
|
2144
|
+
"mentor",
|
|
2145
|
+
"marry",
|
|
2146
|
+
"mother",
|
|
2147
|
+
"neighbor",
|
|
2148
|
+
"parent",
|
|
2149
|
+
"partner",
|
|
2150
|
+
"relationship",
|
|
2151
|
+
"roommate",
|
|
2152
|
+
"sibling",
|
|
2153
|
+
"sister",
|
|
2154
|
+
"son",
|
|
2155
|
+
"spouse",
|
|
2156
|
+
"status",
|
|
2157
|
+
"team",
|
|
2158
|
+
"teammate",
|
|
2159
|
+
"wife",
|
|
2160
|
+
}
|
|
2161
|
+
),
|
|
2162
|
+
"variants": frozenset(
|
|
2163
|
+
{
|
|
2164
|
+
"breakup",
|
|
2165
|
+
"boyfriend",
|
|
2166
|
+
"challenge",
|
|
2167
|
+
"child",
|
|
2168
|
+
"children",
|
|
2169
|
+
"brother",
|
|
2170
|
+
"cousin",
|
|
2171
|
+
"dating",
|
|
2172
|
+
"daughter",
|
|
2173
|
+
"engaged",
|
|
2174
|
+
"family",
|
|
2175
|
+
"father",
|
|
2176
|
+
"fiance",
|
|
2177
|
+
"fiancee",
|
|
2178
|
+
"friend",
|
|
2179
|
+
"friends",
|
|
2180
|
+
"girlfriend",
|
|
2181
|
+
"grandfather",
|
|
2182
|
+
"grandmother",
|
|
2183
|
+
"grandparent",
|
|
2184
|
+
"husband",
|
|
2185
|
+
"boss",
|
|
2186
|
+
"colleague",
|
|
2187
|
+
"coworker",
|
|
2188
|
+
"manager",
|
|
2189
|
+
"member",
|
|
2190
|
+
"mentor",
|
|
2191
|
+
"marry",
|
|
2192
|
+
"kids",
|
|
2193
|
+
"marriage",
|
|
2194
|
+
"married",
|
|
2195
|
+
"mother",
|
|
2196
|
+
"neighbor",
|
|
2197
|
+
"parent",
|
|
2198
|
+
"partner",
|
|
2199
|
+
"relative",
|
|
2200
|
+
"roommate",
|
|
2201
|
+
"sibling",
|
|
2202
|
+
"sister",
|
|
2203
|
+
"son",
|
|
2204
|
+
"spouse",
|
|
2205
|
+
"support",
|
|
2206
|
+
"team",
|
|
2207
|
+
"teammate",
|
|
2208
|
+
"wife",
|
|
2209
|
+
}
|
|
2210
|
+
),
|
|
2211
|
+
"markers": frozenset(),
|
|
2212
|
+
"evidence_need": "status_profile",
|
|
2213
|
+
},
|
|
2214
|
+
"causal": {
|
|
2215
|
+
"terms": frozenset(
|
|
2216
|
+
{
|
|
2217
|
+
"because",
|
|
2218
|
+
"caus",
|
|
2219
|
+
"cause",
|
|
2220
|
+
"choose",
|
|
2221
|
+
"decide",
|
|
2222
|
+
"decision",
|
|
2223
|
+
"feel",
|
|
2224
|
+
"inspir",
|
|
2225
|
+
"motivat",
|
|
2226
|
+
"motivate",
|
|
2227
|
+
"motivation",
|
|
2228
|
+
"prompt",
|
|
2229
|
+
"prompted",
|
|
2230
|
+
"realize",
|
|
2231
|
+
"reason",
|
|
2232
|
+
"think",
|
|
2233
|
+
}
|
|
2234
|
+
),
|
|
2235
|
+
"variants": frozenset(
|
|
2236
|
+
{
|
|
2237
|
+
"because",
|
|
2238
|
+
"cause",
|
|
2239
|
+
"caus",
|
|
2240
|
+
"chose",
|
|
2241
|
+
"decision",
|
|
2242
|
+
"explain",
|
|
2243
|
+
"fit",
|
|
2244
|
+
"inspir",
|
|
2245
|
+
"motivat",
|
|
2246
|
+
"motivation",
|
|
2247
|
+
"prompt",
|
|
2248
|
+
"prompted",
|
|
2249
|
+
"reason",
|
|
2250
|
+
"reaction",
|
|
2251
|
+
"response",
|
|
2252
|
+
"spoke",
|
|
2253
|
+
"thought",
|
|
2254
|
+
"understood",
|
|
2255
|
+
"value",
|
|
2256
|
+
}
|
|
2257
|
+
),
|
|
2258
|
+
"markers": frozenset({"why", "how"}),
|
|
2259
|
+
"evidence_need": "causal_support",
|
|
2260
|
+
},
|
|
2261
|
+
"emotion_response": {
|
|
2262
|
+
"terms": frozenset({"excite", "feel"}),
|
|
2263
|
+
"variants": frozenset(
|
|
2264
|
+
{
|
|
2265
|
+
"anxious",
|
|
2266
|
+
"angry",
|
|
2267
|
+
"concern",
|
|
2268
|
+
"emotion",
|
|
2269
|
+
"enthusiastic",
|
|
2270
|
+
"excite",
|
|
2271
|
+
"excited",
|
|
2272
|
+
"feel",
|
|
2273
|
+
"feeling",
|
|
2274
|
+
"felt",
|
|
2275
|
+
"happy",
|
|
2276
|
+
"nervous",
|
|
2277
|
+
"overwhelmed",
|
|
2278
|
+
"proud",
|
|
2279
|
+
"reaction",
|
|
2280
|
+
"relieved",
|
|
2281
|
+
"response",
|
|
2282
|
+
"sad",
|
|
2283
|
+
"thrilled",
|
|
2284
|
+
"upset",
|
|
2285
|
+
"worried",
|
|
2286
|
+
}
|
|
2287
|
+
),
|
|
2288
|
+
"markers": frozenset(),
|
|
2289
|
+
"evidence_need": "emotion_response",
|
|
2290
|
+
},
|
|
2291
|
+
"support_goal": {
|
|
2292
|
+
"terms": frozenset(
|
|
2293
|
+
{
|
|
2294
|
+
"adopt",
|
|
2295
|
+
"adoption",
|
|
2296
|
+
"agency",
|
|
2297
|
+
"career",
|
|
2298
|
+
"counsel",
|
|
2299
|
+
"field",
|
|
2300
|
+
"grow",
|
|
2301
|
+
"help",
|
|
2302
|
+
"path",
|
|
2303
|
+
"pursue",
|
|
2304
|
+
"receive",
|
|
2305
|
+
"support",
|
|
2306
|
+
"work",
|
|
2307
|
+
"write",
|
|
2308
|
+
}
|
|
2309
|
+
),
|
|
2310
|
+
"variants": frozenset(
|
|
2311
|
+
{
|
|
2312
|
+
"agencies",
|
|
2313
|
+
"career",
|
|
2314
|
+
"childhood",
|
|
2315
|
+
"counseling",
|
|
2316
|
+
"education",
|
|
2317
|
+
"helped",
|
|
2318
|
+
"inclusive",
|
|
2319
|
+
"inclusivity",
|
|
2320
|
+
"job",
|
|
2321
|
+
"kids",
|
|
2322
|
+
"lgbtq",
|
|
2323
|
+
"option",
|
|
2324
|
+
"profession",
|
|
2325
|
+
"similar",
|
|
2326
|
+
"support",
|
|
2327
|
+
"working",
|
|
2328
|
+
"writing",
|
|
2329
|
+
}
|
|
2330
|
+
),
|
|
2331
|
+
"markers": frozenset(),
|
|
2332
|
+
"evidence_need": "support_goal",
|
|
2333
|
+
},
|
|
2334
|
+
"education_profile": {
|
|
2335
|
+
"terms": frozenset({"class", "education", "go"}),
|
|
2336
|
+
"variants": frozenset(
|
|
2337
|
+
{
|
|
2338
|
+
"campus",
|
|
2339
|
+
"college",
|
|
2340
|
+
"course",
|
|
2341
|
+
"degree",
|
|
2342
|
+
"major",
|
|
2343
|
+
"majoring",
|
|
2344
|
+
"school",
|
|
2345
|
+
"studies",
|
|
2346
|
+
"study",
|
|
2347
|
+
"studying",
|
|
2348
|
+
"university",
|
|
2349
|
+
"graduate",
|
|
2350
|
+
"graduated",
|
|
2351
|
+
"graduation",
|
|
2352
|
+
}
|
|
2353
|
+
),
|
|
2354
|
+
"markers": frozenset(),
|
|
2355
|
+
"evidence_need": "education_profile",
|
|
2356
|
+
},
|
|
2357
|
+
"employment_profile": {
|
|
2358
|
+
"terms": frozenset({"employment"}),
|
|
2359
|
+
"variants": frozenset(
|
|
2360
|
+
{
|
|
2361
|
+
"career",
|
|
2362
|
+
"company",
|
|
2363
|
+
"employer",
|
|
2364
|
+
"job",
|
|
2365
|
+
"occupation",
|
|
2366
|
+
"office",
|
|
2367
|
+
"pay",
|
|
2368
|
+
"rate",
|
|
2369
|
+
"profession",
|
|
2370
|
+
"role",
|
|
2371
|
+
"salary",
|
|
2372
|
+
"wage",
|
|
2373
|
+
"work",
|
|
2374
|
+
"worked",
|
|
2375
|
+
"working",
|
|
2376
|
+
"workplace",
|
|
2377
|
+
}
|
|
2378
|
+
),
|
|
2379
|
+
"markers": frozenset(),
|
|
2380
|
+
"evidence_need": "employment_profile",
|
|
2381
|
+
},
|
|
2382
|
+
"health_profile": {
|
|
2383
|
+
"terms": frozenset({"health"}),
|
|
2384
|
+
"variants": frozenset(
|
|
2385
|
+
{
|
|
2386
|
+
"allergic",
|
|
2387
|
+
"allergy",
|
|
2388
|
+
"appointment",
|
|
2389
|
+
"blood",
|
|
2390
|
+
"clinic",
|
|
2391
|
+
"condition",
|
|
2392
|
+
"dental",
|
|
2393
|
+
"dentist",
|
|
2394
|
+
"doctor",
|
|
2395
|
+
"health",
|
|
2396
|
+
"medication",
|
|
2397
|
+
"medicine",
|
|
2398
|
+
"physician",
|
|
2399
|
+
"prescription",
|
|
2400
|
+
"take",
|
|
2401
|
+
"taking",
|
|
2402
|
+
"therapist",
|
|
2403
|
+
"type",
|
|
2404
|
+
}
|
|
2405
|
+
),
|
|
2406
|
+
"markers": frozenset(),
|
|
2407
|
+
"evidence_need": "health_profile",
|
|
2408
|
+
},
|
|
2409
|
+
"contact_profile": {
|
|
2410
|
+
"terms": frozenset({"contact"}),
|
|
2411
|
+
"variants": frozenset(
|
|
2412
|
+
{
|
|
2413
|
+
"address",
|
|
2414
|
+
"cell",
|
|
2415
|
+
"contact",
|
|
2416
|
+
"e-mail",
|
|
2417
|
+
"email",
|
|
2418
|
+
"mobile",
|
|
2419
|
+
"number",
|
|
2420
|
+
"phone",
|
|
2421
|
+
"reach",
|
|
2422
|
+
"reached",
|
|
2423
|
+
"telephone",
|
|
2424
|
+
}
|
|
2425
|
+
),
|
|
2426
|
+
"markers": frozenset(),
|
|
2427
|
+
"evidence_need": "contact_profile",
|
|
2428
|
+
},
|
|
2429
|
+
"commitment_profile": {
|
|
2430
|
+
"terms": frozenset(
|
|
2431
|
+
{"cancel", "deadline", "promise", "remember", "reschedule", "task"}
|
|
2432
|
+
),
|
|
2433
|
+
"variants": frozenset(
|
|
2434
|
+
{
|
|
2435
|
+
"bring",
|
|
2436
|
+
"cancel",
|
|
2437
|
+
"canceled",
|
|
2438
|
+
"cancelled",
|
|
2439
|
+
"commit",
|
|
2440
|
+
"committed",
|
|
2441
|
+
"complete",
|
|
2442
|
+
"date",
|
|
2443
|
+
"deadline",
|
|
2444
|
+
"due",
|
|
2445
|
+
"finish",
|
|
2446
|
+
"need",
|
|
2447
|
+
"promise",
|
|
2448
|
+
"promised",
|
|
2449
|
+
"remember",
|
|
2450
|
+
"reminder",
|
|
2451
|
+
"reschedule",
|
|
2452
|
+
"rescheduled",
|
|
2453
|
+
"status",
|
|
2454
|
+
"task",
|
|
2455
|
+
"to-do",
|
|
2456
|
+
"todo",
|
|
2457
|
+
}
|
|
2458
|
+
),
|
|
2459
|
+
"markers": frozenset(),
|
|
2460
|
+
"evidence_need": "commitment_profile",
|
|
2461
|
+
},
|
|
2462
|
+
"diet_profile": {
|
|
2463
|
+
"terms": frozenset({"diet"}),
|
|
2464
|
+
"variants": frozenset(
|
|
2465
|
+
{
|
|
2466
|
+
"avoid",
|
|
2467
|
+
"dairy",
|
|
2468
|
+
"dietary",
|
|
2469
|
+
"eat",
|
|
2470
|
+
"egg",
|
|
2471
|
+
"eggs",
|
|
2472
|
+
"food",
|
|
2473
|
+
"gluten",
|
|
2474
|
+
"lactose",
|
|
2475
|
+
"meat",
|
|
2476
|
+
"pork",
|
|
2477
|
+
"restriction",
|
|
2478
|
+
"seafood",
|
|
2479
|
+
"soy",
|
|
2480
|
+
"vegan",
|
|
2481
|
+
"vegetarian",
|
|
2482
|
+
}
|
|
2483
|
+
),
|
|
2484
|
+
"markers": frozenset(),
|
|
2485
|
+
"evidence_need": "diet_profile",
|
|
2486
|
+
},
|
|
2487
|
+
"age_profile": {
|
|
2488
|
+
"terms": frozenset({"age"}),
|
|
2489
|
+
"variants": frozenset(
|
|
2490
|
+
{
|
|
2491
|
+
"age",
|
|
2492
|
+
"birthday",
|
|
2493
|
+
"born",
|
|
2494
|
+
"old",
|
|
2495
|
+
"turn",
|
|
2496
|
+
"turned",
|
|
2497
|
+
"turning",
|
|
2498
|
+
"turns",
|
|
2499
|
+
"year",
|
|
2500
|
+
"years",
|
|
2501
|
+
}
|
|
2502
|
+
),
|
|
2503
|
+
"markers": frozenset(),
|
|
2504
|
+
"evidence_need": "age_profile",
|
|
2505
|
+
},
|
|
2506
|
+
"alias_profile": {
|
|
2507
|
+
"terms": frozenset({"nickname"}),
|
|
2508
|
+
"variants": frozenset(
|
|
2509
|
+
{
|
|
2510
|
+
"alias",
|
|
2511
|
+
"call",
|
|
2512
|
+
"called",
|
|
2513
|
+
"calls",
|
|
2514
|
+
"known",
|
|
2515
|
+
"name",
|
|
2516
|
+
"named",
|
|
2517
|
+
"nickname",
|
|
2518
|
+
"nicknamed",
|
|
2519
|
+
"referred",
|
|
2520
|
+
}
|
|
2521
|
+
),
|
|
2522
|
+
"markers": frozenset(),
|
|
2523
|
+
"evidence_need": "alias_profile",
|
|
2524
|
+
},
|
|
2525
|
+
"date_profile": {
|
|
2526
|
+
"terms": frozenset({"anniversary", "birthday"}),
|
|
2527
|
+
"variants": frozenset(
|
|
2528
|
+
{
|
|
2529
|
+
"anniversary",
|
|
2530
|
+
"birthday",
|
|
2531
|
+
"born",
|
|
2532
|
+
"date",
|
|
2533
|
+
"married",
|
|
2534
|
+
"marry",
|
|
2535
|
+
"month",
|
|
2536
|
+
"wed",
|
|
2537
|
+
"wedding",
|
|
2538
|
+
"year",
|
|
2539
|
+
}
|
|
2540
|
+
),
|
|
2541
|
+
"markers": frozenset(),
|
|
2542
|
+
"evidence_need": "date_profile",
|
|
2543
|
+
},
|
|
2544
|
+
"pet_profile": {
|
|
2545
|
+
"terms": frozenset({"pet"}),
|
|
2546
|
+
"variants": frozenset(
|
|
2547
|
+
{
|
|
2548
|
+
"animal",
|
|
2549
|
+
"breed",
|
|
2550
|
+
"cat",
|
|
2551
|
+
"dog",
|
|
2552
|
+
"kitten",
|
|
2553
|
+
"labrador",
|
|
2554
|
+
"name",
|
|
2555
|
+
"named",
|
|
2556
|
+
"pet",
|
|
2557
|
+
"puppy",
|
|
2558
|
+
"retriever",
|
|
2559
|
+
}
|
|
2560
|
+
),
|
|
2561
|
+
"markers": frozenset(),
|
|
2562
|
+
"evidence_need": "pet_profile",
|
|
2563
|
+
},
|
|
2564
|
+
"skill_profile": {
|
|
2565
|
+
"terms": frozenset({"skill"}),
|
|
2566
|
+
"variants": frozenset(
|
|
2567
|
+
{
|
|
2568
|
+
"drums",
|
|
2569
|
+
"guitar",
|
|
2570
|
+
"instrument",
|
|
2571
|
+
"bilingual",
|
|
2572
|
+
"certification",
|
|
2573
|
+
"certified",
|
|
2574
|
+
"credential",
|
|
2575
|
+
"fluent",
|
|
2576
|
+
"know",
|
|
2577
|
+
"language",
|
|
2578
|
+
"piano",
|
|
2579
|
+
"play",
|
|
2580
|
+
"plays",
|
|
2581
|
+
"speak",
|
|
2582
|
+
"speaks",
|
|
2583
|
+
"spoken",
|
|
2584
|
+
"violin",
|
|
2585
|
+
}
|
|
2586
|
+
),
|
|
2587
|
+
"markers": frozenset(),
|
|
2588
|
+
"evidence_need": "skill_profile",
|
|
2589
|
+
},
|
|
2590
|
+
"vehicle_profile": {
|
|
2591
|
+
"terms": frozenset({"vehicle"}),
|
|
2592
|
+
"variants": frozenset(
|
|
2593
|
+
{
|
|
2594
|
+
"car",
|
|
2595
|
+
"color",
|
|
2596
|
+
"drive",
|
|
2597
|
+
"drives",
|
|
2598
|
+
"driving",
|
|
2599
|
+
"license",
|
|
2600
|
+
"licence",
|
|
2601
|
+
"own",
|
|
2602
|
+
"owns",
|
|
2603
|
+
"plate",
|
|
2604
|
+
"sedan",
|
|
2605
|
+
"suv",
|
|
2606
|
+
"truck",
|
|
2607
|
+
"van",
|
|
2608
|
+
"vehicle",
|
|
2609
|
+
}
|
|
2610
|
+
),
|
|
2611
|
+
"markers": frozenset(),
|
|
2612
|
+
"evidence_need": "vehicle_profile",
|
|
2613
|
+
},
|
|
2614
|
+
"exchange": {
|
|
2615
|
+
"terms": frozenset(
|
|
2616
|
+
{
|
|
2617
|
+
"bought",
|
|
2618
|
+
"bring",
|
|
2619
|
+
"brought",
|
|
2620
|
+
"give",
|
|
2621
|
+
"get",
|
|
2622
|
+
"got",
|
|
2623
|
+
"gift",
|
|
2624
|
+
"offer",
|
|
2625
|
+
"purchas",
|
|
2626
|
+
"purchase",
|
|
2627
|
+
"receive",
|
|
2628
|
+
}
|
|
2629
|
+
),
|
|
2630
|
+
"variants": frozenset(
|
|
2631
|
+
{
|
|
2632
|
+
"buy",
|
|
2633
|
+
"brought",
|
|
2634
|
+
"gave",
|
|
2635
|
+
"get",
|
|
2636
|
+
"gift",
|
|
2637
|
+
"got",
|
|
2638
|
+
"offer",
|
|
2639
|
+
"offered",
|
|
2640
|
+
"purchas",
|
|
2641
|
+
"purchased",
|
|
2642
|
+
"receiv",
|
|
2643
|
+
"receive",
|
|
2644
|
+
"received",
|
|
2645
|
+
}
|
|
2646
|
+
),
|
|
2647
|
+
"markers": frozenset(),
|
|
2648
|
+
"evidence_need": "exchange",
|
|
2649
|
+
},
|
|
2650
|
+
"symbolic_meaning": {
|
|
2651
|
+
"terms": frozenset({"necklace", "symbolize"}),
|
|
2652
|
+
"variants": frozenset(
|
|
2653
|
+
{
|
|
2654
|
+
"family",
|
|
2655
|
+
"gift",
|
|
2656
|
+
"mean",
|
|
2657
|
+
"message",
|
|
2658
|
+
"reminder",
|
|
2659
|
+
"represent",
|
|
2660
|
+
"special",
|
|
2661
|
+
"support",
|
|
2662
|
+
"symbol",
|
|
2663
|
+
"value",
|
|
2664
|
+
}
|
|
2665
|
+
),
|
|
2666
|
+
"markers": frozenset(),
|
|
2667
|
+
"evidence_need": "symbolic_meaning",
|
|
2668
|
+
},
|
|
2669
|
+
"registration_event": {
|
|
2670
|
+
"terms": frozenset({"enroll", "register", "sign"}),
|
|
2671
|
+
"variants": frozenset(
|
|
2672
|
+
{
|
|
2673
|
+
"class",
|
|
2674
|
+
"course",
|
|
2675
|
+
"enrolled",
|
|
2676
|
+
"lesson",
|
|
2677
|
+
"registration",
|
|
2678
|
+
"signed",
|
|
2679
|
+
"signup",
|
|
2680
|
+
}
|
|
2681
|
+
),
|
|
2682
|
+
"markers": frozenset(),
|
|
2683
|
+
"evidence_need": "registration_event",
|
|
2684
|
+
},
|
|
2685
|
+
"participation_event": {
|
|
2686
|
+
"terms": frozenset(
|
|
2687
|
+
{"attend", "join", "meet", "participate", "travel", "visit"}
|
|
2688
|
+
),
|
|
2689
|
+
"variants": frozenset(
|
|
2690
|
+
{
|
|
2691
|
+
"attended",
|
|
2692
|
+
"city",
|
|
2693
|
+
"class",
|
|
2694
|
+
"conference",
|
|
2695
|
+
"country",
|
|
2696
|
+
"event",
|
|
2697
|
+
"group",
|
|
2698
|
+
"joined",
|
|
2699
|
+
"meeting",
|
|
2700
|
+
"met",
|
|
2701
|
+
"participated",
|
|
2702
|
+
"place",
|
|
2703
|
+
"studio",
|
|
2704
|
+
"trip",
|
|
2705
|
+
"traveled",
|
|
2706
|
+
"travelled",
|
|
2707
|
+
"visited",
|
|
2708
|
+
"went",
|
|
2709
|
+
"workshop",
|
|
2710
|
+
}
|
|
2711
|
+
),
|
|
2712
|
+
"markers": frozenset(),
|
|
2713
|
+
"evidence_need": "participation_event",
|
|
2714
|
+
},
|
|
2715
|
+
"communication": {
|
|
2716
|
+
"terms": frozenset(
|
|
2717
|
+
{
|
|
2718
|
+
"advise",
|
|
2719
|
+
"ask",
|
|
2720
|
+
"call",
|
|
2721
|
+
"chat",
|
|
2722
|
+
"discus",
|
|
2723
|
+
"discuss",
|
|
2724
|
+
"invit",
|
|
2725
|
+
"invitation",
|
|
2726
|
+
"invite",
|
|
2727
|
+
"message",
|
|
2728
|
+
"messag",
|
|
2729
|
+
"mention",
|
|
2730
|
+
"recommend",
|
|
2731
|
+
"remind",
|
|
2732
|
+
"reminded",
|
|
2733
|
+
"request",
|
|
2734
|
+
"say",
|
|
2735
|
+
"said",
|
|
2736
|
+
"suggest",
|
|
2737
|
+
"talk",
|
|
2738
|
+
"tell",
|
|
2739
|
+
"text",
|
|
2740
|
+
"told",
|
|
2741
|
+
"warn",
|
|
2742
|
+
"warned",
|
|
2743
|
+
}
|
|
2744
|
+
),
|
|
2745
|
+
"variants": frozenset(
|
|
2746
|
+
{
|
|
2747
|
+
"advise",
|
|
2748
|
+
"advised",
|
|
2749
|
+
"called",
|
|
2750
|
+
"chatted",
|
|
2751
|
+
"conversation",
|
|
2752
|
+
"discus",
|
|
2753
|
+
"discuss",
|
|
2754
|
+
"discussed",
|
|
2755
|
+
"discussion",
|
|
2756
|
+
"invit",
|
|
2757
|
+
"invitation",
|
|
2758
|
+
"invite",
|
|
2759
|
+
"invited",
|
|
2760
|
+
"inviting",
|
|
2761
|
+
"mention",
|
|
2762
|
+
"mentioned",
|
|
2763
|
+
"messag",
|
|
2764
|
+
"messaged",
|
|
2765
|
+
"recommend",
|
|
2766
|
+
"reminded",
|
|
2767
|
+
"request",
|
|
2768
|
+
"requested",
|
|
2769
|
+
"say",
|
|
2770
|
+
"said",
|
|
2771
|
+
"send",
|
|
2772
|
+
"sent",
|
|
2773
|
+
"suggest",
|
|
2774
|
+
"suggested",
|
|
2775
|
+
"talked",
|
|
2776
|
+
"texted",
|
|
2777
|
+
"told",
|
|
2778
|
+
"warned",
|
|
2779
|
+
}
|
|
2780
|
+
),
|
|
2781
|
+
"markers": frozenset(),
|
|
2782
|
+
"evidence_need": "communication",
|
|
2783
|
+
},
|
|
2784
|
+
"location_transition": {
|
|
2785
|
+
"terms": frozenset(
|
|
2786
|
+
{
|
|
2787
|
+
"attend",
|
|
2788
|
+
"grow",
|
|
2789
|
+
"based",
|
|
2790
|
+
"camp",
|
|
2791
|
+
"employment",
|
|
2792
|
+
"live",
|
|
2793
|
+
"move",
|
|
2794
|
+
"origin",
|
|
2795
|
+
"relocate",
|
|
2796
|
+
"relocated",
|
|
2797
|
+
"roadtrip",
|
|
2798
|
+
"stay",
|
|
2799
|
+
"travel",
|
|
2800
|
+
"trip",
|
|
2801
|
+
"venue",
|
|
2802
|
+
"visit",
|
|
2803
|
+
}
|
|
2804
|
+
),
|
|
2805
|
+
"variants": frozenset(
|
|
2806
|
+
{
|
|
2807
|
+
"camped",
|
|
2808
|
+
"campground",
|
|
2809
|
+
"camping",
|
|
2810
|
+
"campsite",
|
|
2811
|
+
"childhood",
|
|
2812
|
+
"city",
|
|
2813
|
+
"country",
|
|
2814
|
+
"based",
|
|
2815
|
+
"destination",
|
|
2816
|
+
"drive",
|
|
2817
|
+
"from",
|
|
2818
|
+
"grew",
|
|
2819
|
+
"gallery",
|
|
2820
|
+
"home",
|
|
2821
|
+
"hometown",
|
|
2822
|
+
"hotel",
|
|
2823
|
+
"museum",
|
|
2824
|
+
"company",
|
|
2825
|
+
"employer",
|
|
2826
|
+
"office",
|
|
2827
|
+
"origin",
|
|
2828
|
+
"originally",
|
|
2829
|
+
"place",
|
|
2830
|
+
"raised",
|
|
2831
|
+
"relocated",
|
|
2832
|
+
"stayed",
|
|
2833
|
+
"staying",
|
|
2834
|
+
"theater",
|
|
2835
|
+
"theatre",
|
|
2836
|
+
"travel",
|
|
2837
|
+
"traveled",
|
|
2838
|
+
"traveling",
|
|
2839
|
+
"trip",
|
|
2840
|
+
"venue",
|
|
2841
|
+
"wedding",
|
|
2842
|
+
"visited",
|
|
2843
|
+
"visiting",
|
|
2844
|
+
"work",
|
|
2845
|
+
"worked",
|
|
2846
|
+
"working",
|
|
2847
|
+
"workplace",
|
|
2848
|
+
}
|
|
2849
|
+
),
|
|
2850
|
+
"markers": frozenset(),
|
|
2851
|
+
"evidence_need": "location_support",
|
|
2852
|
+
},
|
|
2853
|
+
"contrast": {
|
|
2854
|
+
"terms": frozenset(
|
|
2855
|
+
{
|
|
2856
|
+
"compare",
|
|
2857
|
+
"different",
|
|
2858
|
+
"difference",
|
|
2859
|
+
"former",
|
|
2860
|
+
"previous",
|
|
2861
|
+
}
|
|
2862
|
+
),
|
|
2863
|
+
"variants": frozenset(
|
|
2864
|
+
{
|
|
2865
|
+
"alternative",
|
|
2866
|
+
"before",
|
|
2867
|
+
"changed",
|
|
2868
|
+
"currently",
|
|
2869
|
+
"difference",
|
|
2870
|
+
"earlier",
|
|
2871
|
+
"former",
|
|
2872
|
+
"instead",
|
|
2873
|
+
"now",
|
|
2874
|
+
"ongoing",
|
|
2875
|
+
"previously",
|
|
2876
|
+
"used to",
|
|
2877
|
+
}
|
|
2878
|
+
),
|
|
2879
|
+
"markers": frozenset({"after", "before", "between", "compare"}),
|
|
2880
|
+
"evidence_need": "contrast",
|
|
2881
|
+
},
|
|
2882
|
+
}
|
|
2883
|
+
|
|
2884
|
+
|
|
2885
|
+
def _relation_facet_reason_codes(
|
|
2886
|
+
*,
|
|
2887
|
+
category: str,
|
|
2888
|
+
question: str,
|
|
2889
|
+
terms: tuple[str, ...],
|
|
2890
|
+
variants: tuple[str, ...],
|
|
2891
|
+
marker_hit: bool,
|
|
2892
|
+
) -> tuple[str, ...]:
|
|
2893
|
+
reasons: list[str] = [f"category:{category}"]
|
|
2894
|
+
if terms:
|
|
2895
|
+
reasons.append("relation_terms")
|
|
2896
|
+
if variants:
|
|
2897
|
+
reasons.append("relation_variants")
|
|
2898
|
+
if marker_hit:
|
|
2899
|
+
reasons.append("question_marker")
|
|
2900
|
+
if category == "support_goal" and _has_direct_support_role_question(
|
|
2901
|
+
" ".join(str(question or "").casefold().split())
|
|
2902
|
+
):
|
|
2903
|
+
reasons.append("direct_support_question")
|
|
2904
|
+
return tuple(reasons)
|
|
2905
|
+
|
|
2906
|
+
|
|
2907
|
+
def _dedupe_relation_intents(
|
|
2908
|
+
facets: tuple[RetrievalRelationIntent, ...] | list[RetrievalRelationIntent],
|
|
2909
|
+
) -> tuple[RetrievalRelationIntent, ...]:
|
|
2910
|
+
by_category: dict[str, RetrievalRelationIntent] = {}
|
|
2911
|
+
for facet in facets:
|
|
2912
|
+
current = by_category.get(facet.category)
|
|
2913
|
+
if current is None:
|
|
2914
|
+
by_category[facet.category] = facet
|
|
2915
|
+
continue
|
|
2916
|
+
by_category[facet.category] = RetrievalRelationIntent(
|
|
2917
|
+
category=facet.category,
|
|
2918
|
+
terms=tuple(dict.fromkeys((*current.terms, *facet.terms))),
|
|
2919
|
+
variant_terms=tuple(
|
|
2920
|
+
dict.fromkeys((*current.variant_terms, *facet.variant_terms))
|
|
2921
|
+
),
|
|
2922
|
+
evidence_need=current.evidence_need,
|
|
2923
|
+
reason_codes=tuple(dict.fromkeys((*current.reason_codes, *facet.reason_codes))),
|
|
2924
|
+
)
|
|
2925
|
+
return tuple(by_category.values())
|