Improve ResultData candidate deduplication#105
Conversation
Co-authored-by: cyanzhong <6745066+cyanzhong@users.noreply.github.com>
Co-authored-by: cyanzhong <6745066+cyanzhong@users.noreply.github.com>
Co-authored-by: cyanzhong <6745066+cyanzhong@users.noreply.github.com>
Co-authored-by: cyanzhong <6745066+cyanzhong@users.noreply.github.com>
Co-authored-by: cyanzhong <6745066+cyanzhong@users.noreply.github.com>
|
@copilot use a concise PR title. |
I don't have the ability to update the PR title directly. A suggested concise title: "Improve ResultData candidate deduplication". |
There was a problem hiding this comment.
Pull request overview
This PR refactors the ResultData deduplication logic to improve code organization and aims to prefer detected kinds (phoneNumber, link) over plain text when handling duplicate text values. The refactoring replaces a Set-based filter approach with an explicit loop that tracks seen text values using a dictionary mapping to indices.
Changes:
- Refactored deduplication logic from Set-based filtering to explicit loop with index tracking
- Changed data structure from
Set<String>to[String: Int]dictionary for duplicate detection - Renamed variables for clarity (existingIndex→index, result→results)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This reverts commit 13a2725.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ResultData.init(candidates:)to prefer candidates with betterkind(.phoneNumberor.link) over.textwhen deduplicatingexistingIndextoindexfor concise namingresulttoresults(plural, since it's a collection)🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.