def _group_arguments(tokens, predicate_positions, boundaries, labels):
    """
    Groups words pertaining to each argument and returns a dictionary for
    each predicate.
    """
    arg_structs = []
    for item in zip(predicate_positions, boundaries, labels):
        predicate_position, pred_boundaries, pred_labels = item
        structure = {}
        for token, boundary_tag in zip(tokens, pred_boundaries):
            if boundary_tag == 'O':
                continue
            elif boundary_tag == 'B':
                argument_tokens = [token]
            elif boundary_tag == 'I':
                argument_tokens.append(token)
            elif boundary_tag == 'E':
                argument_tokens.append(token)
                tag = pred_labels.pop(0)
                structure[tag] = argument_tokens
            else:
                tag = pred_labels.pop(0)
                structure[tag] = [token]
        predicate = tokens[predicate_position]
        arg_structs.append((predicate, structure))
    return arg_structs
