Example #1
0
 def test_find_name_prefix(self):
     name = 'Ard van der Steur'
     prefix, pos = Person.find_prefix(name)
     self.assertEqual(prefix, 'van der')
     name = 'Ard van derSteur'
     prefix, pos = Person.find_prefix(name)
     self.assertEqual(prefix, 'van')
     name = 'Ard van de Steur'
     prefix, pos = Person.find_prefix(name)
     self.assertEqual(prefix, 'van de')
     name = 'Ard van Steur'
     prefix, pos = Person.find_prefix(name)
     self.assertEqual(prefix, 'van')
     name = 'Gerard \'t Hooft'
     prefix, pos = Person.find_prefix(name)
     self.assertEqual(prefix, '\'t')
     name = 'Jan Peter Balkenende'
     prefix, pos = Person.find_prefix(name)
     self.assertEqual(prefix, '')
     name = 'Boris van der Ham'
     prefix, pos = Person.find_prefix(name)
     self.assertEqual(prefix, 'van der')
     name = 'van der Ham'
     prefix, pos = Person.find_prefix(name)
     self.assertEqual(prefix, 'van der')
     name = 'van derHam'
     prefix, pos = Person.find_prefix(name)
     self.assertEqual(prefix, 'van')
     name = 'von Martels'
     prefix, pos = Person.find_prefix(name)
     self.assertEqual(prefix, 'von')
Example #2
0
 def test_find_name_prefix(self):
     name = 'Ard van der Steur'
     prefix, pos = Person.find_prefix(name)
     self.assertEqual(prefix, 'van der')
     name = 'Ard van derSteur'
     prefix, pos = Person.find_prefix(name)
     self.assertEqual(prefix, 'van')
     name = 'Ard van de Steur'
     prefix, pos = Person.find_prefix(name)
     self.assertEqual(prefix, 'van de')
     name = 'Ard van Steur'
     prefix, pos = Person.find_prefix(name)
     self.assertEqual(prefix, 'van')
     name = 'Gerard \'t Hooft'
     prefix, pos = Person.find_prefix(name)
     self.assertEqual(prefix, '\'t')
     name = 'Jan Peter Balkenende'
     prefix, pos = Person.find_prefix(name)
     self.assertEqual(prefix, '')
     name = 'Boris van der Ham'
     prefix, pos = Person.find_prefix(name)
     self.assertEqual(prefix, 'van der')
     name = 'van der Ham'
     prefix, pos = Person.find_prefix(name)
     self.assertEqual(prefix, 'van der')
     name = 'van derHam'
     prefix, pos = Person.find_prefix(name)
     self.assertEqual(prefix, 'van')
     name = 'von Martels'
     prefix, pos = Person.find_prefix(name)
     self.assertEqual(prefix, 'von')
Example #3
0
def parse_name_surname_initials(name):
    name = remove_forename(name)
    name = name.replace(',', '')
    initials = find_initials(name)
    surname_prefix, pos = Person.find_prefix(name)
    surname = name.replace(surname_prefix, '').replace(initials, '').replace(',', '').strip()
    return initials, surname, surname_prefix
Example #4
0
def parse_name_surname_initials(name):
    name = remove_forename(name)
    name = name.replace(',', '')
    initials = find_initials(name)
    surname_prefix, pos = Person.find_prefix(name)
    surname = name.replace(surname_prefix, '').replace(initials, '').replace(',', '').strip()
    return initials, surname, surname_prefix