public void run(String format, String[] args) { validateAllArgs(args, this.paramsClass, format); params = ArgumentParser.parse( ArgumentParser.filter(args, this.paramsClass), this.paramsClass); factory = getStreamFactory(format); String[] fargs = ArgumentParser.filter(args, factory.getParameters()); validateFactoryArgs(factory, fargs); sampleStream = factory.create(fargs); } }
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); }
/** * 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())); } }
@ParameterDescription(valueName = "includeTitles", description = "if true will include sentences marked as headlines.") @OptionalParameter(defaultValue = "false") Boolean getIncludeTitles(); }
private void addTruePositive(String type) { Stats s = initStatsForOutcomeAndGet(type); s.incrementTruePositive(); s.incrementTarget(); generalStats.incrementTruePositive(); generalStats.incrementTarget(); }
private void addFalsePositive(String type) { Stats s = initStatsForOutcomeAndGet(type); s.incrementFalsePositive(); generalStats.incrementFalsePositive(); }
private void addFalseNegative(String type) { Stats s = initStatsForOutcomeAndGet(type); s.incrementTarget(); generalStats.incrementTarget(); }
@ArgumentParser.ParameterDescription(valueName = "dictionary", description = "specifies the file with detokenizer dictionary.") @ArgumentParser.OptionalParameter File getDetokenizer(); }
@ArgumentParser.ParameterDescription(valueName = "tagset", description = "u|x u for unified tags and x for language-specific part-of-speech tags") @ArgumentParser.OptionalParameter(defaultValue = "u") String getTagset(); }
@ParameterDescription(valueName = "true|false", description = "Validate input to make sure it makes sense.") @OptionalParameter(defaultValue = "false") Boolean getValidate(); }
@ParameterDescription(valueName = "value", description = " Type of lemma-inflected " + "form encoding compression that precedes automaton construction. Allowed " + "values: [suffix, infix, prefix, none].") @OptionalParameter(defaultValue = "prefix") String getEncoder();
@ParameterDescription(valueName = "factoryName", description = "A sub-class of LemmatizerFactory where to get implementation and resources.") @OptionalParameter String getFactory(); }
@ParameterDescription(valueName = "samplesToSkip", description = "number of samples to skip before returning") @OptionalParameter(defaultValue = "0") String getSamplesToSkip(); }
@ParameterDescription(valueName = "factoryName", description = "A sub-class of DoccatFactory where to get implementation and resources.") @OptionalParameter String getFactory(); }
@ArgumentParser.ParameterDescription(valueName = "tagset", description = "u|x u for unified tags and x for language-specific part-of-speech tags") @ArgumentParser.OptionalParameter(defaultValue = "u") String getTagset(); }
@ParameterDescription(valueName = "factoryName", description = "A sub-class of POSTaggerFactory where to get implementation and resources.") @OptionalParameter String getFactory(); }
@ParameterDescription(valueName = "factoryName", description = "A sub-class of SentenceDetectorFactory where to get implementation and resources.") @OptionalParameter String getFactory(); }
@ParameterDescription(valueName = "includeFeatures", description = "combine POS Tags with word features, like number and gender.") @OptionalParameter(defaultValue = "false") Boolean getIncludeFeatures(); }
@ParameterDescription(valueName = "factoryName", description = "A sub-class of LanguageDetectorFactory" + " where to get implementation and resources.") @OptionalParameter String getFactory();
@ParameterDescription(valueName = "factoryName", description = "A sub-class of TokenizerFactory where to get implementation and resources.") @OptionalParameter String getFactory(); }