Skip to content

klpickrell/entityresolution

Repository files navigation

Motivating example

Consider a csv file of various duplicated products with distinct identifiers only distinguishable as a duplicate by name. We would like to group products by some measure of similarity which defines particular similarities between strings as referring to the same entity. This is what this library does:

import csv
products = [ item for item in csv.DictReader( open( '/var/tmp/products.csv', 'rU' ), delimiter='^' ) ]
things = [ { k : ''.join(v.split()) for k,v in item.iteritems() if k == 'name' } for item in products ]
train_threshold = 600
run_threshold = 400
thresholds = [ train_threshold, run_threshold ]
all_clusters = cluster.cluster(things, thresholds)
write_report( '/var/tmp/product_clusters.csv', all_clusters[run_threshold], products, header=None )

Outputs for the primary auto-threshold

cluster, caption, title
0,"Metallic vases full of cream flowers adorned the mirrored tables, with crystal candelabras rising from them.",Romantic Candle Decor
0,"Metallic vases full of cream flowers adorned the mirrored tables, with crystal candelabras rising from them.",Romantic Candle Decor
1,"The groom wore a soft blush flower boutonniere with his powder blue, purple and pink tie.",Fresh Pink Boutonniere
1,"The groom wore a soft blush flower boutonniere with his powder blue, purple and pink tie.",Fresh Pink Boutonniere
2,A custom illustration of the Russian River Valley in gold thermography announced the destination vineyard wedding.,Rustic Invitation Card
2,A custom illustration of the Russian River Valley in gold thermography announced the destination vineyard wedding.,Rustic Invitation Card
3,"For a spring wedding, a few cherry blossoms were a must. Fleurs NYC delivered in a big way, creating standout arrangements. The mix of towering centerpieces with low, garden-inspired arrangements brought a touch of visual intrigue and drama to the room.",Tall Cherry Blossom Centerpieces
3,"The reception took place under a white tent set up on the lawn, where guests sat at long white-covered dining tables with tall arrangements of pink cherry blossoms decorating the middle.",Pink Cherry Blossom Centerpieces
4,"Lauren and Brian shared their first kiss at the wooden wedding arch, decorated in the middle with an arrangement of colorful spray roses, hydrangeas, garden roses and ranunculus mixed with greenery.",Wooden Wedding Arch With Flower Arrangement
4,"Mirroring the rustic feel of the venue, Desta and Benjamin filled the ceremony space with homey, organic touches. The pair exchanged vows under a handcrafted wooden arbor draped in lush green garlands and white blooms, with a Persian rug that belonged to Desta's grandmother under their feet. ""The aisle was lined on both sides by candles,"" Desta says. ""It looked really beautiful and cozy.""",Wooden Wedding Arch With Garlands
5,"In keeping with the mix-and-match style, some of the tables had floral china.",Vintage Place Settings
5,"Menu cards with silhouettes of a bride and groom added a vintage touch to the place settings, while bird's nests and eggs gave them a natural appeal.",Vintage Place Settings
6,Guests dined on seared sea bass and filet mignon while overlooking the Sarasota Bay. The couple chose the Ca d'Zan mansion for its elaborate detail and romantic view.,The Reception
6,Guests dined at rows of long tables under a canopy of trees strung with 300 pink paper lanterns.,The Reception
7,"The bridesmaids carried clusters of lush white peonies, soft blue hydrangeas, and touches of greenery.",The Bridesmaid Bouquet
7,The bridesmaids paired their soft yellow Coren Moore dresses with bouquets of pale roses and vibrant pops of yellow mums.,Bright Bridesmaid Bouquet
8,Seth matched his bride's bouquet with a single craspedia and an orange ranunculus.,Orange and Yellow Boutonniere
8,The guys wore cushion mums and bright-yellow billy balls on their lapels.,Orange and Yellow Boutonniere
9,"The bride carried a bouquet of red mokara orchids, mango calla lilies and green cymbidium orchids.",The Bridal Bouquet
9,"The bride carried a bouquet of textured flowers down the aisle, including blush dahlias, bay leaves and blueberries.",Textured Bridal Bouquet
10,"The bridesmaids wore steel-gray V-neck dresses, while the groomsmen matched in dark-gray merino wool suits and Hermes ties.",Lazaro Bridesmaid Dresses
10,"Determined to select a dress her girls could wear again, Abigail chose a simple, Empire-waist frock with a ruffled top and a saffron skirt.",Anthropologie Bridesmaid Dresses
10,"The bridesmaids wore mint dresses, while the guys matched the beachy look in light-gray suits.",Mint Bridesmaid Dresses
10,The bridesmaids wore yellow dresses from Anthropologie and kept their hair down for a relaxed look.,Anthropologie Bridesmaid Dresses
10,The bridesmaids wore silky taffeta dresses--either a pleated halter or strapless.,Pink Bridesmaid Dresses

About

Record linkage and entity resolution library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors