Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Internal deduplication impl. #1568

Merged
merged 2 commits into from
Feb 9, 2025
Merged

feat: Internal deduplication impl. #1568

merged 2 commits into from
Feb 9, 2025

Conversation

keli-wen
Copy link
Collaborator

@keli-wen keli-wen commented Feb 7, 2025

Description

The implementation of internal deduplication utils function.

Motivation and Context

Refer to #1517

  • I have raised an issue to propose this change (required for new features and bug fixes)

Types of changes

What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds core functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (update in the documentation)
  • Example (update in the folder of example)

Checklist

Go over all the following points, and put an x in all the boxes that apply.
If you are unsure about any of these, don't hesitate to ask. We are here to help!

  • I have read the CONTRIBUTION guide. (required)
  • My change requires a change to the documentation.
  • I have updated the tests accordingly. (required for a bug fix or a new feature)
  • I have updated the documentation accordingly.

@keli-wen keli-wen linked an issue Feb 7, 2025 that may be closed by this pull request
4 tasks
@keli-wen keli-wen self-assigned this Feb 7, 2025
@keli-wen keli-wen mentioned this pull request Feb 7, 2025
10 tasks
@keli-wen keli-wen requested a review from Wendong-Fan February 7, 2025 13:24
@keli-wen keli-wen merged commit a65d44e into master Feb 9, 2025
6 checks passed
@keli-wen keli-wen deleted the deduplication_utils branch February 9, 2025 08:22
Copy link
Member

@Wendong-Fan Wendong-Fan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @keli-wen @NeilJohnson0930 @raywhoelse

Left some comments below, I think we can implement some methods to further improve the efficiency, feel free to check and review the PR here #1579 for the refactor, let me know if there's anything we can further discuss!


import numpy as np
from pydantic import BaseModel
from sklearn.metrics.pairwise import cosine_similarity
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use lazy import make sklearn and numpy optional

Comment on lines +26 to +27
"""
The result of deduplication.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


def deduplicate_internally(
texts: List[str],
threshold: float = 0.65,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we validate threshold value?

@Wendong-Fan Wendong-Fan added this to the Sprint 22 milestone Feb 9, 2025
@Wendong-Fan Wendong-Fan mentioned this pull request Feb 9, 2025
6 tasks
apokryphosx pushed a commit that referenced this pull request Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

[Feature Request] General Deduplication Utility for String-based Data.
4 participants