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,2100 @@
|
|
|
1
|
+
"""Typed relation-category support predicates for benchmark evidence."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import re
|
|
6
|
+
from collections.abc import Callable
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def typed_relation_category_support(
|
|
10
|
+
category: str,
|
|
11
|
+
memory_terms: set[str],
|
|
12
|
+
*,
|
|
13
|
+
memory_text: str = "",
|
|
14
|
+
) -> bool | None:
|
|
15
|
+
"""Return typed support status for known categories, or None if generic."""
|
|
16
|
+
|
|
17
|
+
if category == "action_event":
|
|
18
|
+
return _has_action_event_support(memory_terms, memory_text=memory_text)
|
|
19
|
+
if category == "location_transition":
|
|
20
|
+
return _has_location_transition_support(memory_terms, memory_text=memory_text)
|
|
21
|
+
if category == "activity_profile":
|
|
22
|
+
return _has_activity_profile_support(memory_terms, memory_text=memory_text)
|
|
23
|
+
if category == "communication":
|
|
24
|
+
return _has_communication_support(memory_terms, memory_text=memory_text)
|
|
25
|
+
if category == "commitment_profile":
|
|
26
|
+
return _has_commitment_profile_support(memory_terms, memory_text=memory_text)
|
|
27
|
+
if category == "contact_profile":
|
|
28
|
+
return _has_contact_profile_support(memory_terms, memory_text=memory_text)
|
|
29
|
+
if category == "diet_profile":
|
|
30
|
+
return _has_diet_profile_support(memory_terms, memory_text=memory_text)
|
|
31
|
+
if category == "participation_event":
|
|
32
|
+
return _has_participation_event_support(memory_terms, memory_text=memory_text)
|
|
33
|
+
if category == "education_profile":
|
|
34
|
+
return _has_education_profile_support(
|
|
35
|
+
memory_terms,
|
|
36
|
+
memory_text=memory_text,
|
|
37
|
+
)
|
|
38
|
+
if category == "employment_profile":
|
|
39
|
+
return _has_employment_profile_support(
|
|
40
|
+
memory_terms,
|
|
41
|
+
memory_text=memory_text,
|
|
42
|
+
)
|
|
43
|
+
if category == "emotion_response":
|
|
44
|
+
return _has_emotion_response_support(memory_terms, memory_text=memory_text)
|
|
45
|
+
if category == "age_profile":
|
|
46
|
+
return _has_age_profile_support(memory_terms, memory_text=memory_text)
|
|
47
|
+
if category == "alias_profile":
|
|
48
|
+
return _has_alias_profile_support(memory_terms, memory_text=memory_text)
|
|
49
|
+
if category == "date_profile":
|
|
50
|
+
return _has_date_profile_support(memory_terms, memory_text=memory_text)
|
|
51
|
+
if category == "health_profile":
|
|
52
|
+
return _has_health_profile_support(memory_terms, memory_text=memory_text)
|
|
53
|
+
if category == "community_membership":
|
|
54
|
+
return _has_community_membership_support(memory_terms, memory_text=memory_text)
|
|
55
|
+
if category == "pet_profile":
|
|
56
|
+
return _has_pet_profile_support(memory_terms, memory_text=memory_text)
|
|
57
|
+
if category == "skill_profile":
|
|
58
|
+
return _has_skill_profile_support(memory_terms, memory_text=memory_text)
|
|
59
|
+
if category == "status_profile":
|
|
60
|
+
return _has_status_profile_support(memory_terms, memory_text=memory_text)
|
|
61
|
+
if category == "vehicle_profile":
|
|
62
|
+
return _has_vehicle_profile_support(
|
|
63
|
+
memory_terms,
|
|
64
|
+
memory_text=memory_text,
|
|
65
|
+
)
|
|
66
|
+
if category == "exchange":
|
|
67
|
+
return _has_exchange_support(memory_terms, memory_text=memory_text)
|
|
68
|
+
if category == "favorite_preference":
|
|
69
|
+
return _has_favorite_preference_support(
|
|
70
|
+
memory_terms,
|
|
71
|
+
memory_text=memory_text,
|
|
72
|
+
)
|
|
73
|
+
if category == "causal":
|
|
74
|
+
return _has_causal_support(memory_terms, memory_text=memory_text)
|
|
75
|
+
check = _TYPED_SUPPORT_CHECKS.get(category)
|
|
76
|
+
if check is None:
|
|
77
|
+
return None
|
|
78
|
+
return check(memory_terms)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def _has_registration_event_support(memory_terms: set[str]) -> bool:
|
|
82
|
+
registration_action = {
|
|
83
|
+
"enroll",
|
|
84
|
+
"enrolled",
|
|
85
|
+
"register",
|
|
86
|
+
"registered",
|
|
87
|
+
"registration",
|
|
88
|
+
"sign",
|
|
89
|
+
"signed",
|
|
90
|
+
"signup",
|
|
91
|
+
} & memory_terms
|
|
92
|
+
event_context = {"class", "course", "lesson", "workshop", "event"} & memory_terms
|
|
93
|
+
return bool(registration_action and event_context)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def _has_symbolic_meaning_support(memory_terms: set[str]) -> bool:
|
|
97
|
+
symbolic_surface = {
|
|
98
|
+
"mean",
|
|
99
|
+
"meaning",
|
|
100
|
+
"meant",
|
|
101
|
+
"message",
|
|
102
|
+
"reminder",
|
|
103
|
+
"represent",
|
|
104
|
+
"symbol",
|
|
105
|
+
"symbolize",
|
|
106
|
+
"value",
|
|
107
|
+
} & memory_terms
|
|
108
|
+
object_context = {
|
|
109
|
+
"family",
|
|
110
|
+
"gift",
|
|
111
|
+
"necklace",
|
|
112
|
+
"special",
|
|
113
|
+
"support",
|
|
114
|
+
} & memory_terms
|
|
115
|
+
return bool(symbolic_surface and object_context)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
_ACTION_EVENT_SURFACE_RE = re.compile(
|
|
119
|
+
r"\b(?:brought|took|sent|shared|painted|drew|made|booked|scheduled|"
|
|
120
|
+
r"prepared|completed|fixed|repaired|created)\b"
|
|
121
|
+
r"(?:\s+(?:a|an|the|their|his|her|my|our))?\s+"
|
|
122
|
+
r"[a-zA-Z][a-zA-Z0-9_-]+",
|
|
123
|
+
re.IGNORECASE,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def _has_action_event_support(
|
|
128
|
+
memory_terms: set[str],
|
|
129
|
+
*,
|
|
130
|
+
memory_text: str = "",
|
|
131
|
+
) -> bool:
|
|
132
|
+
action_surface = {
|
|
133
|
+
"booked",
|
|
134
|
+
"brought",
|
|
135
|
+
"completed",
|
|
136
|
+
"created",
|
|
137
|
+
"drew",
|
|
138
|
+
"fixed",
|
|
139
|
+
"made",
|
|
140
|
+
"painted",
|
|
141
|
+
"prepared",
|
|
142
|
+
"repaired",
|
|
143
|
+
"scheduled",
|
|
144
|
+
"sent",
|
|
145
|
+
"shared",
|
|
146
|
+
"took",
|
|
147
|
+
} & memory_terms
|
|
148
|
+
return bool(action_surface and _ACTION_EVENT_SURFACE_RE.search(memory_text))
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
_PARTICIPATION_DESTINATION_SURFACE_RE = re.compile(
|
|
152
|
+
r"\b(?:visit|visited|travel|traveled|travelled|go|went)\s+"
|
|
153
|
+
r"(?:to\s+)?(?:[A-Z][a-zA-Z0-9_-]+|"
|
|
154
|
+
r"(?:the\s+)?(?:beach|city|conference|country|gallery|museum|park|studio))\b"
|
|
155
|
+
r"|\b(?:meet|met)\s+(?:up\s+)?(?:with\s+)?"
|
|
156
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+|"
|
|
157
|
+
r"(?:friends?|family|mentors?|colleagues?|coworkers?|team|group))\b"
|
|
158
|
+
r"|\bmeeting\s+with\s+"
|
|
159
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+|"
|
|
160
|
+
r"(?:friends?|family|mentors?|colleagues?|coworkers?|team|group))\b"
|
|
161
|
+
r"|\b(?:trip|vacation)\s+(?:to|in)\s+"
|
|
162
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+|"
|
|
163
|
+
r"(?:the\s+)?(?:beach|city|country|mountains|park))\b",
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def _has_participation_event_support(
|
|
168
|
+
memory_terms: set[str],
|
|
169
|
+
*,
|
|
170
|
+
memory_text: str = "",
|
|
171
|
+
) -> bool:
|
|
172
|
+
participation_action = {
|
|
173
|
+
"attend",
|
|
174
|
+
"attended",
|
|
175
|
+
"join",
|
|
176
|
+
"joined",
|
|
177
|
+
"meet",
|
|
178
|
+
"meeting",
|
|
179
|
+
"met",
|
|
180
|
+
"participate",
|
|
181
|
+
"participated",
|
|
182
|
+
"travel",
|
|
183
|
+
"traveled",
|
|
184
|
+
"travelled",
|
|
185
|
+
"visit",
|
|
186
|
+
"visited",
|
|
187
|
+
"went",
|
|
188
|
+
} & memory_terms
|
|
189
|
+
event_context = {
|
|
190
|
+
"class",
|
|
191
|
+
"club",
|
|
192
|
+
"conference",
|
|
193
|
+
"event",
|
|
194
|
+
"group",
|
|
195
|
+
"meeting",
|
|
196
|
+
"place",
|
|
197
|
+
"studio",
|
|
198
|
+
"trip",
|
|
199
|
+
"workshop",
|
|
200
|
+
} & memory_terms
|
|
201
|
+
return bool(
|
|
202
|
+
(participation_action and event_context)
|
|
203
|
+
or _PARTICIPATION_DESTINATION_SURFACE_RE.search(memory_text)
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
_EDUCATION_PROFILE_SURFACE_RE = re.compile(
|
|
208
|
+
r"\b(?:go|goes|went)\s+to\s+"
|
|
209
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+(?:\s+[A-Z][a-zA-Z0-9_-]+){0,3}|"
|
|
210
|
+
r"(?:college|university|school))\b"
|
|
211
|
+
r"|\b(?:attend|attends|attended|study|studies|studying)\s+"
|
|
212
|
+
r"(?:at\s+)?(?:[A-Z][a-zA-Z0-9_-]+(?:\s+[A-Z][a-zA-Z0-9_-]+){0,3}|"
|
|
213
|
+
r"(?:college|university|school))\b"
|
|
214
|
+
r"|\b(?:my|his|her|their|our)\s+(?:major|degree)\s+(?:is|was|:)\s+"
|
|
215
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+|[a-zA-Z][a-zA-Z0-9_-]+)"
|
|
216
|
+
r"|\b(?:my|his|her|their|our)\s+(?:major|degree)\s+(?:is|was)\s+in\s+"
|
|
217
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+|[a-zA-Z][a-zA-Z0-9_-]+)"
|
|
218
|
+
r"|\b(?:major|degree)\s+(?:is|was|:)\s+"
|
|
219
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+|[a-zA-Z][a-zA-Z0-9_-]+)"
|
|
220
|
+
r"|\b(?:major|degree)\s+(?:is|was)\s+in\s+"
|
|
221
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+|[a-zA-Z][a-zA-Z0-9_-]+)"
|
|
222
|
+
r"|\b(?:major|majors|majored|majoring)\s+in\s+"
|
|
223
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+|[a-zA-Z][a-zA-Z0-9_-]+)"
|
|
224
|
+
r"|\b(?:have|has|had|earn|earned|got|receive|received)\s+"
|
|
225
|
+
r"(?:a\s+|an\s+|the\s+)?(?:[a-zA-Z][a-zA-Z0-9_-]+\s+){0,3}"
|
|
226
|
+
r"degree\s+in\s+"
|
|
227
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+|[a-zA-Z][a-zA-Z0-9_-]+)"
|
|
228
|
+
r"|\bgraduat(?:e|ed|ing)\s+(?:from|at)\s+"
|
|
229
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+(?:\s+[A-Z][a-zA-Z0-9_-]+){0,3}|"
|
|
230
|
+
r"(?:college|university|school))\b"
|
|
231
|
+
r"|\bgraduation\s+(?:from|at)\s+"
|
|
232
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+(?:\s+[A-Z][a-zA-Z0-9_-]+){0,3}|"
|
|
233
|
+
r"(?:college|university|school))\b",
|
|
234
|
+
re.IGNORECASE,
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
def _has_education_profile_support(
|
|
239
|
+
memory_terms: set[str],
|
|
240
|
+
*,
|
|
241
|
+
memory_text: str = "",
|
|
242
|
+
) -> bool:
|
|
243
|
+
education_surface = {
|
|
244
|
+
"campus",
|
|
245
|
+
"class",
|
|
246
|
+
"college",
|
|
247
|
+
"course",
|
|
248
|
+
"education",
|
|
249
|
+
"school",
|
|
250
|
+
"studies",
|
|
251
|
+
"study",
|
|
252
|
+
"studying",
|
|
253
|
+
"university",
|
|
254
|
+
} & memory_terms
|
|
255
|
+
education_action = {
|
|
256
|
+
"attend",
|
|
257
|
+
"attended",
|
|
258
|
+
"go",
|
|
259
|
+
"goes",
|
|
260
|
+
"study",
|
|
261
|
+
"studies",
|
|
262
|
+
"studying",
|
|
263
|
+
"take",
|
|
264
|
+
"taking",
|
|
265
|
+
} & memory_terms
|
|
266
|
+
education_context = {
|
|
267
|
+
"campus",
|
|
268
|
+
"class",
|
|
269
|
+
"college",
|
|
270
|
+
"course",
|
|
271
|
+
"education",
|
|
272
|
+
"school",
|
|
273
|
+
"university",
|
|
274
|
+
} & memory_terms
|
|
275
|
+
return bool(
|
|
276
|
+
education_surface
|
|
277
|
+
or (education_action and education_context)
|
|
278
|
+
or _EDUCATION_PROFILE_SURFACE_RE.search(memory_text)
|
|
279
|
+
)
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
_OCCUPATION_TITLE_RE = (
|
|
283
|
+
r"(?:accountant|artist|attorney|chef|counselor|designer|developer|doctor|"
|
|
284
|
+
r"engineer|lawyer|manager|nurse|photographer|professor|researcher|"
|
|
285
|
+
r"scientist|teacher|therapist|writer|software\s+engineer|social\s+worker)"
|
|
286
|
+
)
|
|
287
|
+
_EMPLOYMENT_OCCUPATION_SURFACE_RE = re.compile(
|
|
288
|
+
rf"\b(?:i\s+am|i'm|he\s+is|he's|she\s+is|she's|they\s+are|"
|
|
289
|
+
rf"they're)\s+(?:a\s+|an\s+)?{_OCCUPATION_TITLE_RE}\b",
|
|
290
|
+
re.IGNORECASE,
|
|
291
|
+
)
|
|
292
|
+
_EMPLOYMENT_PROFILE_SURFACE_RE = re.compile(
|
|
293
|
+
r"\b(?:work|works|worked|working)\s+(?:at|for|in|as)\s+"
|
|
294
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+|the\s+[a-zA-Z][a-zA-Z0-9_-]+|"
|
|
295
|
+
r"a\s+[a-zA-Z][a-zA-Z0-9_-]+)"
|
|
296
|
+
r"|\b(?:salary|wage|pay\s+rate|hourly\s+rate)\s+(?:is|was|:)\s+"
|
|
297
|
+
r"(?:\$?\d[\d,]*(?:\.\d+)?|[a-zA-Z][a-zA-Z0-9_-]+)"
|
|
298
|
+
r"|\b(?:earn|earns|earned|make|makes|made)\s+"
|
|
299
|
+
r"(?:\$?\d[\d,]*(?:\.\d+)?|[a-zA-Z][a-zA-Z0-9_-]+)"
|
|
300
|
+
r"\s+(?:per\s+(?:hour|year)|annually|a\s+year|an\s+hour)\b"
|
|
301
|
+
r"|\b(?:job|occupation|profession|role)\s+(?:is|was|as)\s+"
|
|
302
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+|a\s+[a-zA-Z][a-zA-Z0-9_-]+|"
|
|
303
|
+
r"the\s+[a-zA-Z][a-zA-Z0-9_-]+)"
|
|
304
|
+
rf"|{_EMPLOYMENT_OCCUPATION_SURFACE_RE.pattern}",
|
|
305
|
+
re.IGNORECASE,
|
|
306
|
+
)
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
def has_employment_occupation_surface(memory_text: str) -> bool:
|
|
310
|
+
return bool(_EMPLOYMENT_OCCUPATION_SURFACE_RE.search(memory_text))
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
def _has_employment_profile_support(
|
|
314
|
+
memory_terms: set[str],
|
|
315
|
+
*,
|
|
316
|
+
memory_text: str = "",
|
|
317
|
+
) -> bool:
|
|
318
|
+
employment_context = {
|
|
319
|
+
"career",
|
|
320
|
+
"company",
|
|
321
|
+
"employer",
|
|
322
|
+
"job",
|
|
323
|
+
"occupation",
|
|
324
|
+
"office",
|
|
325
|
+
"profession",
|
|
326
|
+
"role",
|
|
327
|
+
"workplace",
|
|
328
|
+
} & memory_terms
|
|
329
|
+
work_action = {"work", "worked", "working", "works"} & memory_terms
|
|
330
|
+
return bool(
|
|
331
|
+
employment_context
|
|
332
|
+
or (work_action and employment_context)
|
|
333
|
+
or _EMPLOYMENT_PROFILE_SURFACE_RE.search(memory_text)
|
|
334
|
+
)
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
_HEALTH_PROFILE_SURFACE_RE = re.compile(
|
|
338
|
+
r"\b(?:doctor|dentist|dental|therapist|clinic|prescription|medication|"
|
|
339
|
+
r"medicine|allergy|allergic|condition)\b"
|
|
340
|
+
r"|\bblood\s+type\s+(?:is|was)\s+"
|
|
341
|
+
r"(?:a|b|ab|o)\s*(?:positive|negative|\+|-)?\b"
|
|
342
|
+
r"|\b(?:my|his|her|their|our)\s+blood\s+type\s+"
|
|
343
|
+
r"(?:is|was)\s+(?:a|b|ab|o)\s*(?:positive|negative|\+|-)?\b"
|
|
344
|
+
r"|\bprimary\s+care\s+(?:doctor|physician|provider)\b"
|
|
345
|
+
r"|\b(?:medical|doctor(?:'s)?|dentist(?:'s)?|therapy|clinic)\s+"
|
|
346
|
+
r"appointment\b"
|
|
347
|
+
r"|\bappointment\s+with\s+(?:the\s+)?"
|
|
348
|
+
r"(?:doctor|physician|dentist|therapist|clinic|dr\.?\s+[A-Z][a-zA-Z0-9_-]*)\b"
|
|
349
|
+
r"|\b(?:take|takes|taking)\s+"
|
|
350
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+|"
|
|
351
|
+
r"(?:a\s+|an\s+|the\s+)?(?:pill|medication|medicine|prescription))\b"
|
|
352
|
+
r"|\b(?:have|has|had)\s+(?:asthma|diabetes|migraine|allergies|allergy)\b",
|
|
353
|
+
re.IGNORECASE,
|
|
354
|
+
)
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
_AGE_PROFILE_SURFACE_RE = re.compile(
|
|
358
|
+
r"\b(?:i\s+am|i'm|he\s+is|he's|she\s+is|she's|they\s+are|they're)\s+"
|
|
359
|
+
r"(?:\d{1,3}|[a-z]+)\s+years?\s+old\b"
|
|
360
|
+
r"|\b(?:age\s+(?:is|was)|turned|turns)\s+(?:\d{1,3}|[a-z]+)\b"
|
|
361
|
+
r"(?!\s+(?:page|pages)\b)"
|
|
362
|
+
r"|\b(?:i\s+am|i'm|he\s+is|he's|she\s+is|she's|they\s+are|they're"
|
|
363
|
+
r"|[a-z][a-zA-Z0-9_-]+\s+is)\s+turning\s+(?:\d{1,3}|[a-z]+)\b"
|
|
364
|
+
r"(?!\s+(?:page|pages)\b)",
|
|
365
|
+
re.IGNORECASE,
|
|
366
|
+
)
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
def _has_age_profile_support(
|
|
370
|
+
memory_terms: set[str],
|
|
371
|
+
*,
|
|
372
|
+
memory_text: str = "",
|
|
373
|
+
) -> bool:
|
|
374
|
+
age_surface = {"age", "old"} & memory_terms
|
|
375
|
+
year_surface = {"year", "years"} & memory_terms
|
|
376
|
+
return bool(
|
|
377
|
+
(age_surface and year_surface)
|
|
378
|
+
or _AGE_PROFILE_SURFACE_RE.search(memory_text)
|
|
379
|
+
)
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
_ALIAS_VALUE_PATTERN = r"(?:[A-Z][a-zA-Z0-9_-]+|[\"'][^\"']+[\"'])"
|
|
383
|
+
_ALIAS_GO_BY_SURFACE_PATTERN = rf"\b(?:go|goes|went)\s+by\s+{_ALIAS_VALUE_PATTERN}\b"
|
|
384
|
+
_ALIAS_GO_BY_SURFACE_RE = re.compile(_ALIAS_GO_BY_SURFACE_PATTERN)
|
|
385
|
+
|
|
386
|
+
_ALIAS_PROFILE_SURFACE_RE = re.compile(
|
|
387
|
+
r"\b(?:nickname|alias)\s+(?:is|was|for)\s+"
|
|
388
|
+
rf"{_ALIAS_VALUE_PATTERN}\b"
|
|
389
|
+
r"|\b(?:middle|legal|full)\s+name\s+(?:is|was|:)\s+"
|
|
390
|
+
rf"{_ALIAS_VALUE_PATTERN}\b"
|
|
391
|
+
r"|\b(?:my|his|her|their|our)\s+(?:middle|legal|full)\s+name\s+"
|
|
392
|
+
rf"(?:is|was|:)\s+{_ALIAS_VALUE_PATTERN}\b"
|
|
393
|
+
r"|\b(?:I|i|he|she|they|we|[A-Z][a-zA-Z0-9_-]+"
|
|
394
|
+
r"(?:\s+[A-Z][a-zA-Z0-9_-]+){0,2})\s+"
|
|
395
|
+
r"(?:am|is|are|was|were)\s+"
|
|
396
|
+
rf"(?:called|known\s+as|referred\s+to\s+as|nicknamed)\s+{_ALIAS_VALUE_PATTERN}\b"
|
|
397
|
+
r"|\b(?:refer|refers|referred)\s+to\s+"
|
|
398
|
+
r"(?:me|him|her|them|us|you|[A-Z][a-zA-Z0-9_-]+"
|
|
399
|
+
r"(?:\s+[A-Z][a-zA-Z0-9_-]+){0,2})\s+"
|
|
400
|
+
rf"as\s+{_ALIAS_VALUE_PATTERN}\b"
|
|
401
|
+
r"|\b(?:call|calls|called)\s+"
|
|
402
|
+
r"(?:me|him|her|them|us|you|[A-Z][a-zA-Z0-9_-]+)\s+"
|
|
403
|
+
rf"{_ALIAS_VALUE_PATTERN}\b"
|
|
404
|
+
rf"|{_ALIAS_GO_BY_SURFACE_PATTERN}",
|
|
405
|
+
)
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
def has_alias_go_by_surface(memory_text: str) -> bool:
|
|
409
|
+
return bool(_ALIAS_GO_BY_SURFACE_RE.search(memory_text))
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
def has_alias_profile_surface(memory_text: str) -> bool:
|
|
413
|
+
return bool(_ALIAS_PROFILE_SURFACE_RE.search(memory_text))
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
def _has_alias_profile_support(
|
|
417
|
+
memory_terms: set[str],
|
|
418
|
+
*,
|
|
419
|
+
memory_text: str = "",
|
|
420
|
+
) -> bool:
|
|
421
|
+
alias_surface = {"alias", "nickname"} & memory_terms
|
|
422
|
+
naming_surface = {"call", "called", "calls", "name", "named"} & memory_terms
|
|
423
|
+
return bool(
|
|
424
|
+
alias_surface
|
|
425
|
+
or (naming_surface and has_alias_profile_surface(memory_text))
|
|
426
|
+
or has_alias_profile_surface(memory_text)
|
|
427
|
+
)
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
_DATE_PROFILE_SURFACE_RE = re.compile(
|
|
431
|
+
r"\b(?:anniversary|birthday)\s+(?:is|was|falls|fell)\s+"
|
|
432
|
+
r"(?:on\s+|in\s+)?(?:\d{1,2}(?:st|nd|rd|th)?|"
|
|
433
|
+
r"january|february|march|april|may|june|july|august|"
|
|
434
|
+
r"september|october|november|december)\b"
|
|
435
|
+
r"|\b(?:got\s+married|were\s+married|was\s+married|married)\s+"
|
|
436
|
+
r"(?:on|in)\s+(?:\d{1,2}(?:st|nd|rd|th)?|"
|
|
437
|
+
r"january|february|march|april|may|june|july|august|"
|
|
438
|
+
r"september|october|november|december)\b"
|
|
439
|
+
r"|\bwedding\s+(?:date\s+)?(?:is|was)\s+"
|
|
440
|
+
r"(?:on\s+|in\s+)?(?:\d{1,2}(?:st|nd|rd|th)?|"
|
|
441
|
+
r"january|february|march|april|may|june|july|august|"
|
|
442
|
+
r"september|october|november|december)\b"
|
|
443
|
+
r"|\bborn\s+(?:(?:on|in)\s+)?"
|
|
444
|
+
r"(?:\d{1,2}(?:st|nd|rd|th)?|"
|
|
445
|
+
r"january|february|march|april|may|june|july|august|"
|
|
446
|
+
r"september|october|november|december)\b"
|
|
447
|
+
r"|\bdate\s+of\s+birth\s+(?:is|was)\s+"
|
|
448
|
+
r"(?:\d{1,2}(?:st|nd|rd|th)?|"
|
|
449
|
+
r"january|february|march|april|may|june|july|august|"
|
|
450
|
+
r"september|october|november|december)\b"
|
|
451
|
+
r"|\bbirth\s*date\s+(?:is|was)\s+"
|
|
452
|
+
r"(?:\d{1,2}(?:st|nd|rd|th)?|"
|
|
453
|
+
r"january|february|march|april|may|june|july|august|"
|
|
454
|
+
r"september|october|november|december)\b"
|
|
455
|
+
r"|\bdob\s+(?:is|was)\s+"
|
|
456
|
+
r"(?:\d{1,2}(?:st|nd|rd|th)?|"
|
|
457
|
+
r"january|february|march|april|may|june|july|august|"
|
|
458
|
+
r"september|october|november|december)\b",
|
|
459
|
+
re.IGNORECASE,
|
|
460
|
+
)
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
def has_date_profile_surface(memory_text: str) -> bool:
|
|
464
|
+
return bool(_DATE_PROFILE_SURFACE_RE.search(memory_text))
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
def _has_date_profile_support(
|
|
468
|
+
memory_terms: set[str],
|
|
469
|
+
*,
|
|
470
|
+
memory_text: str = "",
|
|
471
|
+
) -> bool:
|
|
472
|
+
date_subject = {"anniversary", "birthday"} & memory_terms
|
|
473
|
+
date_surface = {
|
|
474
|
+
"april",
|
|
475
|
+
"august",
|
|
476
|
+
"december",
|
|
477
|
+
"february",
|
|
478
|
+
"january",
|
|
479
|
+
"july",
|
|
480
|
+
"june",
|
|
481
|
+
"march",
|
|
482
|
+
"may",
|
|
483
|
+
"month",
|
|
484
|
+
"november",
|
|
485
|
+
"october",
|
|
486
|
+
"september",
|
|
487
|
+
} & memory_terms
|
|
488
|
+
return bool(
|
|
489
|
+
(date_subject and date_surface)
|
|
490
|
+
or has_date_profile_surface(memory_text)
|
|
491
|
+
)
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
_ACTIVITY_PROFILE_SURFACE_RE = re.compile(
|
|
495
|
+
r"\b(?:hobby|pastime)\s+(?:is|was|became)\b"
|
|
496
|
+
r"|\b(?:for\s+fun|in\s+(?:my|his|her|their|our)\s+free\s+time)\b"
|
|
497
|
+
r"|\b(?:enjoy|enjoys|like|likes|love|loves)\s+"
|
|
498
|
+
r"(?:to\s+)?(?:hike|hiking|paint|painting|read|reading|run|running|"
|
|
499
|
+
r"cook|cooking|dance|dancing|swim|swimming|yoga|tennis|gardening)\b"
|
|
500
|
+
r"|\b(?:do|does|did|started|took\s+up|takes\s+up)\s+"
|
|
501
|
+
r"(?:yoga|tennis|gardening|painting|running|hiking|cooking|dancing)\b"
|
|
502
|
+
r"|\b(?:go|goes|went)\s+"
|
|
503
|
+
r"(?:hiking|running|swimming|camping)\b",
|
|
504
|
+
re.IGNORECASE,
|
|
505
|
+
)
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
def _has_activity_profile_support(
|
|
509
|
+
memory_terms: set[str],
|
|
510
|
+
*,
|
|
511
|
+
memory_text: str = "",
|
|
512
|
+
) -> bool:
|
|
513
|
+
activity_context = {
|
|
514
|
+
"activity",
|
|
515
|
+
"camping",
|
|
516
|
+
"cooking",
|
|
517
|
+
"dancing",
|
|
518
|
+
"exercise",
|
|
519
|
+
"fun",
|
|
520
|
+
"gardening",
|
|
521
|
+
"hiking",
|
|
522
|
+
"hobbies",
|
|
523
|
+
"hobby",
|
|
524
|
+
"leisure",
|
|
525
|
+
"paint",
|
|
526
|
+
"painting",
|
|
527
|
+
"pastime",
|
|
528
|
+
"run",
|
|
529
|
+
"running",
|
|
530
|
+
"sport",
|
|
531
|
+
"tennis",
|
|
532
|
+
"yoga",
|
|
533
|
+
} & memory_terms
|
|
534
|
+
activity_action = {
|
|
535
|
+
"do",
|
|
536
|
+
"does",
|
|
537
|
+
"enjoy",
|
|
538
|
+
"enjoys",
|
|
539
|
+
"go",
|
|
540
|
+
"goes",
|
|
541
|
+
"like",
|
|
542
|
+
"likes",
|
|
543
|
+
"love",
|
|
544
|
+
"loves",
|
|
545
|
+
"play",
|
|
546
|
+
"plays",
|
|
547
|
+
"run",
|
|
548
|
+
"runs",
|
|
549
|
+
"started",
|
|
550
|
+
} & memory_terms
|
|
551
|
+
return bool(
|
|
552
|
+
(activity_context and activity_action)
|
|
553
|
+
or _ACTIVITY_PROFILE_SURFACE_RE.search(memory_text)
|
|
554
|
+
)
|
|
555
|
+
|
|
556
|
+
|
|
557
|
+
def _has_health_profile_support(
|
|
558
|
+
memory_terms: set[str],
|
|
559
|
+
*,
|
|
560
|
+
memory_text: str = "",
|
|
561
|
+
) -> bool:
|
|
562
|
+
health_surface = {
|
|
563
|
+
"allergic",
|
|
564
|
+
"allergy",
|
|
565
|
+
"clinic",
|
|
566
|
+
"condition",
|
|
567
|
+
"dental",
|
|
568
|
+
"dentist",
|
|
569
|
+
"doctor",
|
|
570
|
+
"health",
|
|
571
|
+
"medication",
|
|
572
|
+
"medicine",
|
|
573
|
+
"prescription",
|
|
574
|
+
"therapist",
|
|
575
|
+
} & memory_terms
|
|
576
|
+
medical_appointment = "appointment" in memory_terms and bool(
|
|
577
|
+
{
|
|
578
|
+
"clinic",
|
|
579
|
+
"dental",
|
|
580
|
+
"dentist",
|
|
581
|
+
"doctor",
|
|
582
|
+
"medical",
|
|
583
|
+
"physician",
|
|
584
|
+
"therapy",
|
|
585
|
+
"therapist",
|
|
586
|
+
}
|
|
587
|
+
& memory_terms
|
|
588
|
+
)
|
|
589
|
+
medication_action = {"take", "takes", "taking"} & memory_terms
|
|
590
|
+
medication_context = {
|
|
591
|
+
"dose",
|
|
592
|
+
"medication",
|
|
593
|
+
"medicine",
|
|
594
|
+
"pill",
|
|
595
|
+
"prescription",
|
|
596
|
+
} & memory_terms
|
|
597
|
+
return bool(
|
|
598
|
+
health_surface
|
|
599
|
+
or medical_appointment
|
|
600
|
+
or (medication_action and medication_context)
|
|
601
|
+
or _HEALTH_PROFILE_SURFACE_RE.search(memory_text)
|
|
602
|
+
)
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
_CONTACT_PROFILE_SURFACE_RE = re.compile(
|
|
606
|
+
r"\b[\w.+-]+@[\w.-]+\.[a-zA-Z]{2,}\b"
|
|
607
|
+
r"|\b(?:email|e-mail)(?:\s+address)?\s+(?:is|was)\s+\S+"
|
|
608
|
+
r"|\b(?:phone|telephone|cell|mobile)(?:\s+number)?\s+"
|
|
609
|
+
r"(?:is|was)\s+(?:\+?\d[\d()\-\s.]{5,}\d)\b"
|
|
610
|
+
r"|\b(?:(?:my|his|her|their|our|your)\s+)?(?:phone\s+)?number\s+"
|
|
611
|
+
r"(?:is|was)\s+(?:\+?\d[\d()\-\s.]{5,}\d)\b"
|
|
612
|
+
r"|\b(?:reach|contact)\s+"
|
|
613
|
+
r"(?:me|him|her|them|us|you|[A-Z][a-zA-Z0-9_-]+)\s+"
|
|
614
|
+
r"(?:at|on)\s+"
|
|
615
|
+
r"(?:[\w.+-]+@[\w.-]+\.[a-zA-Z]{2,}|\+?\d[\d()\-\s.]{5,}\d|"
|
|
616
|
+
r"(?:instagram|signal|slack|telegram|whatsapp)\s+(?:at\s+)?@?[\w.-]+)\b"
|
|
617
|
+
r"|\b(?:instagram|signal|slack|telegram|whatsapp)\s+"
|
|
618
|
+
r"(?:handle|username|number)\s+(?:is|was)\s+@?[\w.+()-][\w.+()\-\s]{1,}"
|
|
619
|
+
r"|\b(?:handle|username)\s+(?:is|was)\s+@[\w.-]+\b"
|
|
620
|
+
r"|\bemergency\s+contact\s+(?:is|was)\s+"
|
|
621
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+(?:\s+[A-Z][a-zA-Z0-9_-]+){0,2}|"
|
|
622
|
+
r"my|him|her|them)\b"
|
|
623
|
+
r"|\b(?:contact\s+(?:info|information|details)|"
|
|
624
|
+
r"(?:mailing\s+)?address)\s+(?:is|was)\s+"
|
|
625
|
+
r"(?:\d{1,6}\s+)?[A-Za-z0-9][A-Za-z0-9 .'-]{2,}",
|
|
626
|
+
re.IGNORECASE,
|
|
627
|
+
)
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
def _has_contact_profile_support(
|
|
631
|
+
memory_terms: set[str],
|
|
632
|
+
*,
|
|
633
|
+
memory_text: str = "",
|
|
634
|
+
) -> bool:
|
|
635
|
+
phone_surface = {"cell", "mobile", "phone", "telephone"} & memory_terms
|
|
636
|
+
contact_surface = {"contact", "reach"} & memory_terms
|
|
637
|
+
address_surface = {"address"} & memory_terms
|
|
638
|
+
number_surface = {"number"} & memory_terms
|
|
639
|
+
social_platform_surface = {
|
|
640
|
+
"instagram",
|
|
641
|
+
"signal",
|
|
642
|
+
"slack",
|
|
643
|
+
"telegram",
|
|
644
|
+
"whatsapp",
|
|
645
|
+
} & memory_terms
|
|
646
|
+
return bool(
|
|
647
|
+
(phone_surface and number_surface)
|
|
648
|
+
or (contact_surface and {"detail", "details", "info", "information"} & memory_terms)
|
|
649
|
+
or (
|
|
650
|
+
social_platform_surface
|
|
651
|
+
and {"handle", "number", "username"} & memory_terms
|
|
652
|
+
)
|
|
653
|
+
or (
|
|
654
|
+
address_surface
|
|
655
|
+
and {"avenue", "home", "mailing", "road", "street"} & memory_terms
|
|
656
|
+
and not {"concern", "issue", "problem", "topic"} & memory_terms
|
|
657
|
+
)
|
|
658
|
+
or _CONTACT_PROFILE_SURFACE_RE.search(memory_text)
|
|
659
|
+
)
|
|
660
|
+
|
|
661
|
+
|
|
662
|
+
_COMMITMENT_PROFILE_SURFACE_RE = re.compile(
|
|
663
|
+
r"\b(?:deadline|due\s+date)\s+(?:is|was)\s+"
|
|
664
|
+
r"(?:\d{1,2}(?::\d{2})?|"
|
|
665
|
+
r"monday|tuesday|wednesday|thursday|friday|saturday|sunday|"
|
|
666
|
+
r"today|tomorrow|next\s+week)\b"
|
|
667
|
+
r"|\b(?:due|finish|complete)\s+(?:by|before)\s+"
|
|
668
|
+
r"(?:\d{1,2}(?::\d{2})?|"
|
|
669
|
+
r"monday|tuesday|wednesday|thursday|friday|saturday|sunday|"
|
|
670
|
+
r"today|tomorrow|next\s+week)\b"
|
|
671
|
+
r"|\b(?:need|needs|needed)\s+to\s+remember\s+to\b"
|
|
672
|
+
r"|\b(?:need|needs|needed)\s+to\s+remember\s+"
|
|
673
|
+
r"(?:my|our|his|her|their|the|a|an)?\s*"
|
|
674
|
+
r"[a-zA-Z][a-zA-Z0-9_-]+\b"
|
|
675
|
+
r"|\bremember\s+to\s+(?:bring|send|call|finish|complete|take)\b"
|
|
676
|
+
r"|\b(?:promise|promised)\s+to\s+"
|
|
677
|
+
r"(?:bring|send|call|finish|complete|take|help)\b"
|
|
678
|
+
r"|\b(?:task|todo|to-do|plan|promise|deadline)\b.{0,80}\b"
|
|
679
|
+
r"(?:cancel(?:ed|led)?|reschedul(?:e|ed|ing)?|postponed|delayed)\b"
|
|
680
|
+
r"|\b(?:cancel(?:ed|led)?|reschedul(?:e|ed|ing)?|postponed|delayed)\b"
|
|
681
|
+
r".{0,80}\b(?:task|todo|to-do|plan|promise|deadline)\b",
|
|
682
|
+
re.IGNORECASE,
|
|
683
|
+
)
|
|
684
|
+
|
|
685
|
+
|
|
686
|
+
def _has_commitment_profile_support(
|
|
687
|
+
memory_terms: set[str],
|
|
688
|
+
*,
|
|
689
|
+
memory_text: str = "",
|
|
690
|
+
) -> bool:
|
|
691
|
+
deadline_surface = {"due"} & memory_terms or (
|
|
692
|
+
"deadline" in memory_terms
|
|
693
|
+
and {
|
|
694
|
+
"friday",
|
|
695
|
+
"monday",
|
|
696
|
+
"saturday",
|
|
697
|
+
"sunday",
|
|
698
|
+
"thursday",
|
|
699
|
+
"today",
|
|
700
|
+
"tomorrow",
|
|
701
|
+
"tuesday",
|
|
702
|
+
"wednesday",
|
|
703
|
+
}
|
|
704
|
+
& memory_terms
|
|
705
|
+
)
|
|
706
|
+
task_action = {"complete", "finish", "send", "bring", "call", "take"} & memory_terms
|
|
707
|
+
task_surface = {"task", "todo", "to-do"} & memory_terms
|
|
708
|
+
promise_surface = {"promise", "promised"} & memory_terms
|
|
709
|
+
reminder_surface = {"remember", "reminder"} & memory_terms
|
|
710
|
+
status_transition_surface = {
|
|
711
|
+
"cancel",
|
|
712
|
+
"canceled",
|
|
713
|
+
"cancelled",
|
|
714
|
+
"cancell",
|
|
715
|
+
"delay",
|
|
716
|
+
"delayed",
|
|
717
|
+
"postpon",
|
|
718
|
+
"postpone",
|
|
719
|
+
"postponed",
|
|
720
|
+
"reschedul",
|
|
721
|
+
"reschedule",
|
|
722
|
+
"rescheduled",
|
|
723
|
+
} & memory_terms
|
|
724
|
+
commitment_object_surface = {
|
|
725
|
+
"deadline",
|
|
726
|
+
"plan",
|
|
727
|
+
"promise",
|
|
728
|
+
"promised",
|
|
729
|
+
"task",
|
|
730
|
+
"to-do",
|
|
731
|
+
"todo",
|
|
732
|
+
} & memory_terms
|
|
733
|
+
return bool(
|
|
734
|
+
deadline_surface
|
|
735
|
+
or (task_surface and task_action)
|
|
736
|
+
or (promise_surface and task_action)
|
|
737
|
+
or (reminder_surface and task_action)
|
|
738
|
+
or (status_transition_surface and commitment_object_surface)
|
|
739
|
+
or _COMMITMENT_PROFILE_SURFACE_RE.search(memory_text)
|
|
740
|
+
)
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
_DIET_PROFILE_SURFACE_RE = re.compile(
|
|
744
|
+
r"\b(?:i\s+am|i'm|he\s+is|he's|she\s+is|she's|they\s+are|they're)\s+"
|
|
745
|
+
r"(?:a\s+)?(?:vegetarian|vegan)\b"
|
|
746
|
+
r"|\b(?:vegetarian|vegan)\s+(?:diet|now|since|because)\b"
|
|
747
|
+
r"|\b(?:gluten|dairy)[-\s]?free\b"
|
|
748
|
+
r"|\b(?:avoid|avoids|avoided)\s+(?:eating\s+)?"
|
|
749
|
+
r"(?:gluten|dairy|meat|pork|seafood|shellfish|eggs?|soy|lactose|"
|
|
750
|
+
r"peanuts?|tree\s+nuts?)\b"
|
|
751
|
+
r"|\b(?:can't|cannot|can\s+not|doesn't|don't|do\s+not|does\s+not)\s+eat\s+"
|
|
752
|
+
r"(?:gluten|dairy|meat|pork|seafood|shellfish|eggs?|soy|lactose|"
|
|
753
|
+
r"peanuts?|tree\s+nuts?)\b"
|
|
754
|
+
r"|\b(?:dietary\s+)?restriction\s+(?:is|was)\s+"
|
|
755
|
+
r"(?:vegetarian|vegan|gluten|dairy|pork|shellfish|peanuts?)\b",
|
|
756
|
+
re.IGNORECASE,
|
|
757
|
+
)
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
def _has_diet_profile_support(
|
|
761
|
+
memory_terms: set[str],
|
|
762
|
+
*,
|
|
763
|
+
memory_text: str = "",
|
|
764
|
+
) -> bool:
|
|
765
|
+
diet_identity = {"vegetarian", "vegan"} & memory_terms
|
|
766
|
+
restriction_context = {
|
|
767
|
+
"dairy",
|
|
768
|
+
"egg",
|
|
769
|
+
"eggs",
|
|
770
|
+
"gluten",
|
|
771
|
+
"lactose",
|
|
772
|
+
"meat",
|
|
773
|
+
"peanut",
|
|
774
|
+
"peanuts",
|
|
775
|
+
"pork",
|
|
776
|
+
"seafood",
|
|
777
|
+
"shellfish",
|
|
778
|
+
"soy",
|
|
779
|
+
} & memory_terms
|
|
780
|
+
restriction_action = {
|
|
781
|
+
"avoid",
|
|
782
|
+
"avoids",
|
|
783
|
+
"eat",
|
|
784
|
+
"restriction",
|
|
785
|
+
} & memory_terms
|
|
786
|
+
return bool(
|
|
787
|
+
(diet_identity and {"am", "diet", "is"} & memory_terms)
|
|
788
|
+
or (restriction_context and restriction_action)
|
|
789
|
+
or _DIET_PROFILE_SURFACE_RE.search(memory_text)
|
|
790
|
+
)
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+
_PET_PROFILE_SURFACE_RE = re.compile(
|
|
794
|
+
r"\b(?:my|our|his|her|their)\s+(?:pet|dog|cat|puppy|kitten)\b"
|
|
795
|
+
r"|\b(?:my|our|his|her|their)\s+"
|
|
796
|
+
r"(?:golden\s+retriever|labrador|poodle|beagle|bulldog|terrier|"
|
|
797
|
+
r"siamese|tabby|persian)\b"
|
|
798
|
+
r"|\b(?:pet|dog|cat|puppy|kitten)\s+(?:is|was|named|called)\b"
|
|
799
|
+
r"|\b(?:golden\s+retriever|labrador|poodle|beagle|bulldog|terrier|"
|
|
800
|
+
r"siamese|tabby|persian)\s+(?:is|was|named|called)\b"
|
|
801
|
+
r"|\b(?:my|our|his|her|their)\s+(?:pet|dog|cat|puppy|kitten)\b"
|
|
802
|
+
r".{0,60}\bmicrochip(?:\s+number)?\s+(?:is|was)\s+[A-Z0-9-]{3,}\b"
|
|
803
|
+
r"|\b(?:pet|dog|cat|puppy|kitten)\b.{0,60}"
|
|
804
|
+
r"\bmicrochip(?:\s+number)?\s+(?:is|was)\s+[A-Z0-9-]{3,}\b"
|
|
805
|
+
r"|\b(?:have|has|had)\s+(?:a\s+|an\s+|the\s+)?"
|
|
806
|
+
r"(?:pet|dog|cat|puppy|kitten|golden\s+retriever|labrador|poodle|"
|
|
807
|
+
r"beagle|bulldog|terrier|siamese|tabby|persian)\b",
|
|
808
|
+
re.IGNORECASE,
|
|
809
|
+
)
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
def _has_pet_profile_support(
|
|
813
|
+
memory_terms: set[str],
|
|
814
|
+
*,
|
|
815
|
+
memory_text: str = "",
|
|
816
|
+
) -> bool:
|
|
817
|
+
pet_surface = {
|
|
818
|
+
"beagle",
|
|
819
|
+
"bulldog",
|
|
820
|
+
"cat",
|
|
821
|
+
"dog",
|
|
822
|
+
"kitten",
|
|
823
|
+
"labrador",
|
|
824
|
+
"persian",
|
|
825
|
+
"pet",
|
|
826
|
+
"poodle",
|
|
827
|
+
"puppy",
|
|
828
|
+
"retriever",
|
|
829
|
+
"siamese",
|
|
830
|
+
"tabby",
|
|
831
|
+
"terrier",
|
|
832
|
+
} & memory_terms
|
|
833
|
+
name_surface = {"call", "called", "name", "named"} & memory_terms
|
|
834
|
+
ownership_surface = {"have", "has", "had", "my", "our"} & memory_terms
|
|
835
|
+
return bool(
|
|
836
|
+
(pet_surface and (name_surface or ownership_surface))
|
|
837
|
+
or _PET_PROFILE_SURFACE_RE.search(memory_text)
|
|
838
|
+
)
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
_SKILL_PROFILE_SURFACE_RE = re.compile(
|
|
842
|
+
r"\b(?:certification|credential)\s+(?:is|was)\s+"
|
|
843
|
+
r"[A-Z][a-zA-Z0-9_+-]+(?:\s+[A-Z][a-zA-Z0-9_+-]+){0,3}\b"
|
|
844
|
+
r"|\b(?:certified|credentialed)\s+in\s+"
|
|
845
|
+
r"[A-Z][a-zA-Z0-9_+-]+(?:\s+[A-Z][a-zA-Z0-9_+-]+){0,3}\b"
|
|
846
|
+
r"|\b(?:have|has|had|earned|got)\s+(?:a\s+|an\s+|the\s+)?"
|
|
847
|
+
r"[A-Z][a-zA-Z0-9_+-]+(?:\s+[A-Z][a-zA-Z0-9_+-]+){0,3}\s+"
|
|
848
|
+
r"(?:certification|credential)\b"
|
|
849
|
+
r"|"
|
|
850
|
+
r"\b(?:speak|speaks|speaking|spoken)\s+"
|
|
851
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+|"
|
|
852
|
+
r"(?:english|spanish|french|german|mandarin|japanese|arabic|hindi))\b"
|
|
853
|
+
r"|\b(?:know|knows|knew|known)\s+"
|
|
854
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+|"
|
|
855
|
+
r"(?:english|spanish|french|german|mandarin|japanese|arabic|hindi))\b"
|
|
856
|
+
r"|\bfluent\s+(?:in\s+)?"
|
|
857
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+|"
|
|
858
|
+
r"(?:english|spanish|french|german|mandarin|japanese|arabic|hindi))\b"
|
|
859
|
+
r"|\bbilingual\s+(?:in\s+)?"
|
|
860
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+|"
|
|
861
|
+
r"(?:english|spanish|french|german|mandarin|japanese|arabic|hindi))\b"
|
|
862
|
+
r"|\b(?:play|plays|playing)\s+"
|
|
863
|
+
r"(?:guitar|piano|violin|drums?|cello|flute|saxophone)\b",
|
|
864
|
+
)
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
def _has_skill_profile_support(
|
|
868
|
+
memory_terms: set[str],
|
|
869
|
+
*,
|
|
870
|
+
memory_text: str = "",
|
|
871
|
+
) -> bool:
|
|
872
|
+
language_action = {"speak", "speaks", "spoken", "speaking"} & memory_terms
|
|
873
|
+
certification_surface = {
|
|
874
|
+
"certification",
|
|
875
|
+
"certified",
|
|
876
|
+
"credential",
|
|
877
|
+
"credentialed",
|
|
878
|
+
} & memory_terms
|
|
879
|
+
language_ability = {"bilingual", "fluent", "know", "known"} & memory_terms
|
|
880
|
+
language_context = {
|
|
881
|
+
"arabic",
|
|
882
|
+
"english",
|
|
883
|
+
"french",
|
|
884
|
+
"german",
|
|
885
|
+
"hindi",
|
|
886
|
+
"japanese",
|
|
887
|
+
"language",
|
|
888
|
+
"mandarin",
|
|
889
|
+
"spanish",
|
|
890
|
+
} & memory_terms
|
|
891
|
+
play_action = {"play", "plays", "playing"} & memory_terms
|
|
892
|
+
instrument_context = {
|
|
893
|
+
"drums",
|
|
894
|
+
"guitar",
|
|
895
|
+
"instrument",
|
|
896
|
+
"piano",
|
|
897
|
+
"violin",
|
|
898
|
+
} & memory_terms
|
|
899
|
+
return bool(
|
|
900
|
+
certification_surface
|
|
901
|
+
or
|
|
902
|
+
(language_action and language_context)
|
|
903
|
+
or (language_ability and language_context)
|
|
904
|
+
or (play_action and instrument_context)
|
|
905
|
+
or _SKILL_PROFILE_SURFACE_RE.search(memory_text)
|
|
906
|
+
)
|
|
907
|
+
|
|
908
|
+
|
|
909
|
+
_VEHICLE_MODEL_NAME_PATTERN = (
|
|
910
|
+
r"(?:accord|audi|bmw|camry|civic|corolla|ford|honda|jeep|mazda|"
|
|
911
|
+
r"nissan|prius|rav4|subaru|tesla|toyota|volvo)"
|
|
912
|
+
)
|
|
913
|
+
_VEHICLE_MODEL_OWNER_PATTERN = (
|
|
914
|
+
r"(?:(?i:my|our|his|her|their)|[A-Z][a-zA-Z0-9_-]{1,40}'s)"
|
|
915
|
+
)
|
|
916
|
+
_VEHICLE_MODEL_SURFACE_RE = re.compile(
|
|
917
|
+
rf"\b{_VEHICLE_MODEL_OWNER_PATTERN}\s+"
|
|
918
|
+
rf"(?i:{_VEHICLE_MODEL_NAME_PATTERN})\b",
|
|
919
|
+
)
|
|
920
|
+
_VEHICLE_PROFILE_SURFACE_RE = re.compile(
|
|
921
|
+
r"\b(?:my|our|his|her|their)\s+(?:car|vehicle|truck|suv|sedan|van)\b"
|
|
922
|
+
rf"|\b{_VEHICLE_MODEL_OWNER_PATTERN}\s+"
|
|
923
|
+
rf"(?i:{_VEHICLE_MODEL_NAME_PATTERN})\b"
|
|
924
|
+
r"|\b(?:my|our|his|her|their)\s+(?:license|licence)\s+plate\s+"
|
|
925
|
+
r"(?:is|was)\s+[A-Z0-9][A-Z0-9 -]{1,10}\b"
|
|
926
|
+
r"|\b(?:license|licence)\s+plate\s+(?:is|was)\s+"
|
|
927
|
+
r"[A-Z0-9][A-Z0-9 -]{1,10}\b"
|
|
928
|
+
r"|\b(?:drive|drives|driving)\s+"
|
|
929
|
+
r"(?:a|an|the|my|his|her|their)\s+"
|
|
930
|
+
r"(?:(?:black|blue|green|red|silver|white)\s+)?"
|
|
931
|
+
r"(?:car|vehicle|truck|suv|sedan|van|[A-Z][a-zA-Z0-9_-]+)\b"
|
|
932
|
+
r"|\b(?:own|owns|owned|have|has|had)\s+"
|
|
933
|
+
r"(?:a|an|the|my|his|her|their)\s+"
|
|
934
|
+
r"(?:(?:black|blue|green|red|silver|white)\s+)?"
|
|
935
|
+
r"(?:car|vehicle|truck|suv|sedan|van|[A-Z][a-zA-Z0-9_-]+)\b"
|
|
936
|
+
r"|\b(?:car|vehicle|truck|suv|sedan|van)\s+(?:is|was)\s+"
|
|
937
|
+
r"(?:black|blue|green|red|silver|white|[A-Z][a-zA-Z0-9_-]+)\b",
|
|
938
|
+
)
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+
def has_vehicle_model_surface(memory_text: str) -> bool:
|
|
942
|
+
return bool(_VEHICLE_MODEL_SURFACE_RE.search(memory_text))
|
|
943
|
+
|
|
944
|
+
|
|
945
|
+
def _has_vehicle_profile_support(
|
|
946
|
+
memory_terms: set[str],
|
|
947
|
+
*,
|
|
948
|
+
memory_text: str = "",
|
|
949
|
+
) -> bool:
|
|
950
|
+
vehicle_surface = {"car", "sedan", "suv", "truck", "van", "vehicle"} & memory_terms
|
|
951
|
+
ownership_surface = {
|
|
952
|
+
"drive",
|
|
953
|
+
"drives",
|
|
954
|
+
"driving",
|
|
955
|
+
"had",
|
|
956
|
+
"has",
|
|
957
|
+
"have",
|
|
958
|
+
"my",
|
|
959
|
+
"our",
|
|
960
|
+
"own",
|
|
961
|
+
"owned",
|
|
962
|
+
"owns",
|
|
963
|
+
} & memory_terms
|
|
964
|
+
color_surface = {
|
|
965
|
+
"black",
|
|
966
|
+
"blue",
|
|
967
|
+
"color",
|
|
968
|
+
"green",
|
|
969
|
+
"red",
|
|
970
|
+
"silver",
|
|
971
|
+
"white",
|
|
972
|
+
} & memory_terms
|
|
973
|
+
return bool(
|
|
974
|
+
(vehicle_surface and ownership_surface)
|
|
975
|
+
or (vehicle_surface and color_surface)
|
|
976
|
+
or _VEHICLE_PROFILE_SURFACE_RE.search(memory_text)
|
|
977
|
+
)
|
|
978
|
+
|
|
979
|
+
|
|
980
|
+
_EMOTION_RESPONSE_SURFACE_RE = re.compile(
|
|
981
|
+
r"\b(?:feel|feels|feeling|felt)\s+"
|
|
982
|
+
r"(?:anxious|concerned|excited|happy|hopeful|nervous|overwhelmed|"
|
|
983
|
+
r"proud|relieved|sad|thrilled|upset|worried)\b"
|
|
984
|
+
r"|\b(?:reaction|response)\s+(?:to|about)\s+[^.?!]{0,80}\b"
|
|
985
|
+
r"(?:was|is|felt)\s+"
|
|
986
|
+
r"(?:anxious|concerned|excited|happy|hopeful|nervous|overwhelmed|"
|
|
987
|
+
r"proud|relieved|sad|thrilled|upset|worried)\b"
|
|
988
|
+
r"|\b(?:i|he|she|they|we)\s+(?:am|are|was|were)\s+"
|
|
989
|
+
r"(?:anxious|concerned|excited|happy|hopeful|nervous|overwhelmed|"
|
|
990
|
+
r"proud|relieved|sad|thrilled|upset|worried)\b",
|
|
991
|
+
re.IGNORECASE,
|
|
992
|
+
)
|
|
993
|
+
|
|
994
|
+
|
|
995
|
+
def _has_emotion_response_support(
|
|
996
|
+
memory_terms: set[str],
|
|
997
|
+
*,
|
|
998
|
+
memory_text: str = "",
|
|
999
|
+
) -> bool:
|
|
1000
|
+
emotion_surface = {
|
|
1001
|
+
"anxious",
|
|
1002
|
+
"concern",
|
|
1003
|
+
"excite",
|
|
1004
|
+
"excited",
|
|
1005
|
+
"feel",
|
|
1006
|
+
"felt",
|
|
1007
|
+
"happy",
|
|
1008
|
+
"nervous",
|
|
1009
|
+
"overwhelm",
|
|
1010
|
+
"overwhelmed",
|
|
1011
|
+
"proud",
|
|
1012
|
+
"relieved",
|
|
1013
|
+
"reliev",
|
|
1014
|
+
"thrill",
|
|
1015
|
+
"thrilled",
|
|
1016
|
+
"upset",
|
|
1017
|
+
"worried",
|
|
1018
|
+
"worri",
|
|
1019
|
+
} & memory_terms
|
|
1020
|
+
response_context = {
|
|
1021
|
+
"about",
|
|
1022
|
+
"because",
|
|
1023
|
+
"news",
|
|
1024
|
+
"family",
|
|
1025
|
+
"kid",
|
|
1026
|
+
"kids",
|
|
1027
|
+
"make",
|
|
1028
|
+
"process",
|
|
1029
|
+
"reaction",
|
|
1030
|
+
"response",
|
|
1031
|
+
"said",
|
|
1032
|
+
"thought",
|
|
1033
|
+
"think",
|
|
1034
|
+
"when",
|
|
1035
|
+
} & memory_terms
|
|
1036
|
+
return bool(
|
|
1037
|
+
(emotion_surface and response_context)
|
|
1038
|
+
or _EMOTION_RESPONSE_SURFACE_RE.search(memory_text)
|
|
1039
|
+
)
|
|
1040
|
+
|
|
1041
|
+
|
|
1042
|
+
_COMMUNICATION_RECIPIENT_RE = (
|
|
1043
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+|"
|
|
1044
|
+
r"(?:my|his|her|their|our)\s+"
|
|
1045
|
+
r"(?:brother|child|client|daughter|doctor|father|friend|manager|mother|"
|
|
1046
|
+
r"parent|partner|sibling|sister|son|spouse|teacher|team|wife|husband)|"
|
|
1047
|
+
r"the\s+(?:client|doctor|group|manager|teacher|team)|"
|
|
1048
|
+
r"(?:her|him|me|them|us|you)"
|
|
1049
|
+
r"(?=\s+(?:about|after|before|during|later|that|then|today|tomorrow|"
|
|
1050
|
+
r"yesterday)|[.?!,;:]|$))"
|
|
1051
|
+
)
|
|
1052
|
+
_DIRECTED_COMMUNICATION_SURFACE_RE = re.compile(
|
|
1053
|
+
rf"\b(?:advised|asked|invited|recommended|reminded|requested|suggested|"
|
|
1054
|
+
rf"told|warned)\s+"
|
|
1055
|
+
rf"(?:that\s+)?{_COMMUNICATION_RECIPIENT_RE}",
|
|
1056
|
+
)
|
|
1057
|
+
_CONVERSATION_COMMUNICATION_SURFACE_RE = re.compile(
|
|
1058
|
+
rf"\b(?:chat(?:ted)?|discuss(?:ed)?|talk(?:ed)?)\b"
|
|
1059
|
+
rf".{{0,80}}\b(?:about|to|with)\s+"
|
|
1060
|
+
rf"(?:{_COMMUNICATION_RECIPIENT_RE}|[A-Z][a-zA-Z0-9_-]+|"
|
|
1061
|
+
rf"[a-zA-Z][a-zA-Z0-9_-]+)",
|
|
1062
|
+
)
|
|
1063
|
+
_CHANNEL_COMMUNICATION_SURFACE_RE = re.compile(
|
|
1064
|
+
rf"\b(?:called|messaged|texted)\s+{_COMMUNICATION_RECIPIENT_RE}"
|
|
1065
|
+
rf"|\bsent\s+(?:{_COMMUNICATION_RECIPIENT_RE}\s+)?"
|
|
1066
|
+
rf"(?:a\s+|an\s+|the\s+)?message\b"
|
|
1067
|
+
rf"|\bsent\s+(?:a\s+|an\s+|the\s+)?message\s+to\s+"
|
|
1068
|
+
rf"{_COMMUNICATION_RECIPIENT_RE}",
|
|
1069
|
+
)
|
|
1070
|
+
_INDIRECT_COMMUNICATION_RECIPIENT_RE = re.compile(
|
|
1071
|
+
rf"\b(?:advised|mentioned|recommended|said|suggested)\b"
|
|
1072
|
+
rf".{{0,80}}\b(?:to|with)\s+{_COMMUNICATION_RECIPIENT_RE}",
|
|
1073
|
+
)
|
|
1074
|
+
|
|
1075
|
+
|
|
1076
|
+
def _has_communication_support(
|
|
1077
|
+
memory_terms: set[str],
|
|
1078
|
+
*,
|
|
1079
|
+
memory_text: str = "",
|
|
1080
|
+
) -> bool:
|
|
1081
|
+
communication_action = {
|
|
1082
|
+
"advis",
|
|
1083
|
+
"advise",
|
|
1084
|
+
"advised",
|
|
1085
|
+
"ask",
|
|
1086
|
+
"asked",
|
|
1087
|
+
"call",
|
|
1088
|
+
"called",
|
|
1089
|
+
"chat",
|
|
1090
|
+
"chatt",
|
|
1091
|
+
"chatted",
|
|
1092
|
+
"conversation",
|
|
1093
|
+
"discus",
|
|
1094
|
+
"discuss",
|
|
1095
|
+
"discussed",
|
|
1096
|
+
"discussion",
|
|
1097
|
+
"message",
|
|
1098
|
+
"messag",
|
|
1099
|
+
"messaged",
|
|
1100
|
+
"mention",
|
|
1101
|
+
"mentioned",
|
|
1102
|
+
"recommend",
|
|
1103
|
+
"recommended",
|
|
1104
|
+
"remind",
|
|
1105
|
+
"reminded",
|
|
1106
|
+
"request",
|
|
1107
|
+
"requested",
|
|
1108
|
+
"say",
|
|
1109
|
+
"said",
|
|
1110
|
+
"send",
|
|
1111
|
+
"sent",
|
|
1112
|
+
"suggest",
|
|
1113
|
+
"suggested",
|
|
1114
|
+
"talk",
|
|
1115
|
+
"talked",
|
|
1116
|
+
"tell",
|
|
1117
|
+
"text",
|
|
1118
|
+
"texted",
|
|
1119
|
+
"told",
|
|
1120
|
+
"warn",
|
|
1121
|
+
"warned",
|
|
1122
|
+
} & memory_terms
|
|
1123
|
+
communication_context = {
|
|
1124
|
+
"about",
|
|
1125
|
+
"advice",
|
|
1126
|
+
"book",
|
|
1127
|
+
"call",
|
|
1128
|
+
"conversation",
|
|
1129
|
+
"delay",
|
|
1130
|
+
"invoice",
|
|
1131
|
+
"message",
|
|
1132
|
+
"project",
|
|
1133
|
+
"read",
|
|
1134
|
+
"request",
|
|
1135
|
+
"requested",
|
|
1136
|
+
"recommendation",
|
|
1137
|
+
"response",
|
|
1138
|
+
} & memory_terms
|
|
1139
|
+
return bool(
|
|
1140
|
+
(communication_action and communication_context)
|
|
1141
|
+
or (
|
|
1142
|
+
communication_action
|
|
1143
|
+
and (
|
|
1144
|
+
_DIRECTED_COMMUNICATION_SURFACE_RE.search(memory_text)
|
|
1145
|
+
or _CHANNEL_COMMUNICATION_SURFACE_RE.search(memory_text)
|
|
1146
|
+
or _CONVERSATION_COMMUNICATION_SURFACE_RE.search(memory_text)
|
|
1147
|
+
or _INDIRECT_COMMUNICATION_RECIPIENT_RE.search(memory_text)
|
|
1148
|
+
)
|
|
1149
|
+
)
|
|
1150
|
+
)
|
|
1151
|
+
|
|
1152
|
+
|
|
1153
|
+
_EXCHANGE_RECIPIENT_RE = (
|
|
1154
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+|her|him|me|them|us|you|"
|
|
1155
|
+
r"(?:my|his|her|their|our)\s+"
|
|
1156
|
+
r"(?:brother|child|client|daughter|father|friend|manager|mother|parent|"
|
|
1157
|
+
r"partner|sibling|sister|son|spouse|team|wife|husband)|"
|
|
1158
|
+
r"the\s+(?:client|group|team))"
|
|
1159
|
+
)
|
|
1160
|
+
_EXCHANGE_OBJECT_RE = (
|
|
1161
|
+
r"(?!(?:advice|help|message|news|request|response|support)\b)"
|
|
1162
|
+
r"[a-zA-Z][a-zA-Z0-9_-]+"
|
|
1163
|
+
)
|
|
1164
|
+
_DIRECT_EXCHANGE_SURFACE_RE = re.compile(
|
|
1165
|
+
rf"\b(?:bought|get|got|purchased|received)\s+"
|
|
1166
|
+
rf"(?:a|an|the|my|his|her|their|our|some)?\s*{_EXCHANGE_OBJECT_RE}"
|
|
1167
|
+
rf"(?:\s+from\s+{_EXCHANGE_RECIPIENT_RE})?"
|
|
1168
|
+
rf"|\b(?:bring|brought|gave|give|offered|offer)\s+"
|
|
1169
|
+
rf"{_EXCHANGE_RECIPIENT_RE}\s+"
|
|
1170
|
+
rf"(?:a|an|the|my|his|her|their|our|some)?\s*{_EXCHANGE_OBJECT_RE}",
|
|
1171
|
+
)
|
|
1172
|
+
|
|
1173
|
+
|
|
1174
|
+
def _has_exchange_support(
|
|
1175
|
+
memory_terms: set[str],
|
|
1176
|
+
*,
|
|
1177
|
+
memory_text: str = "",
|
|
1178
|
+
) -> bool:
|
|
1179
|
+
exchange_actions = {
|
|
1180
|
+
"bought",
|
|
1181
|
+
"bring",
|
|
1182
|
+
"brought",
|
|
1183
|
+
"buy",
|
|
1184
|
+
"gave",
|
|
1185
|
+
"get",
|
|
1186
|
+
"give",
|
|
1187
|
+
"gift",
|
|
1188
|
+
"got",
|
|
1189
|
+
"offer",
|
|
1190
|
+
"offered",
|
|
1191
|
+
"purchas",
|
|
1192
|
+
"purchase",
|
|
1193
|
+
"purchased",
|
|
1194
|
+
"receiv",
|
|
1195
|
+
"receive",
|
|
1196
|
+
"received",
|
|
1197
|
+
} & memory_terms
|
|
1198
|
+
object_context = {
|
|
1199
|
+
"book",
|
|
1200
|
+
"card",
|
|
1201
|
+
"gift",
|
|
1202
|
+
"item",
|
|
1203
|
+
"items",
|
|
1204
|
+
"necklace",
|
|
1205
|
+
"object",
|
|
1206
|
+
"photo",
|
|
1207
|
+
"picture",
|
|
1208
|
+
"ticket",
|
|
1209
|
+
"tickets",
|
|
1210
|
+
} & memory_terms
|
|
1211
|
+
exchange_action_family_count = len(
|
|
1212
|
+
{
|
|
1213
|
+
_exchange_action_family(action)
|
|
1214
|
+
for action in exchange_actions
|
|
1215
|
+
if _exchange_action_family(action)
|
|
1216
|
+
}
|
|
1217
|
+
)
|
|
1218
|
+
return bool(
|
|
1219
|
+
exchange_action_family_count >= 2
|
|
1220
|
+
or (exchange_actions and object_context)
|
|
1221
|
+
or (exchange_actions and _DIRECT_EXCHANGE_SURFACE_RE.search(memory_text))
|
|
1222
|
+
)
|
|
1223
|
+
|
|
1224
|
+
|
|
1225
|
+
def _exchange_action_family(action: str) -> str:
|
|
1226
|
+
if action in {"bought", "buy", "get", "got", "purchas", "purchase", "purchased"}:
|
|
1227
|
+
return "acquire"
|
|
1228
|
+
if action in {"bring", "brought"}:
|
|
1229
|
+
return "bring"
|
|
1230
|
+
if action in {"gave", "gift", "give"}:
|
|
1231
|
+
return "give"
|
|
1232
|
+
if action in {"offer", "offered"}:
|
|
1233
|
+
return "offer"
|
|
1234
|
+
if action in {"receiv", "receive", "received"}:
|
|
1235
|
+
return "receive"
|
|
1236
|
+
return ""
|
|
1237
|
+
|
|
1238
|
+
|
|
1239
|
+
_CAUSAL_EXPLANATION_SURFACE_RE = re.compile(
|
|
1240
|
+
r"\b(?:due\s+to|thanks\s+to|as\s+a\s+result\s+of|because\s+of)\b|"
|
|
1241
|
+
r"\b(?:made|make|makes)\s+"
|
|
1242
|
+
r"(?:me|him|her|them|us|you)\s+"
|
|
1243
|
+
r"(?:care|caring|decide|feel|realize|start|think|want)\b|"
|
|
1244
|
+
r"\bled\s+(?:me|him|her|them|us|you)\s+to\b|"
|
|
1245
|
+
r"\bso\s+(?:i|he|she|they|we|it|[A-Z][a-zA-Z0-9_-]{1,40})\s+"
|
|
1246
|
+
r"(?:began|became|care|cared|chose|could|decided|felt|joined|"
|
|
1247
|
+
r"left|looked|moved|started|wanted)\b",
|
|
1248
|
+
re.IGNORECASE,
|
|
1249
|
+
)
|
|
1250
|
+
_CAUSAL_PURPOSE_SURFACE_RE = re.compile(
|
|
1251
|
+
r"\b(?:began|changed|created|joined|launched|opened|ran|started|"
|
|
1252
|
+
r"volunteered)\b"
|
|
1253
|
+
r"(?=.{0,120}\b(?:in\s+order\s+to|so\s+(?:i|he|she|they|we)\s+could|to)\b)"
|
|
1254
|
+
r"(?=.{0,180}\b(?:blend\s+dance\s+and\s+fashion|clear\s+"
|
|
1255
|
+
r"(?:my|her|his|their|our)?\s*head|feel\s+safe|give\s+back|"
|
|
1256
|
+
r"help\s+(?:kids|others|people)|improve\s+"
|
|
1257
|
+
r"(?:my|her|his|their|our)?\s*health|make\s+a\s+difference|"
|
|
1258
|
+
r"pursue\s+(?:my|her|his|their|our)?\s*passion|relax|"
|
|
1259
|
+
r"stress\s+relief)\b)",
|
|
1260
|
+
re.IGNORECASE | re.DOTALL,
|
|
1261
|
+
)
|
|
1262
|
+
|
|
1263
|
+
|
|
1264
|
+
def _has_causal_support(
|
|
1265
|
+
memory_terms: set[str],
|
|
1266
|
+
*,
|
|
1267
|
+
memory_text: str = "",
|
|
1268
|
+
) -> bool:
|
|
1269
|
+
direct_cause = {
|
|
1270
|
+
"because",
|
|
1271
|
+
"caus",
|
|
1272
|
+
"cause",
|
|
1273
|
+
"caused",
|
|
1274
|
+
} & memory_terms
|
|
1275
|
+
decision_surface = {"choose", "chose", "decide", "decision"} & memory_terms
|
|
1276
|
+
reason_surface = {"reason", "fit", "value"} & memory_terms
|
|
1277
|
+
contextual_cause_surface = {
|
|
1278
|
+
"inspir",
|
|
1279
|
+
"motivat",
|
|
1280
|
+
"motivate",
|
|
1281
|
+
"motivation",
|
|
1282
|
+
"prompt",
|
|
1283
|
+
"prompted",
|
|
1284
|
+
} & memory_terms
|
|
1285
|
+
realization_surface = {"realize", "realized", "understood"} & memory_terms
|
|
1286
|
+
help_surface = {"help", "helped", "helps"} & memory_terms
|
|
1287
|
+
response_surface = {
|
|
1288
|
+
"amaz",
|
|
1289
|
+
"amazing",
|
|
1290
|
+
"awesome",
|
|
1291
|
+
"angry",
|
|
1292
|
+
"feel",
|
|
1293
|
+
"felt",
|
|
1294
|
+
"frustrat",
|
|
1295
|
+
"frustration",
|
|
1296
|
+
"happy",
|
|
1297
|
+
"lovely",
|
|
1298
|
+
"nervous",
|
|
1299
|
+
"proud",
|
|
1300
|
+
"reaction",
|
|
1301
|
+
"relieved",
|
|
1302
|
+
"response",
|
|
1303
|
+
"sad",
|
|
1304
|
+
"think",
|
|
1305
|
+
"thought",
|
|
1306
|
+
"upset",
|
|
1307
|
+
"worried",
|
|
1308
|
+
} & memory_terms
|
|
1309
|
+
causal_context = {
|
|
1310
|
+
"accept",
|
|
1311
|
+
"adopt",
|
|
1312
|
+
"adoption",
|
|
1313
|
+
"agency",
|
|
1314
|
+
"auto",
|
|
1315
|
+
"balance",
|
|
1316
|
+
"because",
|
|
1317
|
+
"book",
|
|
1318
|
+
"break",
|
|
1319
|
+
"broke",
|
|
1320
|
+
"broken",
|
|
1321
|
+
"car",
|
|
1322
|
+
"cook",
|
|
1323
|
+
"cooking",
|
|
1324
|
+
"create",
|
|
1325
|
+
"creating",
|
|
1326
|
+
"design",
|
|
1327
|
+
"designed",
|
|
1328
|
+
"easy",
|
|
1329
|
+
"engine",
|
|
1330
|
+
"engineer",
|
|
1331
|
+
"engineering",
|
|
1332
|
+
"engines",
|
|
1333
|
+
"family",
|
|
1334
|
+
"fit",
|
|
1335
|
+
"gam",
|
|
1336
|
+
"game",
|
|
1337
|
+
"gaming",
|
|
1338
|
+
"group",
|
|
1339
|
+
"health",
|
|
1340
|
+
"help",
|
|
1341
|
+
"important",
|
|
1342
|
+
"inclusivity",
|
|
1343
|
+
"issue",
|
|
1344
|
+
"join",
|
|
1345
|
+
"kid",
|
|
1346
|
+
"kids",
|
|
1347
|
+
"leav",
|
|
1348
|
+
"leave",
|
|
1349
|
+
"lifestyle",
|
|
1350
|
+
"lgbtq",
|
|
1351
|
+
"march",
|
|
1352
|
+
"military",
|
|
1353
|
+
"music",
|
|
1354
|
+
"mom",
|
|
1355
|
+
"move",
|
|
1356
|
+
"movie",
|
|
1357
|
+
"paint",
|
|
1358
|
+
"painting",
|
|
1359
|
+
"passion",
|
|
1360
|
+
"present",
|
|
1361
|
+
"progres",
|
|
1362
|
+
"progress",
|
|
1363
|
+
"priu",
|
|
1364
|
+
"prius",
|
|
1365
|
+
"pursue",
|
|
1366
|
+
"refresh",
|
|
1367
|
+
"refreshes",
|
|
1368
|
+
"reflect",
|
|
1369
|
+
"run",
|
|
1370
|
+
"running",
|
|
1371
|
+
"routine",
|
|
1372
|
+
"screenplay",
|
|
1373
|
+
"script",
|
|
1374
|
+
"sculpt",
|
|
1375
|
+
"sculpting",
|
|
1376
|
+
"song",
|
|
1377
|
+
"space",
|
|
1378
|
+
"start",
|
|
1379
|
+
"stolen",
|
|
1380
|
+
"support",
|
|
1381
|
+
"vehicle",
|
|
1382
|
+
"veteran",
|
|
1383
|
+
"veterans",
|
|
1384
|
+
"volunteer",
|
|
1385
|
+
"volunteering",
|
|
1386
|
+
"video",
|
|
1387
|
+
"watch",
|
|
1388
|
+
"writer",
|
|
1389
|
+
} & memory_terms
|
|
1390
|
+
return bool(
|
|
1391
|
+
direct_cause
|
|
1392
|
+
or _CAUSAL_EXPLANATION_SURFACE_RE.search(memory_text)
|
|
1393
|
+
or _CAUSAL_PURPOSE_SURFACE_RE.search(memory_text)
|
|
1394
|
+
or (decision_surface and causal_context)
|
|
1395
|
+
or (reason_surface and causal_context)
|
|
1396
|
+
or (contextual_cause_surface and causal_context)
|
|
1397
|
+
or (realization_surface and causal_context)
|
|
1398
|
+
or (help_surface and causal_context)
|
|
1399
|
+
or (response_surface and causal_context)
|
|
1400
|
+
)
|
|
1401
|
+
|
|
1402
|
+
|
|
1403
|
+
_STATUS_PROFILE_RELATION_RE = re.compile(
|
|
1404
|
+
r"\b(?:my|his|her|their|our|your)\s+"
|
|
1405
|
+
r"(?:boyfriend|boss|brother|child|children|colleague|cousin|coworker|daughter|"
|
|
1406
|
+
r"father|fiancee?|friend|girlfriend|grandfather|grandmother|husband|kid|kids|manager|mentor|"
|
|
1407
|
+
r"mother|neighbor|parent|parents|partner|roommate|sibling|sister|son|spouse|"
|
|
1408
|
+
r"team\s+member|teammate|wife)\b"
|
|
1409
|
+
r"|\b[A-Z][a-zA-Z0-9_-]+\s+(?:is|was|are|were)\s+"
|
|
1410
|
+
r"[A-Z][a-zA-Z0-9_-]+(?:'s|’s)\s+"
|
|
1411
|
+
r"(?:boyfriend|boss|brother|child|children|colleague|cousin|coworker|daughter|"
|
|
1412
|
+
r"father|fiancee?|friend|girlfriend|grandfather|grandmother|husband|kid|kids|manager|mentor|"
|
|
1413
|
+
r"mother|neighbor|parent|parents|partner|roommate|sibling|sister|son|spouse|"
|
|
1414
|
+
r"team\s+member|teammate|wife)\b"
|
|
1415
|
+
r"|\b[A-Z][a-zA-Z0-9_-]+(?:'s|’s)\s+"
|
|
1416
|
+
r"(?:boyfriend|boss|brother|child|children|colleague|cousin|coworker|daughter|"
|
|
1417
|
+
r"father|fiancee?|friend|girlfriend|grandfather|grandmother|husband|kid|kids|manager|mentor|"
|
|
1418
|
+
r"mother|neighbor|parent|parents|partner|roommate|sibling|sister|son|spouse|"
|
|
1419
|
+
r"team\s+member|teammate|wife)\s+(?:is|was|are|were)\s+"
|
|
1420
|
+
r"[A-Z][a-zA-Z0-9_-]+\b"
|
|
1421
|
+
r"|\b[A-Z][a-zA-Z0-9_-]+(?:'s|’s)\s+"
|
|
1422
|
+
r"(?:boyfriend|boss|brother|child|children|colleague|cousin|coworker|daughter|"
|
|
1423
|
+
r"father|fiancee?|friend|girlfriend|grandfather|grandmother|husband|kid|kids|manager|mentor|"
|
|
1424
|
+
r"mother|neighbor|parent|parents|partner|roommate|sibling|sister|son|spouse|"
|
|
1425
|
+
r"team\s+member|teammate|wife)[,;:]\s+[A-Z][a-zA-Z0-9_-]+\b"
|
|
1426
|
+
r"|\b(?:is|was|are|were)\s+"
|
|
1427
|
+
r"(?:my|his|her|their|our|your)\s+"
|
|
1428
|
+
r"(?:boyfriend|boss|brother|child|colleague|cousin|coworker|daughter|father|"
|
|
1429
|
+
r"fiancee?|friend|girlfriend|grandfather|grandmother|husband|manager|mentor|mother|neighbor|"
|
|
1430
|
+
r"parent|parents|partner|roommate|sibling|sister|son|spouse|"
|
|
1431
|
+
r"team\s+member|teammate|wife)\b"
|
|
1432
|
+
r"|\b[A-Z][a-zA-Z0-9_-]+\s+(?:is|was|are|were)\s+on\s+"
|
|
1433
|
+
r"[A-Z][a-zA-Z0-9_-]+(?:'s|’s)\s+team\b"
|
|
1434
|
+
r"|\b[A-Z][a-zA-Z0-9_-]+\s+(?:and|&)\s+"
|
|
1435
|
+
r"[A-Z][a-zA-Z0-9_-]+\s+(?:are|were)\s+on\s+the\s+same\s+team\b"
|
|
1436
|
+
r"|\b(?:have|has|had)\s+"
|
|
1437
|
+
r"(?:(?:one|two|three|four|five|six|seven|eight|nine|ten|\d+|a|an|no)\s+)?"
|
|
1438
|
+
r"(?:child|children|kids?|son|daughter)\b"
|
|
1439
|
+
r"|\b(?:dating|engaged\s+to|married\s+to)\s+"
|
|
1440
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+|my|his|her|their|our|your)\b"
|
|
1441
|
+
r"|\b(?:relationship\s+status|status)\s+(?:is|was)\s+"
|
|
1442
|
+
r"(?:single|dating|engaged|married|divorced)\b",
|
|
1443
|
+
re.IGNORECASE,
|
|
1444
|
+
)
|
|
1445
|
+
|
|
1446
|
+
|
|
1447
|
+
def _has_status_profile_support(
|
|
1448
|
+
memory_terms: set[str],
|
|
1449
|
+
*,
|
|
1450
|
+
memory_text: str = "",
|
|
1451
|
+
) -> bool:
|
|
1452
|
+
explicit_status = {
|
|
1453
|
+
"breakup",
|
|
1454
|
+
"dating",
|
|
1455
|
+
"divorce",
|
|
1456
|
+
"divorced",
|
|
1457
|
+
"engag",
|
|
1458
|
+
"engaged",
|
|
1459
|
+
"engagement",
|
|
1460
|
+
"marriage",
|
|
1461
|
+
"married",
|
|
1462
|
+
"single",
|
|
1463
|
+
} & memory_terms
|
|
1464
|
+
direct_relation = {
|
|
1465
|
+
"boyfriend",
|
|
1466
|
+
"boss",
|
|
1467
|
+
"brother",
|
|
1468
|
+
"child",
|
|
1469
|
+
"children",
|
|
1470
|
+
"colleague",
|
|
1471
|
+
"cousin",
|
|
1472
|
+
"coworker",
|
|
1473
|
+
"daughter",
|
|
1474
|
+
"father",
|
|
1475
|
+
"fiance",
|
|
1476
|
+
"fiancee",
|
|
1477
|
+
"friend",
|
|
1478
|
+
"friends",
|
|
1479
|
+
"girlfriend",
|
|
1480
|
+
"grandfather",
|
|
1481
|
+
"grandmother",
|
|
1482
|
+
"husband",
|
|
1483
|
+
"kid",
|
|
1484
|
+
"kids",
|
|
1485
|
+
"manager",
|
|
1486
|
+
"mentor",
|
|
1487
|
+
"member",
|
|
1488
|
+
"mother",
|
|
1489
|
+
"neighbor",
|
|
1490
|
+
"parent",
|
|
1491
|
+
"parents",
|
|
1492
|
+
"partner",
|
|
1493
|
+
"roommate",
|
|
1494
|
+
"sibling",
|
|
1495
|
+
"sister",
|
|
1496
|
+
"son",
|
|
1497
|
+
"spouse",
|
|
1498
|
+
"team",
|
|
1499
|
+
"teammate",
|
|
1500
|
+
"teammates",
|
|
1501
|
+
"wife",
|
|
1502
|
+
} & memory_terms
|
|
1503
|
+
return bool(
|
|
1504
|
+
explicit_status
|
|
1505
|
+
or (direct_relation and _STATUS_PROFILE_RELATION_RE.search(memory_text))
|
|
1506
|
+
)
|
|
1507
|
+
|
|
1508
|
+
|
|
1509
|
+
_LOCATION_TRANSITION_SURFACE_RE = re.compile(
|
|
1510
|
+
r"\b(?:move|moved|moving|relocate|relocated|relocating)\s+"
|
|
1511
|
+
r"(?:back\s+)?(?:from|to|into|out\s+of)\s+"
|
|
1512
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+|the\s+[a-zA-Z][a-zA-Z0-9_-]+)",
|
|
1513
|
+
)
|
|
1514
|
+
_LOCATION_PROFILE_SURFACE_RE = re.compile(
|
|
1515
|
+
r"\b(?:live|lived|living|stay|stayed|staying|based)\s+"
|
|
1516
|
+
r"(?:in|at|near|around)\s+"
|
|
1517
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+|the\s+[a-zA-Z][a-zA-Z0-9_-]+)"
|
|
1518
|
+
r"|\b(?:from|born\s+in|grew\s+up\s+in)\s+"
|
|
1519
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+|the\s+[a-zA-Z][a-zA-Z0-9_-]+)"
|
|
1520
|
+
r"|\braised\s+(?:in|near|around)\s+"
|
|
1521
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+|the\s+[a-zA-Z][a-zA-Z0-9_-]+)"
|
|
1522
|
+
r"|\bhometown\s+(?:is|was|in)\s+"
|
|
1523
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+|the\s+[a-zA-Z][a-zA-Z0-9_-]+)"
|
|
1524
|
+
r"|\b(?:(?:my|his|her|their|our|your)\s+)?(?:current\s+)?"
|
|
1525
|
+
r"(?:city|home|location)\s+(?:is|was)\s+"
|
|
1526
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+|the\s+[a-zA-Z][a-zA-Z0-9_-]+)",
|
|
1527
|
+
)
|
|
1528
|
+
_CAMPING_LOCATION_SURFACE_RE = re.compile(
|
|
1529
|
+
r"\b(?:camped|camping|went\s+camping)\s+"
|
|
1530
|
+
r"(?:in|at|near|around)\s+"
|
|
1531
|
+
r"(?:a\s+|an\s+|the\s+|[A-Z][a-zA-Z0-9_-]+\s+)?"
|
|
1532
|
+
r"(?:campground|campsite|site|park|lake|trail|coast|coastline)\b",
|
|
1533
|
+
re.IGNORECASE,
|
|
1534
|
+
)
|
|
1535
|
+
_WORKPLACE_LOCATION_SURFACE_RE = re.compile(
|
|
1536
|
+
r"\b(?:work|worked|working|works)\s+(?:in|near|around)\s+"
|
|
1537
|
+
r"(?:a\s+|an\s+|the\s+)?(?:[A-Z][a-zA-Z0-9_-]+|"
|
|
1538
|
+
r"downtown|midtown|uptown)"
|
|
1539
|
+
r"|\b(?:work|worked|working|works)\s+at\s+"
|
|
1540
|
+
r"(?:a\s+|an\s+|the\s+)?(?:[a-zA-Z][a-zA-Z0-9_-]+\s+){0,4}"
|
|
1541
|
+
r"(?:in|near|around)\s+(?:a\s+|an\s+|the\s+)?"
|
|
1542
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+|downtown|midtown|uptown)"
|
|
1543
|
+
r"|\b(?:office|workplace)\s+(?:is|was|in|at|near|around)\s+"
|
|
1544
|
+
r"(?:a\s+|an\s+|the\s+)?(?:[A-Z][a-zA-Z0-9_-]+|"
|
|
1545
|
+
r"downtown|midtown|uptown)",
|
|
1546
|
+
)
|
|
1547
|
+
_EVENT_VENUE_LOCATION_SURFACE_RE = re.compile(
|
|
1548
|
+
r"(?i:\b(?:attend|attended|attending|book|booked|choose|chose|chosen|"
|
|
1549
|
+
r"event|concert|conference|meet|met|meeting|show|visit|visited|"
|
|
1550
|
+
r"wedding|ceremony|reception|workshop)\b)"
|
|
1551
|
+
r"[^.?!\n]{0,100}(?i:\b(?:at|in|near|around)\s+)"
|
|
1552
|
+
r"(?i:(?:a\s+|an\s+|the\s+)?)"
|
|
1553
|
+
r"(?:[A-Z][a-zA-Z0-9_-]+(?:\s+[A-Z][a-zA-Z0-9_-]+){0,3}|"
|
|
1554
|
+
r"(?i:auditorium|barn|cafe|center|centre|chapel|church|gallery|garden|"
|
|
1555
|
+
r"hall|library|museum|park|restaurant|school|studio|theater|theatre|venue))\b",
|
|
1556
|
+
)
|
|
1557
|
+
_WEDDING_VENUE_LOCATION_SURFACE_RE = re.compile(
|
|
1558
|
+
r"(?i:\b(?:book|booked|choose|chose|chosen|pick|picked|select|selected)\b)"
|
|
1559
|
+
r"[^.?!\n]{0,100}"
|
|
1560
|
+
r"(?i:\b(?:auditorium|barn|chapel|church|gallery|garden|hall|hotel|"
|
|
1561
|
+
r"museum|park|restaurant|theater|theatre|venue)\b)"
|
|
1562
|
+
r"[^.?!\n]{0,100}(?i:\b(?:wedding|ceremony|reception)\b)"
|
|
1563
|
+
r"|(?i:\b(?:wedding|ceremony|reception)\b)"
|
|
1564
|
+
r"[^.?!\n]{0,100}"
|
|
1565
|
+
r"(?i:\b(?:auditorium|barn|chapel|church|gallery|garden|hall|hotel|"
|
|
1566
|
+
r"museum|park|restaurant|theater|theatre|venue)\b)",
|
|
1567
|
+
)
|
|
1568
|
+
|
|
1569
|
+
|
|
1570
|
+
def _has_location_transition_support(
|
|
1571
|
+
memory_terms: set[str],
|
|
1572
|
+
*,
|
|
1573
|
+
memory_text: str = "",
|
|
1574
|
+
) -> bool:
|
|
1575
|
+
movement_action = {
|
|
1576
|
+
"move",
|
|
1577
|
+
"moved",
|
|
1578
|
+
"moving",
|
|
1579
|
+
"relocate",
|
|
1580
|
+
"relocated",
|
|
1581
|
+
"relocat",
|
|
1582
|
+
} & memory_terms
|
|
1583
|
+
origin_context = {
|
|
1584
|
+
"city",
|
|
1585
|
+
"country",
|
|
1586
|
+
"from",
|
|
1587
|
+
"gallery",
|
|
1588
|
+
"home",
|
|
1589
|
+
"origin",
|
|
1590
|
+
"place",
|
|
1591
|
+
"museum",
|
|
1592
|
+
"theater",
|
|
1593
|
+
"theatre",
|
|
1594
|
+
"venue",
|
|
1595
|
+
} & memory_terms
|
|
1596
|
+
location_profile_action = {
|
|
1597
|
+
"live",
|
|
1598
|
+
"lived",
|
|
1599
|
+
"living",
|
|
1600
|
+
"based",
|
|
1601
|
+
"bas",
|
|
1602
|
+
"stay",
|
|
1603
|
+
"stayed",
|
|
1604
|
+
"staying",
|
|
1605
|
+
} & memory_terms
|
|
1606
|
+
location_profile_context = {
|
|
1607
|
+
"city",
|
|
1608
|
+
"conference",
|
|
1609
|
+
"country",
|
|
1610
|
+
"home",
|
|
1611
|
+
"hotel",
|
|
1612
|
+
"place",
|
|
1613
|
+
} & memory_terms
|
|
1614
|
+
origin_profile_surface = {
|
|
1615
|
+
"born",
|
|
1616
|
+
"childhood",
|
|
1617
|
+
"from",
|
|
1618
|
+
"grew",
|
|
1619
|
+
"hometown",
|
|
1620
|
+
"origin",
|
|
1621
|
+
"originally",
|
|
1622
|
+
"rais",
|
|
1623
|
+
"raise",
|
|
1624
|
+
} & memory_terms
|
|
1625
|
+
travel_surface = {
|
|
1626
|
+
"camp",
|
|
1627
|
+
"camped",
|
|
1628
|
+
"camping",
|
|
1629
|
+
"drive",
|
|
1630
|
+
"roadtrip",
|
|
1631
|
+
"travel",
|
|
1632
|
+
"trip",
|
|
1633
|
+
} & memory_terms
|
|
1634
|
+
travel_context = {
|
|
1635
|
+
"campground",
|
|
1636
|
+
"campsite",
|
|
1637
|
+
"city",
|
|
1638
|
+
"country",
|
|
1639
|
+
"from",
|
|
1640
|
+
"home",
|
|
1641
|
+
"lake",
|
|
1642
|
+
"location",
|
|
1643
|
+
"origin",
|
|
1644
|
+
"park",
|
|
1645
|
+
"place",
|
|
1646
|
+
"road",
|
|
1647
|
+
"site",
|
|
1648
|
+
} & memory_terms
|
|
1649
|
+
return bool(
|
|
1650
|
+
(movement_action and origin_context)
|
|
1651
|
+
or (movement_action and _LOCATION_TRANSITION_SURFACE_RE.search(memory_text))
|
|
1652
|
+
or (location_profile_action and location_profile_context)
|
|
1653
|
+
or (origin_profile_surface and origin_context)
|
|
1654
|
+
or _LOCATION_PROFILE_SURFACE_RE.search(memory_text)
|
|
1655
|
+
or _CAMPING_LOCATION_SURFACE_RE.search(memory_text)
|
|
1656
|
+
or _WORKPLACE_LOCATION_SURFACE_RE.search(memory_text)
|
|
1657
|
+
or _EVENT_VENUE_LOCATION_SURFACE_RE.search(memory_text)
|
|
1658
|
+
or _WEDDING_VENUE_LOCATION_SURFACE_RE.search(memory_text)
|
|
1659
|
+
or (travel_surface and travel_context)
|
|
1660
|
+
)
|
|
1661
|
+
|
|
1662
|
+
|
|
1663
|
+
def _has_preference_support(memory_terms: set[str]) -> bool:
|
|
1664
|
+
preference_action = {
|
|
1665
|
+
"avoid",
|
|
1666
|
+
"avoided",
|
|
1667
|
+
"avoids",
|
|
1668
|
+
"dislik",
|
|
1669
|
+
"dislike",
|
|
1670
|
+
"disliked",
|
|
1671
|
+
"enjoy",
|
|
1672
|
+
"enjoyed",
|
|
1673
|
+
"fan",
|
|
1674
|
+
"favorite",
|
|
1675
|
+
"favourite",
|
|
1676
|
+
"hat",
|
|
1677
|
+
"hate",
|
|
1678
|
+
"hated",
|
|
1679
|
+
"hates",
|
|
1680
|
+
"interest",
|
|
1681
|
+
"interested",
|
|
1682
|
+
"like",
|
|
1683
|
+
"liked",
|
|
1684
|
+
"love",
|
|
1685
|
+
"loved",
|
|
1686
|
+
"prefer",
|
|
1687
|
+
"preferred",
|
|
1688
|
+
} & memory_terms
|
|
1689
|
+
preference_context = {
|
|
1690
|
+
"activity",
|
|
1691
|
+
"activities",
|
|
1692
|
+
"animal",
|
|
1693
|
+
"animals",
|
|
1694
|
+
"bach",
|
|
1695
|
+
"book",
|
|
1696
|
+
"books",
|
|
1697
|
+
"camp",
|
|
1698
|
+
"campfire",
|
|
1699
|
+
"camping",
|
|
1700
|
+
"classic",
|
|
1701
|
+
"company",
|
|
1702
|
+
"color",
|
|
1703
|
+
"coffee",
|
|
1704
|
+
"exhibit",
|
|
1705
|
+
"family",
|
|
1706
|
+
"food",
|
|
1707
|
+
"hike",
|
|
1708
|
+
"hobby",
|
|
1709
|
+
"hobbies",
|
|
1710
|
+
"kid",
|
|
1711
|
+
"kids",
|
|
1712
|
+
"marshmallow",
|
|
1713
|
+
"meteor",
|
|
1714
|
+
"mozart",
|
|
1715
|
+
"movie",
|
|
1716
|
+
"movies",
|
|
1717
|
+
"music",
|
|
1718
|
+
"novel",
|
|
1719
|
+
"novels",
|
|
1720
|
+
"outdoor",
|
|
1721
|
+
"outdoors",
|
|
1722
|
+
"park",
|
|
1723
|
+
"read",
|
|
1724
|
+
"reading",
|
|
1725
|
+
"restaurant",
|
|
1726
|
+
"run",
|
|
1727
|
+
"running",
|
|
1728
|
+
"song",
|
|
1729
|
+
"songs",
|
|
1730
|
+
"sport",
|
|
1731
|
+
"sports",
|
|
1732
|
+
"story",
|
|
1733
|
+
"summer",
|
|
1734
|
+
"tea",
|
|
1735
|
+
"writer",
|
|
1736
|
+
"writers",
|
|
1737
|
+
} & memory_terms
|
|
1738
|
+
author_context = {"author", "authors"} & memory_terms and (
|
|
1739
|
+
{"book", "books", "novel", "novels", "read", "reading", "writer", "writers"}
|
|
1740
|
+
& memory_terms
|
|
1741
|
+
)
|
|
1742
|
+
outdoor_context = {"camp", "camping", "outdoor", "outdoors", "park"} & memory_terms
|
|
1743
|
+
self_care_surface = {"self-care", "relax", "refresh", "refreshes", "routine"} & memory_terms
|
|
1744
|
+
self_care_context = {"balance", "family", "present", "wellness"} & memory_terms
|
|
1745
|
+
durable_outdoor_context = {
|
|
1746
|
+
"campfire",
|
|
1747
|
+
"marshmallow",
|
|
1748
|
+
"meteor",
|
|
1749
|
+
"story",
|
|
1750
|
+
"summer",
|
|
1751
|
+
} & memory_terms
|
|
1752
|
+
return bool(
|
|
1753
|
+
(preference_action and preference_context)
|
|
1754
|
+
or (preference_action and author_context)
|
|
1755
|
+
or (outdoor_context and durable_outdoor_context)
|
|
1756
|
+
or (self_care_surface and self_care_context)
|
|
1757
|
+
)
|
|
1758
|
+
|
|
1759
|
+
|
|
1760
|
+
_FAVORITE_PREFERENCE_SURFACE_RE = re.compile(
|
|
1761
|
+
r"\b(?:my|his|her|their|our|your)\s+go-to\s+"
|
|
1762
|
+
r"(?:book|choice|color|food|movie|music|place|restaurant|song|spot)\s+"
|
|
1763
|
+
r"(?:is|was)\b"
|
|
1764
|
+
r"|\bgo-to\s+(?:book|choice|color|food|movie|music|place|restaurant|song|spot)\b",
|
|
1765
|
+
re.IGNORECASE,
|
|
1766
|
+
)
|
|
1767
|
+
_FAVORITE_NEGATED_OR_STALE_SURFACE_RE = re.compile(
|
|
1768
|
+
r"\b(?:not(?!\s+just\b)|never|no\s+longer|isn't|wasn't|"
|
|
1769
|
+
r"is\s+not|was\s+not)\s+"
|
|
1770
|
+
r"(?:(?:my|his|her|their|our|your)\s+)?(?:favorite|favourite)\b"
|
|
1771
|
+
r"|\b(?:my|his|her|their|our|your)\s+"
|
|
1772
|
+
r"(?:favorite|favourite)\s+"
|
|
1773
|
+
r"(?:book|choice|color|food|movie|music|place|restaurant|song|spot)\s+"
|
|
1774
|
+
r"(?:is|was)\s+not\b"
|
|
1775
|
+
r"|\bused\s+to\s+(?:be\s+)?"
|
|
1776
|
+
r"(?:(?:my|his|her|their|our|your)\s+)?(?:favorite|favourite)\b"
|
|
1777
|
+
r"|\b(?:my|his|her|their|our|your)\s+"
|
|
1778
|
+
r"(?:favorite|favourite)\s+"
|
|
1779
|
+
r"(?:book|choice|color|food|movie|music|place|restaurant|song|spot)\s+"
|
|
1780
|
+
r"used\s+to\s+be\b",
|
|
1781
|
+
re.IGNORECASE,
|
|
1782
|
+
)
|
|
1783
|
+
_FAVORITE_CURRENT_SURFACE_RE = re.compile(
|
|
1784
|
+
r"\b(?:now|currently|current|these\s+days|today)\b.{0,80}"
|
|
1785
|
+
r"\b(?:favorite|favourite)\b"
|
|
1786
|
+
r"|\bcurrent\s+(?:favorite|favourite)\b",
|
|
1787
|
+
re.IGNORECASE | re.DOTALL,
|
|
1788
|
+
)
|
|
1789
|
+
|
|
1790
|
+
|
|
1791
|
+
def _has_favorite_preference_support(
|
|
1792
|
+
memory_terms: set[str],
|
|
1793
|
+
*,
|
|
1794
|
+
memory_text: str = "",
|
|
1795
|
+
) -> bool:
|
|
1796
|
+
if _FAVORITE_NEGATED_OR_STALE_SURFACE_RE.search(
|
|
1797
|
+
memory_text,
|
|
1798
|
+
) and not _FAVORITE_CURRENT_SURFACE_RE.search(memory_text):
|
|
1799
|
+
return False
|
|
1800
|
+
favorite_surface = {"favorite", "favourite"} & memory_terms
|
|
1801
|
+
favorite_context = {
|
|
1802
|
+
"book",
|
|
1803
|
+
"choice",
|
|
1804
|
+
"color",
|
|
1805
|
+
"food",
|
|
1806
|
+
"movie",
|
|
1807
|
+
"movies",
|
|
1808
|
+
"music",
|
|
1809
|
+
"restaurant",
|
|
1810
|
+
"song",
|
|
1811
|
+
} & memory_terms
|
|
1812
|
+
return bool(
|
|
1813
|
+
(favorite_surface and favorite_context)
|
|
1814
|
+
or _FAVORITE_PREFERENCE_SURFACE_RE.search(memory_text)
|
|
1815
|
+
)
|
|
1816
|
+
|
|
1817
|
+
|
|
1818
|
+
def _has_contrast_support(memory_terms: set[str]) -> bool:
|
|
1819
|
+
current_surface = {
|
|
1820
|
+
"current",
|
|
1821
|
+
"currently",
|
|
1822
|
+
"now",
|
|
1823
|
+
"ongoing",
|
|
1824
|
+
"present",
|
|
1825
|
+
"still",
|
|
1826
|
+
"today",
|
|
1827
|
+
} & memory_terms
|
|
1828
|
+
stale_surface = {
|
|
1829
|
+
"before",
|
|
1830
|
+
"changed",
|
|
1831
|
+
"earlier",
|
|
1832
|
+
"former",
|
|
1833
|
+
"formerly",
|
|
1834
|
+
"past",
|
|
1835
|
+
"previous",
|
|
1836
|
+
"previously",
|
|
1837
|
+
"used",
|
|
1838
|
+
} & memory_terms
|
|
1839
|
+
contrast_surface = {
|
|
1840
|
+
"alternative",
|
|
1841
|
+
"but",
|
|
1842
|
+
"compare",
|
|
1843
|
+
"different",
|
|
1844
|
+
"difference",
|
|
1845
|
+
"however",
|
|
1846
|
+
"instead",
|
|
1847
|
+
"rather",
|
|
1848
|
+
"whereas",
|
|
1849
|
+
} & memory_terms
|
|
1850
|
+
return bool(
|
|
1851
|
+
(current_surface and stale_surface)
|
|
1852
|
+
or (contrast_surface and current_surface and stale_surface)
|
|
1853
|
+
or (contrast_surface and {"before", "earlier", "previous", "used"} & memory_terms)
|
|
1854
|
+
)
|
|
1855
|
+
|
|
1856
|
+
|
|
1857
|
+
def _has_activity_support(memory_terms: set[str]) -> bool:
|
|
1858
|
+
concrete_activity = {
|
|
1859
|
+
"camp",
|
|
1860
|
+
"camping",
|
|
1861
|
+
"music",
|
|
1862
|
+
"paint",
|
|
1863
|
+
"painting",
|
|
1864
|
+
"pottery",
|
|
1865
|
+
"read",
|
|
1866
|
+
"reading",
|
|
1867
|
+
"run",
|
|
1868
|
+
"running",
|
|
1869
|
+
"song",
|
|
1870
|
+
"songs",
|
|
1871
|
+
"swim",
|
|
1872
|
+
"swimming",
|
|
1873
|
+
"violin",
|
|
1874
|
+
} & memory_terms
|
|
1875
|
+
creative_context = {"creative", "express", "fun", "hobby"} & memory_terms
|
|
1876
|
+
hike_surface = {"hik", "hike", "hiking"} & memory_terms
|
|
1877
|
+
hike_occurrence_context = {
|
|
1878
|
+
"photo",
|
|
1879
|
+
"pic",
|
|
1880
|
+
"spot",
|
|
1881
|
+
"summer",
|
|
1882
|
+
"water",
|
|
1883
|
+
"waterfall",
|
|
1884
|
+
"weekend",
|
|
1885
|
+
"went",
|
|
1886
|
+
} & memory_terms
|
|
1887
|
+
roadtrip_surface = {"roadtrip", "trip"} & memory_terms
|
|
1888
|
+
roadtrip_occurrence_context = {
|
|
1889
|
+
"accident",
|
|
1890
|
+
"bad",
|
|
1891
|
+
"forest",
|
|
1892
|
+
"road",
|
|
1893
|
+
"scared",
|
|
1894
|
+
"start",
|
|
1895
|
+
} & memory_terms
|
|
1896
|
+
book_surface = {"book", "books", "bookshelf"} & memory_terms
|
|
1897
|
+
book_context = {"classic", "culture", "educational", "kid", "kids", "story"} & memory_terms
|
|
1898
|
+
return bool(
|
|
1899
|
+
concrete_activity
|
|
1900
|
+
or ({"class"} & memory_terms and creative_context)
|
|
1901
|
+
or (hike_surface and hike_occurrence_context)
|
|
1902
|
+
or (roadtrip_surface and roadtrip_occurrence_context)
|
|
1903
|
+
or (book_surface and book_context)
|
|
1904
|
+
)
|
|
1905
|
+
|
|
1906
|
+
|
|
1907
|
+
def _has_current_goal_support(memory_terms: set[str]) -> bool:
|
|
1908
|
+
if {"goal", "future"} <= memory_terms:
|
|
1909
|
+
return True
|
|
1910
|
+
if "goal" in memory_terms and {"next", "plan", "soon"} & memory_terms:
|
|
1911
|
+
return True
|
|
1912
|
+
if {"hope", "plan"} <= memory_terms:
|
|
1913
|
+
return True
|
|
1914
|
+
if {"planned", "soon"} <= memory_terms:
|
|
1915
|
+
return True
|
|
1916
|
+
if "want" in memory_terms and {"goal", "future", "plan", "soon"} & memory_terms:
|
|
1917
|
+
return True
|
|
1918
|
+
return bool("plan" in memory_terms and {"future", "next", "soon"} & memory_terms)
|
|
1919
|
+
|
|
1920
|
+
|
|
1921
|
+
def _has_support_goal_support(memory_terms: set[str]) -> bool:
|
|
1922
|
+
support_action = {
|
|
1923
|
+
"got",
|
|
1924
|
+
"help",
|
|
1925
|
+
"helped",
|
|
1926
|
+
"receive",
|
|
1927
|
+
"received",
|
|
1928
|
+
"support",
|
|
1929
|
+
} & memory_terms
|
|
1930
|
+
development_context = {
|
|
1931
|
+
"difference",
|
|
1932
|
+
"grow",
|
|
1933
|
+
"growing",
|
|
1934
|
+
"huge",
|
|
1935
|
+
"improv",
|
|
1936
|
+
"improved",
|
|
1937
|
+
"journey",
|
|
1938
|
+
"life",
|
|
1939
|
+
} & memory_terms
|
|
1940
|
+
counseling_context = {
|
|
1941
|
+
"counsel",
|
|
1942
|
+
"counseling",
|
|
1943
|
+
"group",
|
|
1944
|
+
"health",
|
|
1945
|
+
"mental",
|
|
1946
|
+
} & memory_terms
|
|
1947
|
+
book_self_discovery = {"book"} & memory_terms and {
|
|
1948
|
+
"discover",
|
|
1949
|
+
"guide",
|
|
1950
|
+
"help",
|
|
1951
|
+
"motivate",
|
|
1952
|
+
} & memory_terms
|
|
1953
|
+
counseling_career = counseling_context and {"job", "jobs"} & memory_terms and {
|
|
1954
|
+
"important",
|
|
1955
|
+
"people",
|
|
1956
|
+
"talk",
|
|
1957
|
+
} & memory_terms
|
|
1958
|
+
adoption_context = {"adopt", "adoption", "agencies", "agency"} & memory_terms
|
|
1959
|
+
inclusive_context = {
|
|
1960
|
+
"inclusive",
|
|
1961
|
+
"inclusivity",
|
|
1962
|
+
"kids",
|
|
1963
|
+
"lgbtq",
|
|
1964
|
+
"support",
|
|
1965
|
+
} & memory_terms
|
|
1966
|
+
adoption_outcome = {"family", "kid"} & memory_terms and {
|
|
1967
|
+
"amaz",
|
|
1968
|
+
"amazing",
|
|
1969
|
+
"awesome",
|
|
1970
|
+
"creat",
|
|
1971
|
+
"lovely",
|
|
1972
|
+
"mom",
|
|
1973
|
+
} & memory_terms
|
|
1974
|
+
return bool(
|
|
1975
|
+
(support_action and development_context and counseling_context)
|
|
1976
|
+
or book_self_discovery
|
|
1977
|
+
or counseling_career
|
|
1978
|
+
or (adoption_context and (support_action or inclusive_context))
|
|
1979
|
+
or adoption_outcome
|
|
1980
|
+
)
|
|
1981
|
+
|
|
1982
|
+
|
|
1983
|
+
def _has_identity_profile_support(memory_terms: set[str]) -> bool:
|
|
1984
|
+
visual_identity = {"transgender", "pride", "flag", "mural"} <= memory_terms and {
|
|
1985
|
+
"inspir",
|
|
1986
|
+
"story",
|
|
1987
|
+
"support",
|
|
1988
|
+
} & memory_terms
|
|
1989
|
+
political_context = (
|
|
1990
|
+
{"conservative", "hike", "upset"} <= memory_terms
|
|
1991
|
+
and {"lgbtq", "right", "work"} <= memory_terms
|
|
1992
|
+
and {"accept", "support"} <= memory_terms
|
|
1993
|
+
)
|
|
1994
|
+
religious_context = {"church", "conservative", "journey"} <= memory_terms and {
|
|
1995
|
+
"acceptance",
|
|
1996
|
+
"chang",
|
|
1997
|
+
"faith",
|
|
1998
|
+
"think",
|
|
1999
|
+
} & memory_terms
|
|
2000
|
+
community_support = (
|
|
2001
|
+
{"lgbtq", "right", "support"} <= memory_terms
|
|
2002
|
+
or {"lgbtq+", "adoption", "inclusivity", "support"} <= memory_terms
|
|
2003
|
+
or {"community", "ally", "support"} <= memory_terms
|
|
2004
|
+
)
|
|
2005
|
+
personality_context = (
|
|
2006
|
+
{"care", "real", "help"} <= memory_terms
|
|
2007
|
+
or {"concern", "thoughtful"} <= memory_terms
|
|
2008
|
+
or {"care", "real", "concern"} <= memory_terms
|
|
2009
|
+
)
|
|
2010
|
+
return bool(
|
|
2011
|
+
visual_identity
|
|
2012
|
+
or political_context
|
|
2013
|
+
or religious_context
|
|
2014
|
+
or community_support
|
|
2015
|
+
or personality_context
|
|
2016
|
+
)
|
|
2017
|
+
|
|
2018
|
+
|
|
2019
|
+
_COMMUNITY_MEMBERSHIP_MARKER_RE = re.compile(
|
|
2020
|
+
r"\b(?:identif(?:y|ies|ied)|member|part\s+of|belong(?:s|ed|ing)?\s+to|"
|
|
2021
|
+
r"came\s+out|is\s+(?:transgender|queer|lgbtq?)|joined)\b"
|
|
2022
|
+
r".{0,120}\b(?:lgbtq?|trans(?:gender)?|queer|pride|support\s+group|community)\b|"
|
|
2023
|
+
r"\b(?:lgbtq?|trans(?:gender)?|queer|pride|support\s+group|community)\b"
|
|
2024
|
+
r".{0,120}\b(?:identif(?:y|ies|ied)|member|part\s+of|belong(?:s|ed|ing)?|"
|
|
2025
|
+
r"came\s+out|joined)\b",
|
|
2026
|
+
re.IGNORECASE | re.DOTALL,
|
|
2027
|
+
)
|
|
2028
|
+
_COMMUNITY_ALLY_NOISE_RE = re.compile(
|
|
2029
|
+
r"\b(?:ally|allies|supportive|supported|encourag(?:e|ed|es|ing)|"
|
|
2030
|
+
r"advocat(?:e|ed|es|ing))\b.{0,100}\b(?:lgbtq?|trans(?:gender)?|"
|
|
2031
|
+
r"queer|community|rights)\b|"
|
|
2032
|
+
r"\b(?:lgbtq?|trans(?:gender)?|queer|pride|community|rights)\b.{0,100}"
|
|
2033
|
+
r"\b(?:ally|allies|supportive|supported|encourag(?:e|ed|es|ing)|"
|
|
2034
|
+
r"advocat(?:e|ed|es|ing))\b",
|
|
2035
|
+
re.IGNORECASE | re.DOTALL,
|
|
2036
|
+
)
|
|
2037
|
+
|
|
2038
|
+
|
|
2039
|
+
def _has_community_membership_support(
|
|
2040
|
+
memory_terms: set[str],
|
|
2041
|
+
*,
|
|
2042
|
+
memory_text: str = "",
|
|
2043
|
+
) -> bool:
|
|
2044
|
+
community_domain = {
|
|
2045
|
+
"lgbt",
|
|
2046
|
+
"lgbtq",
|
|
2047
|
+
"lgbtq+",
|
|
2048
|
+
"pride",
|
|
2049
|
+
"queer",
|
|
2050
|
+
"trans",
|
|
2051
|
+
"transgender",
|
|
2052
|
+
} & memory_terms
|
|
2053
|
+
membership_surface = {
|
|
2054
|
+
"belong",
|
|
2055
|
+
"belonged",
|
|
2056
|
+
"belonging",
|
|
2057
|
+
"identifies",
|
|
2058
|
+
"identify",
|
|
2059
|
+
"identified",
|
|
2060
|
+
"joined",
|
|
2061
|
+
"member",
|
|
2062
|
+
"membership",
|
|
2063
|
+
} & memory_terms
|
|
2064
|
+
if not community_domain:
|
|
2065
|
+
return False
|
|
2066
|
+
if _COMMUNITY_ALLY_NOISE_RE.search(memory_text):
|
|
2067
|
+
return False
|
|
2068
|
+
return bool(
|
|
2069
|
+
membership_surface
|
|
2070
|
+
or {"part", "community"} <= memory_terms
|
|
2071
|
+
or _COMMUNITY_MEMBERSHIP_MARKER_RE.search(memory_text)
|
|
2072
|
+
)
|
|
2073
|
+
|
|
2074
|
+
|
|
2075
|
+
_TYPED_SUPPORT_CHECKS: dict[str, Callable[[set[str]], bool]] = {
|
|
2076
|
+
"activity": _has_activity_support,
|
|
2077
|
+
"age_profile": _has_age_profile_support,
|
|
2078
|
+
"alias_profile": _has_alias_profile_support,
|
|
2079
|
+
"commitment_profile": _has_commitment_profile_support,
|
|
2080
|
+
"community_membership": _has_community_membership_support,
|
|
2081
|
+
"contact_profile": _has_contact_profile_support,
|
|
2082
|
+
"contrast": _has_contrast_support,
|
|
2083
|
+
"current_goal": _has_current_goal_support,
|
|
2084
|
+
"date_profile": _has_date_profile_support,
|
|
2085
|
+
"diet_profile": _has_diet_profile_support,
|
|
2086
|
+
"education_profile": _has_education_profile_support,
|
|
2087
|
+
"employment_profile": _has_employment_profile_support,
|
|
2088
|
+
"emotion_response": _has_emotion_response_support,
|
|
2089
|
+
"exchange": _has_exchange_support,
|
|
2090
|
+
"health_profile": _has_health_profile_support,
|
|
2091
|
+
"identity_profile": _has_identity_profile_support,
|
|
2092
|
+
"pet_profile": _has_pet_profile_support,
|
|
2093
|
+
"participation_event": _has_participation_event_support,
|
|
2094
|
+
"preference": _has_preference_support,
|
|
2095
|
+
"registration_event": _has_registration_event_support,
|
|
2096
|
+
"skill_profile": _has_skill_profile_support,
|
|
2097
|
+
"support_goal": _has_support_goal_support,
|
|
2098
|
+
"symbolic_meaning": _has_symbolic_meaning_support,
|
|
2099
|
+
"vehicle_profile": _has_vehicle_profile_support,
|
|
2100
|
+
}
|