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

migrate ComparisonProperties #1195

Merged
merged 3 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions splink/athena/athena_comparison_level_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,36 @@
)


class AthenaComparisonProperties(AthenaBase):
@property
def _exact_match_level(self):
return exact_match_level

@property
def _null_level(self):
return null_level

@property
def _else_level(self):
return else_level

@property
def _array_intersect_level(self):
return array_intersect_level

@property
def _distance_in_km_level(self):
return distance_in_km_level

@property
def _distance_function_level(self):
return distance_function_level

@property
def _levenshtein_level(self):
return levenshtein_level


class null_level(AthenaBase, NullLevelBase):
pass

Expand Down
39 changes: 3 additions & 36 deletions splink/athena/athena_comparison_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,7 @@
ExactMatchBase,
LevenshteinAtThresholdsComparisonBase,
)
from .athena_base import (
AthenaBase,
)
from .athena_comparison_level_library import (
array_intersect_level,
distance_function_level,
distance_in_km_level,
else_level,
exact_match_level,
levenshtein_level,
null_level,
)


class AthenaComparisonProperties(AthenaBase):
@property
def _exact_match_level(self):
return exact_match_level

@property
def _null_level(self):
return null_level

@property
def _else_level(self):
return else_level

@property
def _array_intersect_level(self):
return array_intersect_level

@property
def _distance_in_km_level(self):
return distance_in_km_level
from .athena_comparison_level_library import AthenaComparisonProperties


class exact_match(AthenaComparisonProperties, ExactMatchBase):
Expand All @@ -50,15 +17,15 @@ class distance_function_at_thresholds(
):
@property
def _distance_level(self):
return distance_function_level
return self._distance_function_level


class levenshtein_at_thresholds(
AthenaComparisonProperties, LevenshteinAtThresholdsComparisonBase
):
@property
def _distance_level(self):
return levenshtein_level
return self._levenshtein_level


class array_intersect_at_sizes(
Expand Down
47 changes: 47 additions & 0 deletions splink/duckdb/duckdb_comparison_level_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,53 @@
)


# Class used to feed our comparison_library classes
class DuckDBComparisonProperties(DuckDBBase):
@property
def _exact_match_level(self):
return exact_match_level

@property
def _null_level(self):
return null_level

@property
def _else_level(self):
return else_level

@property
def _datediff_level(self):
return datediff_level

@property
def _array_intersect_level(self):
return array_intersect_level

@property
def _distance_in_km_level(self):
return distance_in_km_level

@property
def _distance_function_level(self):
return distance_function_level

@property
def _levenshtein_level(self):
return levenshtein_level

@property
def _jaro_level(self):
return jaro_level

@property
def _jaro_winkler_level(self):
return jaro_winkler_level

@property
def _jaccard_level(self):
return jaccard_level


class null_level(DuckDBBase, NullLevelBase):
pass

Expand Down
65 changes: 6 additions & 59 deletions splink/duckdb/duckdb_comparison_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,60 +9,7 @@
JaroWinklerAtThresholdsComparisonBase,
LevenshteinAtThresholdsComparisonBase,
)
from .duckdb_base import (
DuckDBBase,
)
from .duckdb_comparison_level_library import (
array_intersect_level,
datediff_level,
distance_function_level,
distance_in_km_level,
else_level,
exact_match_level,
jaccard_level,
jaro_level,
jaro_winkler_level,
levenshtein_level,
null_level,
)


class DuckDBComparisonProperties(DuckDBBase):
@property
def _exact_match_level(self):
return exact_match_level

@property
def _null_level(self):
return null_level

@property
def _else_level(self):
return else_level

@property
def _datediff_level(self):
return datediff_level

@property
def _array_intersect_level(self):
return array_intersect_level

@property
def _distance_in_km_level(self):
return distance_in_km_level

@property
def _levenshtein_level(self):
return levenshtein_level

@property
def _jaro_winkler_level(self):
return jaro_winkler_level

@property
def _jaccard_level(self):
return jaccard_level
from .duckdb_comparison_level_library import DuckDBComparisonProperties


class exact_match(DuckDBComparisonProperties, ExactMatchBase):
Expand All @@ -74,37 +21,37 @@ class distance_function_at_thresholds(
):
@property
def _distance_level(self):
return distance_function_level
return self._distance_function_level


class levenshtein_at_thresholds(
DuckDBComparisonProperties, LevenshteinAtThresholdsComparisonBase
):
@property
def _distance_level(self):
return levenshtein_level
return self._levenshtein_level


class jaro_at_thresholds(DuckDBComparisonProperties, JaroAtThresholdsComparisonBase):
@property
def _distance_level(self):
return jaro_level
return self._jaro_level


class jaro_winkler_at_thresholds(
DuckDBComparisonProperties, JaroWinklerAtThresholdsComparisonBase
):
@property
def _distance_level(self):
return jaro_winkler_level
return self._jaro_winkler_level


class jaccard_at_thresholds(
DuckDBComparisonProperties, JaccardAtThresholdsComparisonBase
):
@property
def _distance_level(self):
return jaccard_level
return self._jaccard_level


class array_intersect_at_sizes(
Expand Down
46 changes: 46 additions & 0 deletions splink/spark/spark_comparison_level_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,52 @@
)


class SparkComparisonProperties(SparkBase):
@property
def _exact_match_level(self):
return exact_match_level

@property
def _null_level(self):
return null_level

@property
def _else_level(self):
return else_level

@property
def _datediff_level(self):
return datediff_level

@property
def _array_intersect_level(self):
return array_intersect_level

@property
def _distance_in_km_level(self):
return distance_in_km_level

@property
def _distance_function_level(self):
return distance_function_level

@property
def _levenshtein_level(self):
return levenshtein_level

@property
def _jaro_level(self):
return jaro_level

@property
def _jaro_winkler_level(self):
return jaro_winkler_level

@property
def _jaccard_level(self):
return jaccard_level


class null_level(SparkBase, NullLevelBase):
pass

Expand Down
Loading