Package net.sourceforge.align.ui.console.command.exception

Examples of net.sourceforge.align.ui.console.command.exception.MissingParameterException


  }

  protected void run(CommandLine commandLine) {
    String cls = commandLine.getOptionValue('c');
    if (cls == null) {
      throw new MissingParameterException("class");
    }

    Filter filter;
    if (cls.equals("galechurch")) {
      filter = new GaleAndChurchMacro();
View Full Code Here


 
  public void run(CommandLine commandLine) {
    try {
      String cls = commandLine.getOptionValue('c');
      if (cls == null) {
        throw new MissingParameterException("class");
      }
      List<Alignment> alignmentList = new ArrayList<Alignment>();
      if (cls.equals("al")) {
        if (commandLine.getArgs().length < 1) {
          throw new WrongArgumentCountException("1, 2, 3, ...", commandLine.getArgs().length);
View Full Code Here

  }
 
  public void run(CommandLine commandLine) {
    String cls = commandLine.getOptionValue('c');
    if (cls == null) {
      throw new MissingParameterException("class");
    }
    Formatter formatter;
    if (cls.equals("al")) {
      Writer writer = getSingleWriter(commandLine);
      formatter = new AlFormatter(writer);
    } else if (cls.equals("txt")) {
      if (commandLine.getArgs().length != 2) {
        throw new WrongArgumentCountException("2", commandLine.getArgs().length);
      }
      String sourceFileName = commandLine.getArgs()[0];
      String targetFileName = commandLine.getArgs()[1];
      Writer sourceWriter = getWriter(getFileOutputStream(sourceFileName));
      Writer targetWriter = getWriter(getFileOutputStream(targetFileName));
      formatter = new PlaintextFormatter(sourceWriter, targetWriter);
    } else if (cls.equals("tmx")) {
      Writer writer = getSingleWriter(commandLine);
      String languages = commandLine.getOptionValue('l');
      if (languages == null) {
        throw new MissingParameterException("languages");
      }
      String[] languageArray = languages.split(",");
      if (languageArray.length != 2) {
        throw new ParameterFormatException("languages");
      }
View Full Code Here

  }
 
  protected void run(CommandLine commandLine) {
    String cls = commandLine.getOptionValue('c');
    if (cls == null) {
      throw new MissingParameterException("class");
    }
    ModifyAlgorithm sourceAlgorithm;
    ModifyAlgorithm targetAlgorithm = null;
    Parser parser = new AlParser(getIn());
    List<Alignment> alignmentList = null;
    if (cls.equals("split-word")) {
      sourceAlgorithm = new WordSplitAlgorithm();
    } else if (cls.equals("split-sentence")) {
      sourceAlgorithm = new SentenceSplitAlgorithm();
    } else if (cls.equals("split-paragraph")) {
      sourceAlgorithm = new ParagraphSplitAlgorithm();
    } else if (cls.equals("split-srx")) {
      String fileName = commandLine.getOptionValue('f');
      if (fileName == null) {
        throw new MissingParameterException("file");
      }
      String languages = commandLine.getOptionValue('l');
      if (languages == null) {
        throw new MissingParameterException("languages");
      }
      String[] languageArray = languages.split(",");
      if (languageArray.length != 2) {
        throw new ParameterFormatException("languages");
      }
View Full Code Here

    int value;
    if (string == null) {
      if (defaultValue != null) {
        value = defaultValue;
      } else {
        throw new MissingParameterException(command);
      }
    } else {
      try {
        value = Integer.parseInt(string);
      } catch (NumberFormatException e) {
View Full Code Here

    float value;
    if (string == null) {
      if (defaultValue != null) {
        value = defaultValue;
      } else {
        throw new MissingParameterException(command);
      }
    } else {
      try {
        value = Float.parseFloat(string);
      } catch (NumberFormatException e) {
View Full Code Here

  }
 
  public void run(CommandLine commandLine) {
    String cls = commandLine.getOptionValue('c');
    if (cls == null) {
      throw new MissingParameterException("class");
    } else if (cls.equals("language-translation")) {

      //int iterations = createInt(commandLine, "iterations",
      //    TranslationModelUtil.DEFAULT_TRAIN_ITERATION_COUNT);
 
View Full Code Here

  }
 
  protected void run(CommandLine commandLine) {
    String cls = commandLine.getOptionValue('c');
    if (cls == null) {
      throw new MissingParameterException("class");
    }
    Filter filter;
   
    if (cls.equals("one-to-one")) {
      filter = new OneToOneSelector();
    } else if (cls.equals("fraction")) {
      float fraction = createFloat(commandLine, "fraction");
      filter = new FractionSelector(fraction);
    } else if (cls.equals("probability")) {
      float probability = createFloat(commandLine, "probability");
      filter = new ProbabilitySelector(probability);
    } else if (cls.equals("intersection") || cls.equals("difference")) {
      String alignmentString = commandLine.getOptionValue("alignment");
      if (alignmentString == null) {
        throw new MissingParameterException("alignment");
      }
      List<Alignment> alignment = loadAlignmentList(alignmentString);
      if (cls.equals("intersection")) {
        filter = new IntersectionSelector(alignment);
      } else if (cls.equals("difference")) {
View Full Code Here

    options.addOption("u", "unification-corpus", true, "Unification reference corpus. Required by unify algorithm.");
  }
 
  protected void run(CommandLine commandLine) {
    if (commandLine.getOptions().length == 0) {
      throw new MissingParameterException("class");
    }
    Filter filter;
    Parser parser = new AlParser(getIn());
    List<Alignment> alignmentList = null;
    String cls = commandLine.getOptionValue('c');
    if (cls == null) {
      throw new MissingParameterException("class");
    }
    if (cls.equals("unify")) {
      String unificationCorpus = commandLine.getOptionValue('u');
      if (unificationCorpus == null) {
        throw new MissingParameterException("unification-corpus");
      }
      List<Alignment> unificationAlignmentList =
        loadAlignmentList(unificationCorpus);
      filter = new UnifyAligner(unificationAlignmentList);
    } else {
View Full Code Here

          alignmentList);
      Map<Category, Float> categoryMap =
        CategoryDefaults.BEST_CATEGORY_MAP;
      String search = commandLine.getOptionValue('s');
      if (search == null) {
        throw new MissingParameterException("search");
      }
      if (search.equals("exhaustive") || search.equals("band")) {
        MatrixFactory matrixFactory;
        if (search.equals("exhaustive")) {
          matrixFactory = new FullMatrixFactory();
View Full Code Here

TOP

Related Classes of net.sourceforge.align.ui.console.command.exception.MissingParameterException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.