This repository was archived by the owner on May 13, 2026. It is now read-only.
fix: improve discovery anonymity gate — token-level entropy, address NER, phone dot separator - #441
Merged
Conversation
…NER, phone dot separator - Change token_entropy() from byte-level to token-level Shannon entropy (measures word diversity, not character diversity) - Recalibrate MIN_ENTROPY_BITS from 2.0 to 1.5 for token-level metric - Add has_address() NER detection for street address patterns - Add '.' as valid phone number separator - Add tests for all new detection patterns Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1b256d411b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…nces - Use char_indices().rev() instead of byte offset for preceding-text window, preventing panic on multi-byte UTF-8 codepoints - Loop over all occurrences of each street suffix (not just first match) to avoid false negatives when the first occurrence lacks a number - Add tests for Unicode input and second-occurrence address patterns Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
token_entropy()now measures word diversity (Shannon entropy over whitespace-delimited tokens) instead of byte-level entropy. Recalibrated threshold from 2.0 to 1.5 bits.has_address()detects street address patterns (number + suffix like St, Avenue, Blvd). Required by design doc but was missing.has_phone()now recognizes555.123.4567format (added.to valid separators).Test plan
cargo test --lib -- anonymity)cargo clippy --workspace --all-targets -- -D warnings)🤖 Generated with Claude Code