/**
   * The result starts out as a deep copy of left (so it inherits things like left's id and metadata
   * on things which can't be unioned like sections and sentences), and then annotations from right
   * are added.
   */
  public MergeTokenAlignedCommunications(Communication left, Communication right) {
    this.union = new Communication(left);
    int nsection = left.getSectionListSize();
    if (nsection != right.getSectionListSize())
      throw new IllegalArgumentException(
          "left has " + nsection + " sections but right has " + right.getSectionListSize());

    for (int i = 0; i < nsection; i++) {
      Section sl = left.getSectionList().get(i);
      Section sr = right.getSectionList().get(i);
      MergedSection m;
      try {
        m = new MergedSection(sl, sr);
      } catch (IllegalArgumentException e) {
        throw new IllegalArgumentException("in section " + i, e);
      }
      union.getSectionList().set(i, m.getUnion());
    }
  }