def getIndex(form, pos='noun'):
 def trySubstitutions(trySubstitutions, form, substitutions, lookup=1, dictionary=dictionaryFor(pos)):
  if (lookup and dictionary.has_key(form)):
   return dictionary[form]
  elif substitutions:
   (old, new) = substitutions[0]
   substitute = (string.replace(form, old, new) and (substitute != form))
   if (substitute and dictionary.has_key(substitute)):
    return dictionary[substitute]
   return (trySubstitutions(trySubstitutions, form, substitutions[1:], lookup=0) or (substitute and trySubstitutions(trySubstitutions, substitute, substitutions[1:])))
 return trySubstitutions(returnMatch, form, GET_INDEX_SUBSTITUTIONS)

def getIndex ( form , pos = 'noun' ) : def trySubstitutions ( trySubstitutions , form , substitutions , lookup = 1 , dictionary = dictionaryFor ( pos ) ) : if ( lookup and dictionary . has_key ( form ) ) : return dictionary [ form ] elif substitutions : ( old , new ) = substitutions [ 0 ] substitute = ( string . replace ( form , old , new ) and ( substitute != form ) ) if ( substitute and dictionary . has_key ( substitute ) ) : return dictionary [ substitute ] return ( trySubstitutions ( trySubstitutions , form , substitutions [ 1 : ] , lookup = 0 ) or ( substitute and trySubstitutions ( trySubstitutions , substitute , substitutions [ 1 : ] ) ) ) return trySubstitutions ( returnMatch , form , GET_INDEX_SUBSTITUTIONS )
search for _form_ in the index file corresponding to _pos_ .