def normalize_resource_url(resource_url):
 try:
  (protocol, name) = split_resource_url(resource_url)
 except ValueError:
  protocol = u'nltk'
  name = resource_url
 if ((protocol == u'nltk') and os.path.isabs(name)):
  protocol = u'file://'
  name = normalize_resource_name(name, False, None)
 elif (protocol == u'file'):
  protocol = u'file://'
  name = normalize_resource_name(name, False, None)
 elif (protocol == u'nltk'):
  protocol = u'nltk:'
  name = normalize_resource_name(name, True)
 else:
  protocol += u'://'
 return u''.join([protocol, name])

def normalize_resource_url ( resource_url ) : try : ( protocol , name ) = split_resource_url ( resource_url ) except ValueError : protocol = u'nltk' name = resource_url if ( ( protocol == u'nltk' ) and os . path . isabs ( name ) ) : protocol = u'file://' name = normalize_resource_name ( name , False , None ) elif ( protocol == u'file' ) : protocol = u'file://' name = normalize_resource_name ( name , False , None ) elif ( protocol == u'nltk' ) : protocol = u'nltk:' name = normalize_resource_name ( name , True ) else : protocol += u'://' return u'' . join ( [ protocol , name ] )
normalizes a resource url .