import re


def aggregate_alignments(align_tokens):
    """
    Parse the alignment file.

    Return:
      - s2t: a dict mapping source position to target position
      - t2s: a dict mapping target position to source position
    """
    s2t = {}
    t2s = {}
    # process alignments
    for align_token in align_tokens:
        if align_token == '':
            continue
        (src_pos, tgt_pos) = re.split('\-', align_token)
        src_pos = int(src_pos)
        tgt_pos = int(tgt_pos)
        if src_pos not in s2t:
            s2t[src_pos] = []
        s2t[src_pos].append(tgt_pos)

        if tgt_pos not in t2s:
            t2s[tgt_pos] = []
        t2s[tgt_pos].append(src_pos)

    return s2t, t2s