[fix] only replace whitespace between words, not for instance whitespace around an existing hyphen, and reducing to one space for spaced hyphens
This commit is contained in:
@@ -1224,8 +1224,8 @@ class AddressComponents(object):
|
|||||||
address_components.pop(AddressFormatter.HOUSE_NUMBER, None)
|
address_components.pop(AddressFormatter.HOUSE_NUMBER, None)
|
||||||
|
|
||||||
name_regex = re.compile('^[\s\-]*(.*?)[\s\-]*$')
|
name_regex = re.compile('^[\s\-]*(.*?)[\s\-]*$')
|
||||||
whitespace_regex = re.compile('[\s]+')
|
whitespace_regex = re.compile('(?<=[\w])[\s]+(?=[\w])')
|
||||||
hyphen_regex = re.compile('[\-]+')
|
hyphen_regex = re.compile('[\s]*[\-]+[\s]*')
|
||||||
|
|
||||||
def dehyphenate_multiword_name(self, name):
|
def dehyphenate_multiword_name(self, name):
|
||||||
return self.hyphen_regex.sub(six.u(' '), name)
|
return self.hyphen_regex.sub(six.u(' '), name)
|
||||||
|
|||||||
Reference in New Issue
Block a user