Example #1
0
def compare_fingerprints(left, right):
    result = 0
    left_list = ensure_list(left.get('fingerprints'))
    right_list = ensure_list(right.get('fingerprints'))
    for (left, right) in itertools.product(left_list, right_list):
        similarity = jaro(left, right)
        score = similarity * dampen(3, 20, min(left, right, key=len))
        result = max(result, score)
    return result
Example #2
0
def compare_names(left, right):
    result = 0
    left_list = [normalize(n, latinize=True) for n in left.names]
    right_list = [normalize(n, latinize=True) for n in right.names]
    for (left, right) in itertools.product(left_list, right_list):
        similarity = jaro(left, right)
        score = similarity * dampen(2, 20, shortest(left, right))
        result = max(result, score)
    return result
Example #3
0
def compare_names(left, right):
    result = 0
    left_list = list(_normalize_names(left.names))
    right_list = list(_normalize_names(right.names))
    for (left, right) in itertools.product(left_list, right_list):
        similarity = jaro(left, right)
        score = similarity * dampen(2, 20, shortest(left, right))
        result = max(result, score)
    return result
Example #4
0
 def specificity(self, value):
     # TODO: insert artificial intelligence here.
     return dampen(3, 50, value) * .8
Example #5
0
 def compare(self, left, right):
     prefix = os.path.commonprefix([left, right])
     return dampen(4, 10, prefix)
Example #6
0
 def specificity(self, value):
     return dampen(5, self.MAX_LENGTH, value) * .5
Example #7
0
 def _specificity(self, value):
     return dampen(4, 10, value)
Example #8
0
 def _specificity(self, value: str) -> float:
     # TODO: insert artificial intelligence here.
     return dampen(7, 11, value)
Example #9
0
 def _specificity(self, value: str) -> float:
     return dampen(10, 60, value)
Example #10
0
 def _specificity(self, value):
     # TODO: insert artificial intelligence here.
     return dampen(6, 11, value)
Example #11
0
 def _specificity(self, value):
     return dampen(5, 13, value)
Example #12
0
 def compare(self, left: str, right: str) -> float:
     prefix = os.path.commonprefix([left, right])
     return dampen(4, 10, prefix)
Example #13
0
 def _specificity(self, value: str) -> float:
     return dampen(5, 13, value)
Example #14
0
 def specificity(self, value):
     return dampen(10, 50, value) * .6