예제 #1
0
  /**
   * Load configuration (only used by constructor)
   *
   * @param config
   */
  private void loadConfiguration(MeteorConfiguration config) {
    language = config.getLanguage();
    langID = config.getLangID();
    setNormalize(config.getNormalization());
    ArrayList<Double> parameters = config.getParameters();
    alpha = parameters.get(0);
    beta = parameters.get(1);
    gamma = parameters.get(2);
    delta = parameters.get(3);
    moduleWeights = config.getModuleWeights();
    aligner =
        new Aligner(
            language,
            config.getModules(),
            config.getModuleWeights(),
            config.getBeamSize(),
            config.getWordDirURL(),
            config.getSynDirURL(),
            config.getParaDirURL(),
            // Best alignments for evaluation
            Constants.PARTIAL_COMPARE_TOTAL);

    // Best weights for evaluation
    ArrayList<Integer> modules = config.getModules();
    ArrayList<Double> setWeights = new ArrayList<Double>();
    for (int module : modules) {
      if (module == Constants.MODULE_EXACT) setWeights.add(1.0);
      else if (module == Constants.MODULE_STEM) setWeights.add(0.5);
      else if (module == Constants.MODULE_SYNONYM) setWeights.add(0.5);
      else setWeights.add(0.5);
    }
    aligner.updateModuleWeights(setWeights);
    charBased = config.getCharBased();
  }
예제 #2
0
 /**
  * Update module weights without reloading resources. This is used for tuning and is likely not
  * needed for most applications
  *
  * @param moduleWeights
  */
 public void updateModuleWeights(ArrayList<Double> moduleWeights) {
   aligner.updateModuleWeights(moduleWeights);
 }