def singularize(word, pos=NOUN, gender=MALE, role=SUBJECT, custom={}):
 w = word.lower().capitalize()
 if (word in custom):
  return custom[word]
 if (word in singular):
  return singular[word]
 if (pos == NOUN):
  for (a, b) in singular_inflections:
   if w.endswith(a):
    return (w[:(- len(a))] + b)
  for suffix in ('nen', 'en', 'n', 'e', 'er', 's'):
   if w.endswith(suffix):
    w = w[:(- len(suffix))]
    break
  if w.endswith(('rr', 'rv', 'nz')):
   return (w + 'e')
  return w
 return w

def singularize ( word , pos = NOUN , gender = MALE , role = SUBJECT , custom = { } ) : w = word . lower ( ) . capitalize ( ) if ( word in custom ) : return custom [ word ] if ( word in singular ) : return singular [ word ] if ( pos == NOUN ) : for ( a , b ) in singular_inflections : if w . endswith ( a ) : return ( w [ : ( - len ( a ) ) ] + b ) for suffix in ( 'nen' , 'en' , 'n' , 'e' , 'er' , 's' ) : if w . endswith ( suffix ) : w = w [ : ( - len ( suffix ) ) ] break if w . endswith ( ( 'rr' , 'rv' , 'nz' ) ) : return ( w + 'e' ) return w return w
returns the singular of a given word .