dedupe icon indicating copy to clipboard operation
dedupe copied to clipboard

Using field type Set with tuple values generates TypeError in "canonical.py" getCentroid

Open matthewdchambers opened this issue 8 years ago • 1 comments

Believe this to be a bug, but it's possible I'm not understanding the functionality...

Working from the csv_example.py script with some minor modifications.

Comparing fields as follows, note Set for phones:

fields = [
    {'field': 'first_name', 'type': 'String'},
    {'field': 'middle_name', 'type': 'String'},
    {'field': 'last_name', 'type': 'String'},
    {'field': 'name_normalized', 'type': 'String'},
    {'field': 'address_string', 'type': 'Address'},
    {'field': 'phones', 'type': 'Set'}
]

dedupe.canonicalize parses other values but fails upon reaching the tuple of phone numbers in the format of:

(('2225551234',), ('2225554321,))

Traceback (most recent call last): File "/Users/foo/Documents/github/dedupe/main.py", line 187, in <module> canonical_rep = dedupe.canonicalize(cluster_d) File "/Users/foo/.local/share/virtualenvs/dedupe-rNl1qbU5/lib/python2.7/site-packages/dedupe/convenience.py", line 238, in canonicalize return getCanonicalRep(record_cluster) File "/Users/foo/.local/share/virtualenvs/dedupe-rNl1qbU5/lib/python2.7/site-packages/dedupe/canonical.py", line 67, in getCanonicalRep canonical_rep[key] = getCentroid(key_values, comparator) File "/Users/foo/.local/share/virtualenvs/dedupe-rNl1qbU5/lib/python2.7/site-packages/dedupe/canonical.py", line 19, in getCentroid distance = comparator(attribute_variants[i], attribute_variants[j])

TypeError: Argument 'string1' has incorrect type (expected basestring, got tuple)

matthewdchambers avatar Apr 18 '18 00:04 matthewdchambers

Right now canonicalize can only handle string input, dupe of #593 and #274

fgregg avatar Apr 30 '18 18:04 fgregg