def process_comparisons(setup, comparisons):
  """Main function that parses the xlsx representation of the conducted

  pairwise comparisons and returns a convinient representation.

  Args:
    setup: setup dataframe (see readme)
    comparisons: raw comparison dataframe

  Returns:
    Convinient representation of pairwise comparisons.
  """

  pair = 0
  rows = []
  idx = 0

  num_pair = len(setup)

  while pair < num_pair:
    tmp_res = process_pair(idx, comparisons)
    left_model = setup.loc[pair][1]
    right_model = setup.loc[pair][2]
    key = setup.loc[pair][0]

    rows += [tmp_res[0] + [left_model, right_model, key]]
    idx = tmp_res[1]
    pair = tmp_res[0][0]

  df = pd.DataFrame(
      rows,
      columns=[
          'pair', 'numQA', 'accLeft', 'accRight', 'Ambiguity', 'Fluency',
          'Overall', 'leftModel', 'rightModel', 'key'
      ])

  df['accLeft'] = df['accLeft'] / df['numQA']
  df['accRight'] = df['accRight'] / df['numQA']

  return df
Main function that parses the xlsx representation of the conducted

  pairwise comparisons and returns a convinient representation.

  Args:
    setup: setup dataframe (see readme)
    comparisons: raw comparison dataframe

  Returns:
    Convinient representation of pairwise comparisons.
  
language/asqa/human_annotation/analysis.py