Fix capitalization of "as" as part of a name.

develop
Sven Slootweg 9 years ago
parent e307a9179e
commit bc757687c3

@ -1046,8 +1046,10 @@ def reverse_name_comma(name):
first_segment = name_segments.pop()
return first_segment + " " + ', '.join(name_segments)
def normalize_word(word, abbreviation_threshold=4, lowercase_domains=True):
if is_known_abbreviation(word):
def normalize_word(word, abbreviation_threshold=4, lowercase_domains=True, never_abbreviations=[]):
if word.lower() in never_abbreviations:
return word.capitalize()
elif is_known_abbreviation(word):
return get_known_abbreviation(word)
elif not is_abbreviation(word, abbreviation_threshold):
return word.capitalize()
@ -1075,7 +1077,7 @@ def normalize_name(value, abbreviation_threshold=4, length_threshold=8, lowercas
if len(words) >= 3:
# Words between the first and last
for word in words[1:-1]:
normalized_words.append(normalize_word(word, abbreviation_threshold=abbreviation_threshold, lowercase_domains=lowercase_domains))
normalized_words.append(normalize_word(word, abbreviation_threshold=abbreviation_threshold, lowercase_domains=lowercase_domains, never_abbreviations=('as',)))
if len(words) >= 2:
# Last word
normalized_words.append(normalize_word(words[-1], abbreviation_threshold=abbreviation_threshold, lowercase_domains=lowercase_domains))

@ -1 +1 @@
{"status": ["clientTransferProhibited https://www.icann.org/epp#clientTransferProhibited"], "updated_date": ["2015-03-09T06:57:22"], "contacts": {"admin": {"city": "Cottage Grove", "name": "Andrew Pietila", "state": "Minnesota", "phone": "+1.6519640898", "street": "7555\nLangley Ave S", "country": "United States", "postalcode": "55016", "organization": "Star AS A Service LLC.", "email": "the@ubernerd.us"}, "tech": {"city": "Cottage Grove", "name": "Andrew Pietila", "state": "Minnesota", "phone": "+1.6519640898", "street": "7555\nLangley Ave S", "country": "United States", "postalcode": "55016", "organization": "Star AS A Service LLC.", "email": "the@ubernerd.us"}, "registrant": {"city": "Cottage Grove", "name": "Andrew Pietila", "state": "Minnesota", "phone": "+1.6519640898", "street": "7555\nLangley Ave S", "country": "United States", "postalcode": "55016", "organization": "Star AS A Service LLC.", "email": "the@ubernerd.us"}, "billing": null}, "nameservers": ["dan.ns.cloudflare.com", "zoe.ns.cloudflare.com"], "expiration_date": ["2016-03-14T01:24:05"], "emails": ["abuse@enom.com"], "raw": ["\n\nDomain Name: STARASASERVICE.COM\nRegistry Domain ID: 1850405869_DOMAIN_COM-VRSN\nRegistrar WHOIS Server: whois.enom.com\nRegistrar URL: www.enom.com\nUpdated Date: 2015-03-09T06:57:22.00Z\nCreation Date: 2014-03-14T01:24:00.00Z\nRegistrar Registration Expiration Date: 2016-03-14T01:24:05.00Z\nRegistrar: ENOM, INC.\nRegistrar IANA ID: 48\nReseller: NAMECHEAP.COM\nDomain Status: clientTransferProhibited https://www.icann.org/epp#clientTransferProhibited\nRegistry Registrant ID: \nRegistrant Name: ANDREW PIETILA\nRegistrant Organization: STAR AS A SERVICE LLC.\nRegistrant Street: 7555\nRegistrant Street: LANGLEY AVE S\nRegistrant City: COTTAGE GROVE\nRegistrant State/Province: MN\nRegistrant Postal Code: 55016\nRegistrant Country: US\nRegistrant Phone: +1.6519640898\nRegistrant Phone Ext: \nRegistrant Fax: \nRegistrant Fax Ext:\nRegistrant Email: THE@UBERNERD.US\nRegistry Admin ID: \nAdmin Name: ANDREW PIETILA\nAdmin Organization: STAR AS A SERVICE LLC.\nAdmin Street: 7555\nAdmin Street: LANGLEY AVE S\nAdmin City: COTTAGE GROVE\nAdmin State/Province: MN\nAdmin Postal Code: 55016\nAdmin Country: US\nAdmin Phone: +1.6519640898\nAdmin Phone Ext: \nAdmin Fax: \nAdmin Fax Ext:\nAdmin Email: THE@UBERNERD.US\nRegistry Tech ID: \nTech Name: ANDREW PIETILA\nTech Organization: STAR AS A SERVICE LLC.\nTech Street: 7555\nTech Street: LANGLEY AVE S\nTech City: COTTAGE GROVE\nTech State/Province: MN\nTech Postal Code: 55016\nTech Country: US\nTech Phone: +1.6519640898\nTech Phone Ext: \nTech Fax: \nTech Fax Ext: \nTech Email: THE@UBERNERD.US\nName Server: DAN.NS.CLOUDFLARE.COM\nName Server: ZOE.NS.CLOUDFLARE.COM\nDNSSEC: unSigned\nRegistrar Abuse Contact Email: abuse@enom.com\nRegistrar Abuse Contact Phone: +1.4252982646\nURL of the ICANN WHOIS Data Problem Reporting System: http://wdprs.internic.net/\nLast update of WHOIS database: 2015-03-09T06:57:22.00Z\n\nThe data in this whois database is provided to you for information\npurposes only, that is, to assist you in obtaining information about or\nrelated to a domain name registration record. We make this information\navailable \"as is,\" and do not guarantee its accuracy. By submitting a\nwhois query, you agree that you will use this data only for lawful\npurposes and that, under no circumstances will you use this data to: (1)\nenable high volume, automated, electronic processes that stress or load\nthis whois database system providing you this information; or (2) allow,\nenable, or otherwise support the transmission of mass unsolicited,\ncommercial advertising or solicitations via direct mail, electronic\nmail, or by telephone. The compilation, repackaging, dissemination or\nother use of this data is expressly prohibited without prior written\nconsent from us. \n\nWe reserve the right to modify these terms at any time. By submitting \nthis query, you agree to abide by these terms.\nVersion 6.3 4/3/2002\n", " Domain Name: STARASASERVICE.COM\n Registrar: ENOM, INC.\n Sponsoring Registrar IANA ID: 48\n Whois Server: whois.enom.com\n Referral URL: http://www.enom.com\n Name Server: DAN.NS.CLOUDFLARE.COM\n Name Server: ZOE.NS.CLOUDFLARE.COM\n Status: clientTransferProhibited http://www.icann.org/epp#clientTransferProhibited\n Updated Date: 10-mar-2015\n Creation Date: 14-mar-2014\n Expiration Date: 14-mar-2016\n"], "whois_server": ["whois.enom.com"], "registrar": ["Enom, Inc."], "creation_date": ["2014-03-14T01:24:00"], "id": ["1850405869_DOMAIN_COM-VRSN"]}
{"status": ["clientTransferProhibited https://www.icann.org/epp#clientTransferProhibited"], "updated_date": ["2015-03-09T06:57:22"], "contacts": {"admin": {"city": "Cottage Grove", "name": "Andrew Pietila", "state": "Minnesota", "phone": "+1.6519640898", "street": "7555\nLangley Ave S", "country": "United States", "postalcode": "55016", "organization": "Star As A Service LLC.", "email": "the@ubernerd.us"}, "tech": {"city": "Cottage Grove", "name": "Andrew Pietila", "state": "Minnesota", "phone": "+1.6519640898", "street": "7555\nLangley Ave S", "country": "United States", "postalcode": "55016", "organization": "Star As A Service LLC.", "email": "the@ubernerd.us"}, "registrant": {"city": "Cottage Grove", "name": "Andrew Pietila", "state": "Minnesota", "phone": "+1.6519640898", "street": "7555\nLangley Ave S", "country": "United States", "postalcode": "55016", "organization": "Star As A Service LLC.", "email": "the@ubernerd.us"}, "billing": null}, "nameservers": ["dan.ns.cloudflare.com", "zoe.ns.cloudflare.com"], "expiration_date": ["2016-03-14T01:24:05"], "emails": ["abuse@enom.com"], "raw": ["\n\nDomain Name: STARASASERVICE.COM\nRegistry Domain ID: 1850405869_DOMAIN_COM-VRSN\nRegistrar WHOIS Server: whois.enom.com\nRegistrar URL: www.enom.com\nUpdated Date: 2015-03-09T06:57:22.00Z\nCreation Date: 2014-03-14T01:24:00.00Z\nRegistrar Registration Expiration Date: 2016-03-14T01:24:05.00Z\nRegistrar: ENOM, INC.\nRegistrar IANA ID: 48\nReseller: NAMECHEAP.COM\nDomain Status: clientTransferProhibited https://www.icann.org/epp#clientTransferProhibited\nRegistry Registrant ID: \nRegistrant Name: ANDREW PIETILA\nRegistrant Organization: STAR AS A SERVICE LLC.\nRegistrant Street: 7555\nRegistrant Street: LANGLEY AVE S\nRegistrant City: COTTAGE GROVE\nRegistrant State/Province: MN\nRegistrant Postal Code: 55016\nRegistrant Country: US\nRegistrant Phone: +1.6519640898\nRegistrant Phone Ext: \nRegistrant Fax: \nRegistrant Fax Ext:\nRegistrant Email: THE@UBERNERD.US\nRegistry Admin ID: \nAdmin Name: ANDREW PIETILA\nAdmin Organization: STAR AS A SERVICE LLC.\nAdmin Street: 7555\nAdmin Street: LANGLEY AVE S\nAdmin City: COTTAGE GROVE\nAdmin State/Province: MN\nAdmin Postal Code: 55016\nAdmin Country: US\nAdmin Phone: +1.6519640898\nAdmin Phone Ext: \nAdmin Fax: \nAdmin Fax Ext:\nAdmin Email: THE@UBERNERD.US\nRegistry Tech ID: \nTech Name: ANDREW PIETILA\nTech Organization: STAR AS A SERVICE LLC.\nTech Street: 7555\nTech Street: LANGLEY AVE S\nTech City: COTTAGE GROVE\nTech State/Province: MN\nTech Postal Code: 55016\nTech Country: US\nTech Phone: +1.6519640898\nTech Phone Ext: \nTech Fax: \nTech Fax Ext: \nTech Email: THE@UBERNERD.US\nName Server: DAN.NS.CLOUDFLARE.COM\nName Server: ZOE.NS.CLOUDFLARE.COM\nDNSSEC: unSigned\nRegistrar Abuse Contact Email: abuse@enom.com\nRegistrar Abuse Contact Phone: +1.4252982646\nURL of the ICANN WHOIS Data Problem Reporting System: http://wdprs.internic.net/\nLast update of WHOIS database: 2015-03-09T06:57:22.00Z\n\nThe data in this whois database is provided to you for information\npurposes only, that is, to assist you in obtaining information about or\nrelated to a domain name registration record. We make this information\navailable \"as is,\" and do not guarantee its accuracy. By submitting a\nwhois query, you agree that you will use this data only for lawful\npurposes and that, under no circumstances will you use this data to: (1)\nenable high volume, automated, electronic processes that stress or load\nthis whois database system providing you this information; or (2) allow,\nenable, or otherwise support the transmission of mass unsolicited,\ncommercial advertising or solicitations via direct mail, electronic\nmail, or by telephone. The compilation, repackaging, dissemination or\nother use of this data is expressly prohibited without prior written\nconsent from us. \n\nWe reserve the right to modify these terms at any time. By submitting \nthis query, you agree to abide by these terms.\nVersion 6.3 4/3/2002\n", " Domain Name: STARASASERVICE.COM\n Registrar: ENOM, INC.\n Sponsoring Registrar IANA ID: 48\n Whois Server: whois.enom.com\n Referral URL: http://www.enom.com\n Name Server: DAN.NS.CLOUDFLARE.COM\n Name Server: ZOE.NS.CLOUDFLARE.COM\n Status: clientTransferProhibited http://www.icann.org/epp#clientTransferProhibited\n Updated Date: 10-mar-2015\n Creation Date: 14-mar-2014\n Expiration Date: 14-mar-2016\n"], "whois_server": ["whois.enom.com"], "registrar": ["Enom, Inc."], "creation_date": ["2014-03-14T01:24:00"], "id": ["1850405869_DOMAIN_COM-VRSN"]}
Loading…
Cancel
Save