Skip to content
Open
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
5 changes: 3 additions & 2 deletions dedupe/variables/name.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,20 @@ def __init__(self, definition) :
('Household', self.compareHouseholds,
FIRST_NAMES_A + LAST_NAMES_A,
FIRST_NAMES_B + LAST_NAMES_B))
block_parts = ('Surname',)
elif self.name_type == 'company':
self.components = (('Corporation', self.compareFields, CORPORATION),)
block_parts = ('CorporationName',)
elif self.name_type is None:
self.components = (('Person' , self.compareFields, PERSON),
('Household', self.compareHouseholds,
FIRST_NAMES_A + LAST_NAMES_A,
FIRST_NAMES_B + LAST_NAMES_B),
('Corporation', self.compareFields, CORPORATION))
block_parts = ('Surname', 'CorporationName')
else:
raise ValueError("valid values of name type are 'person' and 'company'")

block_parts = ('Surname', 'CorporationName')

super(WesternNameType, self).__init__(definition, probablepeople.tag, block_parts)


Expand Down
8 changes: 7 additions & 1 deletion tests/test_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ def test_person_type(self):
0, 1, 0, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0 ])

predicates_parts = (getattr(p, "part", None) for p in name.predicates)
assert not any(p == 'CorporationName' for p in predicates_parts)


def test_company_type(self):
name = WesternNameType({'field' : 'foo', 'name type' : 'company'})
print(name.comparator('James and Rita Allen',
Expand All @@ -52,7 +56,9 @@ def test_company_type(self):
0, 0, 0, 0, 0, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0])

predicates_parts = (getattr(p, "part", None) for p in name.predicates)
assert not any(p == 'Surname' for p in predicates_parts)



def prettyPrint(variable, comparison) :
Expand Down