opennlp.tools.cmdline.ArgumentParser.validateArgumentsLoudly()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(9.1k)|赞(0)|评价(0)|浏览(65)

本文整理了Java中opennlp.tools.cmdline.ArgumentParser.validateArgumentsLoudly()方法的一些代码示例,展示了ArgumentParser.validateArgumentsLoudly()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ArgumentParser.validateArgumentsLoudly()方法的具体详情如下:
包路径:opennlp.tools.cmdline.ArgumentParser
类名称:ArgumentParser
方法名:validateArgumentsLoudly

ArgumentParser.validateArgumentsLoudly介绍

[英]Tests if the arguments are correct or incorrect.
[中]

代码示例

代码示例来源:origin: apache/opennlp

/**
 * Tests if the arguments are correct or incorrect.
 *
 * @param args command line arguments
 * @param argProxyInterface interface with parameters description
 * @return null, if arguments are valid or error message otherwise
 */
public static String validateArgumentsLoudly(String[] args, Class<?> argProxyInterface) {
 return validateArgumentsLoudly(args, new Class[]{argProxyInterface});
}

代码示例来源:origin: apache/opennlp

/**
 * Tests if the argument are correct or incorrect. Incorrect means, that mandatory arguments are missing or
 * there are unknown arguments. The argument value itself can also be incorrect, but this
 * is checked by the {@link ArgumentParser#parse(String[], Class)} method and reported accordingly.
 *
 * @param args command line arguments
 * @param argProxyInterfaces interfaces with parameters description
 * @return true, if arguments are valid
 */
public static boolean validateArguments(String[] args, Class<?>... argProxyInterfaces) {
 return null == validateArgumentsLoudly(args, argProxyInterfaces);
}

代码示例来源:origin: apache/opennlp

protected <T> T validateAndParseParams(String[] args, Class<T> argProxyInterface) {
 String errorMessage = ArgumentParser.validateArgumentsLoudly(args, argProxyInterface);
 if (null != errorMessage) {
  throw new TerminateToolException(1, errorMessage + "\n" + getHelp());
 }
 return ArgumentParser.parse(args, argProxyInterface);
}

代码示例来源:origin: apache/opennlp

/**
 * Validates arguments for a format processed by the <code>factory</code>.
 * @param factory a stream factory
 * @param args arguments
 */
protected void validateFactoryArgs(ObjectStreamFactory<T> factory, String[] args) {
 String errMessage = ArgumentParser.validateArgumentsLoudly(args, factory.getParameters());
 if (null != errMessage) {
  throw new TerminateToolException(1, "Format parameters are invalid: " + errMessage + "\n" +
    "Usage: " + ArgumentParser.createUsage(factory.getParameters()));
 }
}

代码示例来源:origin: apache/opennlp

String errorMessage = ArgumentParser.validateArgumentsLoudly(formatArgs, streamFactory.getParameters());
if (null != errorMessage) {
 throw new TerminateToolException(1, errorMessage + "\n" + helpString);

代码示例来源:origin: apache/opennlp

/**
 * Validates arguments using parameters from <code>argProxyInterface</code> and the parameters of the
 * <code>format</code>.
 *
 * @param args arguments
 * @param argProxyInterface interface with parameter descriptions
 * @param format data format name
 * @param <A> A
 */
@SuppressWarnings({"unchecked"})
protected <A> void validateAllArgs(String[] args, Class<A> argProxyInterface, String format) {
 ObjectStreamFactory<T> factory = getStreamFactory(format);
 String errMessage = ArgumentParser.validateArgumentsLoudly(args, argProxyInterface,
   factory.<A>getParameters());
 if (null != errMessage) {
  throw new TerminateToolException(1, errMessage + "\n" + getHelp(format));
 }
}

代码示例来源:origin: ai.idylnlp/idylnlp-opennlp-tools-1.8.3

/**
 * Tests if the argument are correct or incorrect. Incorrect means, that mandatory arguments are missing or
 * there are unknown arguments. The argument value itself can also be incorrect, but this
 * is checked by the {@link ArgumentParser#parse(String[], Class)} method and reported accordingly.
 *
 * @param args command line arguments
 * @param argProxyInterfaces interfaces with parameters description
 * @return true, if arguments are valid
 */
public static boolean validateArguments(String[] args, Class<?>... argProxyInterfaces) {
 return null == validateArgumentsLoudly(args, argProxyInterfaces);
}

代码示例来源:origin: org.apache.opennlp/opennlp-tools

/**
 * Tests if the argument are correct or incorrect. Incorrect means, that mandatory arguments are missing or
 * there are unknown arguments. The argument value itself can also be incorrect, but this
 * is checked by the {@link ArgumentParser#parse(String[], Class)} method and reported accordingly.
 *
 * @param args command line arguments
 * @param argProxyInterfaces interfaces with parameters description
 * @return true, if arguments are valid
 */
public static boolean validateArguments(String[] args, Class<?>... argProxyInterfaces) {
 return null == validateArgumentsLoudly(args, argProxyInterfaces);
}

代码示例来源:origin: ai.idylnlp/idylnlp-opennlp-tools-1.8.3

/**
 * Tests if the arguments are correct or incorrect.
 *
 * @param args command line arguments
 * @param argProxyInterface interface with parameters description
 * @return null, if arguments are valid or error message otherwise
 */
public static String validateArgumentsLoudly(String[] args, Class<?> argProxyInterface) {
 return validateArgumentsLoudly(args, new Class[]{argProxyInterface});
}

代码示例来源:origin: org.apache.opennlp/opennlp-tools

/**
 * Tests if the arguments are correct or incorrect.
 *
 * @param args command line arguments
 * @param argProxyInterface interface with parameters description
 * @return null, if arguments are valid or error message otherwise
 */
public static String validateArgumentsLoudly(String[] args, Class<?> argProxyInterface) {
 return validateArgumentsLoudly(args, new Class[]{argProxyInterface});
}

代码示例来源:origin: org.cogroo/cogroo-nlp

public String validateArguments(String[] args) {
 return ArgumentParser.validateArgumentsLoudly(args, Parameters.class);
}

代码示例来源:origin: cogroo/cogroo4

public String validateArguments(String[] args) {
 return ArgumentParser.validateArgumentsLoudly(args, Parameters.class);
}

代码示例来源:origin: org.apache.opennlp/opennlp-tools

protected <T> T validateAndParseParams(String[] args, Class<T> argProxyInterface) {
 String errorMessage = ArgumentParser.validateArgumentsLoudly(args, argProxyInterface);
 if (null != errorMessage) {
  throw new TerminateToolException(1, errorMessage + "\n" + getHelp());
 }
 return ArgumentParser.parse(args, argProxyInterface);
}

代码示例来源:origin: ai.idylnlp/idylnlp-opennlp-tools-1.8.3

protected <T> T validateAndParseParams(String[] args, Class<T> argProxyInterface) {
 String errorMessage = ArgumentParser.validateArgumentsLoudly(args, argProxyInterface);
 if (null != errorMessage) {
  throw new TerminateToolException(1, errorMessage + "\n" + getHelp());
 }
 return ArgumentParser.parse(args, argProxyInterface);
}

代码示例来源:origin: org.apache.opennlp/opennlp-tools

/**
 * Validates arguments for a format processed by the <code>factory</code>.
 * @param factory a stream factory
 * @param args arguments
 */
protected void validateFactoryArgs(ObjectStreamFactory<T> factory, String[] args) {
 String errMessage = ArgumentParser.validateArgumentsLoudly(args, factory.getParameters());
 if (null != errMessage) {
  throw new TerminateToolException(1, "Format parameters are invalid: " + errMessage + "\n" +
    "Usage: " + ArgumentParser.createUsage(factory.getParameters()));
 }
}

代码示例来源:origin: org.apache.opennlp/opennlp-tools

String errorMessage = ArgumentParser.validateArgumentsLoudly(formatArgs, streamFactory.getParameters());
if (null != errorMessage) {
 throw new TerminateToolException(1, errorMessage + "\n" + helpString);

代码示例来源:origin: ai.idylnlp/idylnlp-opennlp-tools-1.8.3

/**
 * Validates arguments for a format processed by the <code>factory</code>.
 * @param factory a stream factory
 * @param args arguments
 */
protected void validateFactoryArgs(ObjectStreamFactory<T> factory, String[] args) {
 String errMessage = ArgumentParser.validateArgumentsLoudly(args, factory.getParameters());
 if (null != errMessage) {
  throw new TerminateToolException(1, "Format parameters are invalid: " + errMessage + "\n" +
    "Usage: " + ArgumentParser.createUsage(factory.getParameters()));
 }
}

代码示例来源:origin: ai.idylnlp/idylnlp-opennlp-tools-1.8.3

String errorMessage = ArgumentParser.validateArgumentsLoudly(formatArgs, streamFactory.getParameters());
if (null != errorMessage) {
 throw new TerminateToolException(1, errorMessage + "\n" + helpString);

代码示例来源:origin: ai.idylnlp/idylnlp-opennlp-tools-1.8.3

/**
 * Validates arguments using parameters from <code>argProxyInterface</code> and the parameters of the
 * <code>format</code>.
 *
 * @param args arguments
 * @param argProxyInterface interface with parameter descriptions
 * @param format data format name
 * @param <A> A
 */
@SuppressWarnings({"unchecked"})
protected <A> void validateAllArgs(String[] args, Class<A> argProxyInterface, String format) {
 ObjectStreamFactory<T> factory = getStreamFactory(format);
 String errMessage = ArgumentParser.validateArgumentsLoudly(args, argProxyInterface,
   factory.<A>getParameters());
 if (null != errMessage) {
  throw new TerminateToolException(1, errMessage + "\n" + getHelp(format));
 }
}

代码示例来源:origin: org.apache.opennlp/opennlp-tools

/**
 * Validates arguments using parameters from <code>argProxyInterface</code> and the parameters of the
 * <code>format</code>.
 *
 * @param args arguments
 * @param argProxyInterface interface with parameter descriptions
 * @param format data format name
 * @param <A> A
 */
@SuppressWarnings({"unchecked"})
protected <A> void validateAllArgs(String[] args, Class<A> argProxyInterface, String format) {
 ObjectStreamFactory<T> factory = getStreamFactory(format);
 String errMessage = ArgumentParser.validateArgumentsLoudly(args, argProxyInterface,
   factory.<A>getParameters());
 if (null != errMessage) {
  throw new TerminateToolException(1, errMessage + "\n" + getHelp(format));
 }
}

相关文章