Exemplo n.º 1
0
def test_reorder():
    assert match.name_match('Renaissance Center Tower 300',
                            'Renaissance Center 300 Tower',
                            endings=['tower'])

    assert match.name_match('Renaissance Center Tower 300',
                            'Renaissance Center 300 Tower')
Exemplo n.º 2
0
def test_match_name_parish_church():
    osm = 'Church of St Peter & St Paul'
    wd = 'St Peter and St Paul, Bromley'
    assert match.name_match(osm, wd, ['church of'])

    osm = 'Bromley Parish Church of St Peter & St Paul'
    wd = 'St Peter and St Paul, Bromley'
    assert match.name_match(osm, wd, ['Parish Church of'])
Exemplo n.º 3
0
def test_name_match_trim_both():
    m = match.name_match('Oxmoor Mall', 'Oxmoor Center',
                          endings=['mall', 'center'])
    assert m.match_type.name == 'both_trimmed'

    m = match.name_match('Castle House', 'The Castle Inn',
                         endings=['house', 'inn'])
    assert m.match_type.name == 'both_trimmed'
Exemplo n.º 4
0
def test_name_with_dashes():
    wikidata = "Hôpital Saint-François d'Assise"
    osm = "Hôpital Saint-François-d'Assise"

    assert match.name_match(osm, wikidata)

    wikidata = 'Walton-on-the-Hill'
    osm = 'Walton on the Hill'

    assert match.name_match(osm, wikidata)
Exemplo n.º 5
0
def test_strip_words():
    osm = 'Rio de la Tetta'
    wd = 'Rio Tetta'

    assert match.name_match(osm, wd)

    osm = 'Holy Trinity Church'
    wd = 'Church Of The Holy Trinity'

    assert match.name_match(osm, wd, endings=['church'])
Exemplo n.º 6
0
def test_number_in_name():
    # https://www.wikidata.org/wiki/Q88276810
    n1 = 'Lake Number Ten'
    n2 = 'Lake No. 10'
    assert bool(match.name_match(n1, n2))
    assert bool(match.name_match(n2, n1))

    n1 = 'Test forty two'
    n2 = 'Test 42'
    assert bool(match.name_match(n1, n2))
    assert bool(match.name_match(n2, n1))
Exemplo n.º 7
0
def test_match_name_abbreviation():
    wikidata_names = [
        'Bishop Justus Church of England School',
        'Bishop Justus CE School',
    ]

    for wd in wikidata_names:
        assert match.name_match('Bishop Justus CofE School ', wd)

    osm = 'Mullard Radio Astronomy Observatory (MRAO)'
    wikidata = 'Mullard Radio Astronomy Observatory'
    assert match.name_match(osm, wikidata)
Exemplo n.º 8
0
def test_match_name_abbreviation():
    wikidata_names = [
        'Bishop Justus Church of England School',
        'Bishop Justus CE School',
    ]

    for wd in wikidata_names:
        assert match.name_match('Bishop Justus CofE School ', wd)

    assert match.name_match('St Peter', 'Saint Peter')
    assert match.name_match('Test Roman Catholic church', 'Test RC church')

    osm = 'Mullard Radio Astronomy Observatory (MRAO)'
    wikidata = 'Mullard Radio Astronomy Observatory'
    assert match.name_match(osm, wikidata)
Exemplo n.º 9
0
def test_match_with_place_names():
    osm = 'Hungarian house'
    wd = 'Hungarian House of New York'

    place_names = ['Manhattan', 'New York City', 'New York',
                   'United States of America']

    assert match.name_match(osm, wd, place_names=place_names)
Exemplo n.º 10
0
def test_name_match_trim_to_empty():
    osm = 'Hall'
    wd = 'Post Office'
    endings = ['hall', 'post office']

    assert not match.match_with_words_removed(osm.lower(), wd.lower(), endings)

    assert not match.name_match(osm, wd, endings=endings)
Exemplo n.º 11
0
def test_name_match_numbers():
    assert match.name_match('Manhattan Community Board 1',
                            'Manhattan Community Board 1')

    assert not match.name_match('Manhattan Community Board 11',
                                'Manhattan Community Board 1')

    assert not match.name_match('Manhattan Community Board 1',
                                'Manhattan Community Board 11')

    assert not match.name_containing_initials('Manhattan Community Board 1',
                                              'Manhattan Community Board 11')

    osm_tags = {
        'name': 'Manhattan Community Board 11',
    }
    wikidata_names = {
        '1-й общественный совет': [('label', 'ru')],
        'Manhattan Community Board 1': [('label', 'en'),
                                        ('sitelink', 'enwiki'),
                                        ('extract', 'enwiki')],
    }
    assert not match.check_for_match(osm_tags, wikidata_names)
Exemplo n.º 12
0
def test_ignore_apostrophe_s_in_match():
    osm = 'Augustine Steward House'
    wikidata = "Augustine Steward's House"
    cur = match.name_match(osm, wikidata)
    assert cur.match_type == match.MatchType.good
Exemplo n.º 13
0
def test_name_match_roman_catholic():
    assert match.name_match("St. Paul's Roman Catholic Church",
                            "St. Paul's Catholic Church")
Exemplo n.º 14
0
def test_name_match_initials_then_name():
    osm = 'RGC – Rainbow Grocery Coop'
    wd = 'Rainbow Grocery Coop'
    assert match.name_match(osm, wd)
Exemplo n.º 15
0
def test_strict_stable_name_match():
    assert not match.name_match('Nazeing Park',
                                'Stable At Nazeing Park',
                                endings=['stable'])
Exemplo n.º 16
0
def test_name_starts_with_the_old():
    assert match.name_match('The Old Rectory', 'The Rectory')
Exemplo n.º 17
0
def test_name_match_dash_and_both_trim():
    n1 = 'Sint Pieters Museum'
    n2 = 'Museum Sint-Pieters'
    assert match.name_match(n1, n2, endings=['museum'])
Exemplo n.º 18
0
def test_no_trim_s_on_single_term_name():
    osm = 'Boots'
    wd = 'The Boot Inn'

    assert not match.name_match(osm, wd, endings=['inn'])
Exemplo n.º 19
0
def test_name_match():
    assert not match.name_match('', '')
    assert match.name_match('test', 'test')
    assert match.name_match('the old shop', 'old shop')

    assert not match.name_match('test', '')
    assert not match.name_match('', 'test')
    assert match.name_match('test', 'test.')
    assert match.name_match('test.', 'test')

    assert not match.name_match('test', '.')
    assert not match.name_match('.', 'test')

    assert not match.name_match('aaa', 'bbb')

    assert not match.name_match('aaa', 'the ')

    assert match.name_match('aaa-bbb', 'aaa bbb')
    assert match.name_match('the old shop', 'old shop')
    assert match.name_match('the bull', 'bull public house',
                            ['public house'])
    assert match.name_match('TIAT', 'This Is A Test')

    assert match.name_match('John Smith', 'Statue of John Smith')
    assert match.name_match('John Smith', 'Tomb of John Smith')

    assert match.name_match('Lake Test', 'Test', ['lake'])
    assert match.name_match('Test', 'Lake Test', ['lake'])

    assert match.name_match('Test', 'Test, Washington, DC')

    assert match.name_match('aaa bbb', 'bbb aaa')

    assert match.name_match('Vif', 'gare de Vif', endings=['gare'])
    assert match.name_match('Vif', 'station Vif', endings=['station'])

    assert match.name_match('Sliabh Liag', 'Sliabh a Liag')

    assert match.name_match('Beulah', 'Beulah, Powys')
    assert match.name_match('Four Crosses', 'Four Crosses, Powys') is not None

    assert match.name_match('The Ship', "'The Ship', Derriford")
    assert match.name_match('Place Bellecour', ' La Place Bellecour')

    assert match.name_match('Lamott', 'La Mott, Pennsylvania')

    assert match.name_match('Ті-Ді гарден', 'Թի Դի Գարդեն')
    assert match.name_match('Maria-Hilf-Kirche', 'Mariahilfkirche, Munich')
    assert match.name_match('Kunkelspass', 'Кункелспас') is not None
    assert match.name_match('Bethanien-Kirche', 'Bethanienkirche, Berlin')
    assert match.name_match('Tricketts Cross', "Trickett's Cross, Dorset")
    assert match.name_match('Кастелец', 'Кастелець')

    assert match.name_match('Church and 18th Street', 'Church Street & 18th Street')
    assert match.name_match('Church and 18th Street',
                            'Church Street & 18th Street', endings={'test'})

    assert match.name_match('Boulder Railroad Depot (Historic)',
                            'Boulder Railroad Depot')

    assert match.name_match('Times Furnishing', 'Times Furnishing Company Building')

    assert match.name_match('Bailiffscourt Hotel And Country Club',
                            'Bailiffscourt Hotel') is not None

    osm = 'St Peter & St Paul'
    wd = 'St Peter and St Paul, Bromley'
    assert match.name_match(osm, wd)

    osm = 'New York Skyports Incorporated Seaplane Base'
    wikidata = 'New York Skyports Inc. Seaplane Base'
    assert match.name_match(osm, wikidata)

    osm = 'Disneyland Pacific Hotel; Pacific Hotel'
    wikidata = 'Disneyland Pacific Hotel'
    assert match.name_match(osm, wikidata)

    osm = 'Leeds Bradford International'
    wikidata = 'Leeds Bradford International Airport'
    trim = ['airport', 'international airport']
    assert match.name_match(osm, wikidata, endings=trim)

    osm = 'Bresso'
    wikidata = 'Aeroporto di Bresso'
    trim = ['aeroporto']
    assert match.name_match(osm, wikidata, endings=trim)

    assert match.name_match('Rainbow Grocery Coop',
                            'Rainbow Grocery Cooperative')

    assert match.name_match('Kirkwood Inn', "Kirkwood's", endings=['inn'])

    osm = 'ESCOLA DE NAUTICA DE BARCELONA'
    wikidata = 'Escola de Nàutica de Barcelona'

    cur = match.name_match(osm, wikidata)
    assert cur.match_type == match.MatchType.good

    osm = 'Lombard Buildings'
    wikidata = 'Lombard Building'

    cur = match.name_match(osm, wikidata, endings=['building'])
    assert cur.match_type == match.MatchType.good

    assert match.name_match('Boxers', 'The Boxers')

    osm = 'The Landers'
    wikidata = 'Landers Theatre'

    assert match.name_match('The Landers', 'Landers Theatre', endings=['theatre'])

    osm = 'Main Street Station'
    wikidata = 'Richmond Main Street Station'
    place_names = {'Richmond City', 'Virginia'}

    assert match.name_match(osm, wikidata, place_names=place_names)

    osm = 'Manor Buildings'
    wikidata = 'Manor House Buildings'
    assert match.name_match(osm, wikidata, endings={'house'})

    assert match.name_match('site of Pegwell Lodge', 'Pegwell Lodge')

    n1 = 'City of Birmingham Symphony Orchestra'
    n2 = 'CBSO Centre'
    assert match.name_match(n1, n2)

    osm = 'Wabasca Indian Reserve #166'
    wikidata = 'Wabasca 166'
    assert match.name_match(osm, wikidata, endings={'Indian reserve'})
Exemplo n.º 20
0
def test_church_names():
    name = "St John's Church"
    assert match.name_match(name, name + ' And Attached Railings')

    assert match.name_match('Church building', 'Church')
    assert match.name_match('Church', 'Church building')

    osm = "St. Michael's Church"
    wikidata = 'Church Of St Michael'

    trim = ['church', 'church of']
    assert match.name_match(osm, wikidata, endings=trim)

    osm = 'Saint Vitus Catholic Church'
    wikidata = "St. Vitus's Church, Cleveland"
    trim = ['church', 'church of', 'catholic church', 'rc church']
    place_names = {'Cleveland', 'Cuyahoga County', 'Ohio'}

    assert match.name_match(osm, wikidata, endings=trim, place_names=place_names)

    assert match.name_match("St. Paul's Roman Catholic Church",
                            "St. Paul's Catholic Church")

    assert match.name_match('St Peter', 'Saint Peter')
    assert match.name_match('Test Roman Catholic church', 'Test RC church')

    assert match.name_match('Church of Ss Peter and Paul',
                            "St Peter and St Paul's Church",
                            endings=['church', 'church of'])

    assert match.name_match('Church of Ss Peter and Paul',
                            "St Peter and St Paul's Church",
                            endings=['church', 'church of'])

    assert match.name_match('Michaelstow Church',
                            'Michaelstow DSC 8243',
                            endings=['church', 'church of'])

    assert match.name_match('Saint Edmund and Saint George',
                            'Church of St Edmund and George',
                            endings=['church', 'church of', 'st'])

    assert match.name_match('Parish Church of St Mary',
                            'St Mary the Virgin',
                            endings=['parish church', 'church'])

    assert match.name_match('St John the Evangelist parish church',
                            'Parish Church of St John, the Evangelist',
                            endings=['parish church', 'parish', 'church'])

    assert match.name_match('St Mary and St Edmund',
                            'Church of St Edmund and St Mary',
                            endings=['parish church', 'parish', 'church', 'church of'])
Exemplo n.º 21
0
def test_match_with_missing_house_number():
    assert match.name_match('1-3 Rectory Cottages', 'Rectory Cottages')
Exemplo n.º 22
0
def test_at_symbol_match():
    a = 'HEB Center @ Cedar Park'
    b = 'H-E-B Center at Cedar Park'
    assert match.name_match(a, b)
    assert match.name_match(b, a)
Exemplo n.º 23
0
def test_strip_place_name():
    osm = 'Danmarks ambassade'
    wd = 'Danmarks ambassade i Oslo'

    assert match.name_match(osm, wd, place_names=['Oslo'])
Exemplo n.º 24
0
def test_street_address():
    assert not match.name_match('17 Mill Lane', '1, Mill Lane')

    assert match.name_match('110 Livingston', '110 Livingston Street')
    assert not match.name_match('Livingston', 'Livingston Street')
Exemplo n.º 25
0
def test_name_match_church():
    n1 = "St Andrew"
    n2 = "St Andrew's Church"
    assert match.name_match(n1, n2, endings=['church'])
Exemplo n.º 26
0
def test_name_match():
    assert not match.name_match('', '')
    assert match.name_match('test', 'test')
    assert match.name_match('the old shop', 'old shop')

    assert not match.name_match('test', '')
    assert not match.name_match('', 'test')
    assert match.name_match('test', 'test.')
    assert match.name_match('test.', 'test')

    assert not match.name_match('test', '.')
    assert not match.name_match('.', 'test')

    assert not match.name_match('aaa', 'bbb')

    assert not match.name_match('aaa', 'the ')

    assert match.name_match('aaa-bbb', 'aaa bbb')
    assert match.name_match('the old shop', 'old shop')
    assert match.name_match('the bull', 'bull public house',
                            ['public house'])
    assert match.name_match('TIAT', 'This Is A Test')

    assert match.name_match('John Smith', 'Statue of John Smith')
    assert match.name_match('John Smith', 'Tomb of John Smith')

    name = "St John's Church"
    assert match.name_match(name, name + ' And Attached Railings')

    assert match.name_match('Church building', 'Church')
    assert match.name_match('Church', 'Church building')

    assert match.name_match('Lake Test', 'Test', ['lake'])
    assert match.name_match('Test', 'Lake Test', ['lake'])

    assert match.name_match('Test', 'Test, Washington, DC')

    assert match.name_match('aaa bbb', 'bbb aaa')

    assert match.name_match('Vif', 'gare de Vif', endings=['gare'])
    assert match.name_match('Vif', 'station Vif', endings=['station'])

    osm = 'St Peter & St Paul'
    wd = 'St Peter and St Paul, Bromley'
    assert match.name_match(osm, wd)

    osm = 'New York Skyports Incorporated Seaplane Base'
    wikidata = 'New York Skyports Inc. Seaplane Base'
    assert match.name_match(osm, wikidata)

    osm = 'Disneyland Pacific Hotel; Pacific Hotel'
    wikidata = 'Disneyland Pacific Hotel'
    assert match.name_match(osm, wikidata)

    osm = 'Leeds Bradford International'
    wikidata = 'Leeds Bradford International Airport'
    trim = ['airport', 'international airport']
    assert match.name_match(osm, wikidata, endings=trim)

    osm = 'Bresso'
    wikidata = 'Aeroporto di Bresso'
    trim = ['aeroporto']
    assert match.name_match(osm, wikidata, endings=trim)

    assert match.name_match('Rainbow Grocery Coop',
                            'Rainbow Grocery Cooperative')

    assert match.name_match('Kirkwood Inn', "Kirkwood's", endings=['inn'])

    osm = 'ESCOLA DE NAUTICA DE BARCELONA'
    wikidata = 'Escola de Nàutica de Barcelona'

    cur = match.name_match(osm, wikidata)
    assert cur.match_type == match.MatchType.good

    osm = 'Lombard Buildings'
    wikidata = 'Lombard Building'

    cur = match.name_match(osm, wikidata, endings=['building'])
    assert cur.match_type == match.MatchType.good

    assert match.name_match('Boxers', 'The Boxers')

    osm = 'The Landers'
    wikidata = 'Landers Theatre'

    assert match.name_match('The Landers', 'Landers Theatre', endings=['theatre'])

    osm = "St. Michael's Church"
    wikidata = 'Church Of St Michael'

    trim = ['church', 'church of']
    assert match.name_match(osm, wikidata, endings=trim)

    osm = 'Saint Vitus Catholic Church'
    wikidata = "St. Vitus's Church, Cleveland"
    trim = ['church', 'church of', 'catholic church', 'rc church']
    place_names = {'Cleveland', 'Cuyahoga County', 'Ohio'}

    assert match.name_match(osm, wikidata, endings=trim, place_names=place_names)

    osm = 'Main Street Station'
    wikidata = 'Richmond Main Street Station'
    place_names = {'Richmond City', 'Virginia'}

    assert match.name_match(osm, wikidata, place_names=place_names)

    osm = 'Manor Buildings'
    wikidata = 'Manor House Buildings'
    assert match.name_match(osm, wikidata)

    assert match.name_match('site of Pegwell Lodge', 'Pegwell Lodge')