/**
   * Info.
   *
   * @param parameter the parameter
   * @param programName the program name
   * @throws IllegalArgumentException the illegal argument exception
   * @throws IllegalAccessException the illegal access exception
   * @throws InvocationTargetException the invocation target exception
   */
  public static void info(Parameter parameter, String programName)
      throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
    if (parameter.help) {
      logger.config(parameter.getSeparator2());
      logger.config("name = " + programName);
      logger.config(parameter.getSeparator());
      parameter.logShow();

      parameter.getParameterInputFeature().logAll(); // fInMask
      logger.config(parameter.getSeparator());
      parameter.getParameterSegmentationInputFile().logAll(); // sInMask
      parameter.getParameterSegmentationInputFile2().logAll(); // sInMask
      parameter.getParameterSegmentationOutputFile().logAll(); // sOutMask
      logger.config(parameter.getSeparator());
      parameter.getParameterDiarization().logAll();
      logger.config(parameter.getSeparator());
    }
  }
  /**
   * The main method.
   *
   * @param args the arguments
   */
  public static void main(String[] args) {
    try {
      SpkDiarizationLogger.setup();
      arguments = args;
      Parameter parameter = getParameter(args);
      if (args.length <= 1) {
        parameter.help = true;
      }
      parameter.logCmdLine(args);
      info(parameter, "Diarization");

      if (parameter.show.isEmpty() == false) {
        DiarizationTV diarizationTV = new DiarizationTV();
        if (parameter.getParameterDiarization().getSystem()
            == ParameterBNDiarization.SystemString[1]) {
          parameter
              .getParameterSegmentationSplit()
              .setSegmentMaximumLength(
                  (10 * parameter.getParameterSegmentationInputFile().getRate()));
        }
        if (parameter.getParameterDiarization().getThread() > 0) {
          logger.info("Diarization tuning");
          diarizationTV.tunEster2Corpus(parameter);
        } else {
          logger.info("Diarization BN");
          diarizationTV.ester2Version(parameter);
        }
      }
    } catch (DiarizationException e) {
      logger.log(Level.SEVERE, "Diarization error", e);
      e.printStackTrace();
    } catch (IOException e) {
      logger.log(Level.SEVERE, "IOExecption error", e);
      e.printStackTrace();
    } catch (Exception e) {
      logger.log(Level.SEVERE, "Execption error", e);
      e.printStackTrace();
    }
  }
 /**
  * Initialize.
  *
  * @param parameter the parameter
  * @return the cluster set
  * @throws DiarizationException the diarization exception
  * @throws Exception the exception
  */
 public ClusterSet initialize(Parameter parameter) throws DiarizationException, Exception {
   // ** get the first diarization
   logger.info("Initialize segmentation");
   ClusterSet clusterSet = null;
   if (parameter.getParameterDiarization().isLoadInputSegmentation()) {
     clusterSet = MainTools.readClusterSet(parameter);
     // seg IRIT
     // return clusterSet;
     // seg IRIT
   } else {
     clusterSet = new ClusterSet();
     Cluster cluster = clusterSet.createANewCluster("init");
     Segment segment =
         new Segment(
             parameter.show,
             0,
             1,
             cluster,
             parameter.getParameterSegmentationInputFile().getRate());
     cluster.addSegment(segment);
   }
   return clusterSet;
 }