def compareRecord(recA , recB, attr_comp_list):
  """Generate the similarity vector for the given record pair by comparing
     attribute values according to the comparison function and attribute
     numbers in the given attribute comparison list.

     Parameter Description:
       recA           : List of first record values for comparison
       recB           : List of second record values for comparison
       attr_comp_list : List of comparison methods for comparing attributes,
                        this needs to be a list of tuples where each tuple
                        contains: (comparison function, attribute number in
                        record A, attribute number in record B).

     This method returns a similarity vector with one value for each compared
     attribute.
  """

  sim_vec = []

  # Calculate a similarity for each attribute to be compared
  #
  for (comp_funct, attr_numA, attr_numB) in attr_comp_list:

    if (attr_numA >= len(recA)):  # Check there is a value for this attribute
      valA = ''
    else:
      valA = recA[attr_numA]

    if (attr_numB >= len(recB)):
      valB = ''
    else:
      valB = recB[attr_numB]

    valA = valA.lower()
    valB = valB.lower()

    sim = comp_funct(valA, valB)
    sim_vec.append(sim)

  return sim_vec