harbor run -t openthoughts/tasktrove-exp-flat25-stackoverflow-v2-5k-stackoverflow-3221harbor download openthoughts/tasktrove-exp-flat25-stackoverflow-v2-5k-stackoverflow-3221Title: Make EntityRuler.add_patterns idempotent for empty input and robust against duplicates (spaCy)
Context I'm working with spaCy's EntityRuler. The tests expect that after calling add_patterns with a non-empty list, the internal pattern store has patterns (pattern_count > 0), and that calling add_patterns([]) does not inflate or mutate the internal state. However, the current implementation mutates the internal store even when given an empty list, which can lead to unintended duplicates or state changes on repeated calls.
What I need
Why this is needed
Acceptance criteria
Implementation notes and constraints
Test alignment
Repro steps (example)
Deliverables (expected)
If someone can provide a concrete patch/diff implementing the above, along with a short justification and notes on any edge cases, that would be greatly appreciated.