code: def compute_similarity_score(self, unit1, unit2):
          if self.type == "PHONETIC":
              word1 = unit1.phonetic_representation
              word2 = unit2.phonetic_representation
              if self.current_similarity_measure == "phone":
                  word1_length, word2_length = len(word1), len(word2)
                  if word1_length > word2_length:
                      word1, word2 = word2, word1
                      word1_length, word2_length = word2_length, word1_length
                  current = range(word1_length + 1)
                  for i in range(1, word2_length + 1):
                      previous, current = current, [i] + [0] * word1_length
                      for j in range(1, word1_length + 1):
                          add, delete = previous[j] + 1, current[j - 1] + 1
                          change = previous[j - 1]
                          if word1[j - 1] != word2[i - 1]:
                              change += 1
                          current[j] = min(add, delete, change)
                  phonetic_similarity_score = 1 - current[word1_length] / word2_length
                  return phonetic_similarity_score
              elif self.current_similarity_measure == "biphone":
                  if word1[:2] == word2[:2] or word1[-2:] == word2[-2:]:
                      common_biphone_score = 1
                  else:
                      common_biphone_score = 0
                  return common_biphone_score
          elif self.type == "SEMANTIC":
              word1 = unit1.text
              word2 = unit2.text
              if self.current_similarity_measure == "lsa":
                  w1_vec = self.term_vectors[word1]
                  w2_vec = self.term_vectors[word2]
                  dot = sum([w1*w2 for w1,w2 in zip(w1_vec, w2_vec)])
                  norm1 = sqrt(sum([w*w for w in w1_vec]))
                  norm2 = sqrt(sum([w*w for w in w2_vec]))
                  semantic_relatedness_score =  dot/(norm1 * norm2)
                  return semantic_relatedness_score
              elif self.current_similarity_measure == "custom":
                  try:
                      similarity = self.custom_similarity_scores[(word1,word2)]
                  except KeyError:
                      try:
                          similarity = self.custom_similarity_scores[(word2,word1)]
                      except KeyError:
                          if word1 == word2:
                              return self.same_word_similarity
                          else:
                              return 0
                  return similarity
          return None