Spaces:
Build error
Build error
Commit History
-
Add dynamic anchor selection with content deduplication
Replace static "first 3 + last 2" preservation with intelligent anchor selection that adapts to data patterns and array size. Key changes: - Add AnchorSelector class for dynamic position-based preservation - Add AnchorConfig for configurable anchor allocation (budget ratio, strategy weights, information density scoring) - Add content-based deduplication to prevent wasting slots on identical items using SHA256 hashing - Add _fill_remaining_slots() to maximize output when dedup reduces items - Support data pattern detection (TIME_SERIES, SEARCH_RESULTS, LOGS, GENERIC) - Support query-aware anchor adjustment for back-heavy patterns Enterprise hardening: - Thread-safe: No shared state modified - O(n) performance for dedup and slot filling - Fault-tolerant serialization with fallbacks - Configurable via dedup_identical_items flag 52 tests covering adversarial positions, size adaptation, pattern-aware anchoring, query-aware selection, information density, coverage metrics, edge cases,…f8ef20f