J535D165 / recordlinkage

A powerful and modular toolkit for record linkage and duplicate detection in Python
http://recordlinkage.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
966 stars 152 forks source link

automatically check how many components are defined in rl.Compare() #201

Open bergen288 opened 11 months ago

bergen288 commented 11 months ago

I have the following function to define recordlinkage indexer and comparer. there are 2 components define by rl_comparer.exact and rl_comparer.string and I have to manually define 'component_number' as 2. Is there a way to automatically check how many components are defined and set it as 'component_number' in return set?

def rl_config_wex():
    rl_indexer = rl.Index()
    rl_comparer = rl.Compare()
    rl_indexer.block('postal_code')
    rl_comparer.exact('street_number', 'street_number', label="street_number")
    rl_comparer.string('street_name', 'street_name', threshold=0.8, label="street_name")
    return {'rl_indexer': rl_indexer, 'rl_comparer': rl_comparer, 'component_number': 2}