/**
   * Save the dataset to the given stream.
   *
   * @param os an output stream to where the dataset is saved.
   */
  public void save(PrintStream ps) {
    for (int idxExample = 0; idxExample < getNumberOfExamples(); ++idxExample) {
      PQInput2 input = inputExamples[idxExample];
      PQOutput2 output = outputExamples[idxExample];

      // The sentence identifier string.
      ps.print(input.getId());

      int numberOfQuotations = input.getNumberOfQuotations();
      for (int quotationIdx = 0; quotationIdx < numberOfQuotations; ++quotationIdx) {
        // Quotation separator.
        ps.print("ยง");

        int numberOfCoreferences = input.getNumberOfCoreferences(quotationIdx);
        for (int coreferenceIdx = 0; coreferenceIdx < numberOfCoreferences; ++coreferenceIdx) {
          // Coreference features.
          for (int ftr : input.getFeatureCodes(quotationIdx, coreferenceIdx))
            ps.print(featureEncoding.getValueByCode(ftr) + " ");

          // Coreference separator.
          ps.print("\t");
        }

        // Quotation author.
        ps.println(featureEncoding.getValueByCode(output.getAuthor(quotationIdx)));
      }

      // Next line for the next example.
      ps.println();
    }
  }