public static int maxTrainExamplesPerDocument(Properties props) { return PropertiesUtils.getInt(props, "coref.statistical.maxTrainExamplesPerDocument", Integer.MAX_VALUE); } }
public static int getSeed(Properties props) { return PropertiesUtils.getInt(props, SEED_PROP, 1); } public static int getNumFeatures(Properties props, String sievename) {
/** * Load an integer property. If the key is not present, returns 0. */ public static int getInt(Properties props, String key) { return getInt(props, key, 0); }
public static int maxMentionDistanceWithStringMatch(Properties props) { return PropertiesUtils.getInt(props, "coref.maxMentionDistanceWithStringMatch", 500); }
public static int getNumTrees(Properties props, String sievename) { return PropertiesUtils.getInt(props, NUM_TREE_PROP.replace("SIEVENAME", sievename), 100); } public static int getSeed(Properties props) {
public static int getFeatureCountThreshold(Properties props, String sievename) { return PropertiesUtils.getInt(props, THRES_FEATURECOUNT_PROP.replace("SIEVENAME", sievename), 20); } public static boolean useBasicFeatures(Properties props, String sievename) {
public static int getTreeDepth(Properties props, String sievename) { return PropertiesUtils.getInt(props, TREE_DEPTH_PROP.replace("SIEVENAME", sievename), 0); } public static boolean calculateFeatureImportance(Properties props) {
public static int getMaxSentDistForSieve(Properties props, String sievename) { return PropertiesUtils.getInt(props, MAX_SENT_DIST_PROP.replace("SIEVENAME", sievename), 1000); }
public static int getNumFeatures(Properties props, String sievename) { return PropertiesUtils.getInt(props, NUM_FEATURES_PROP.replace("SIEVENAME", sievename), 30); } public static int getTreeDepth(Properties props, String sievename) {
public static int getThreadCounts(Properties props) { return PropertiesUtils.getInt(props, THREADS_PROP, Runtime.getRuntime().availableProcessors()); } public static Locale getLanguage(Properties props) {
public POSTaggerAnnotator(String annotatorName, Properties props) { String posLoc = props.getProperty(annotatorName + ".model"); if (posLoc == null) { posLoc = DefaultPaths.DEFAULT_POS_MODEL; } boolean verbose = PropertiesUtils.getBool(props, annotatorName + ".verbose", false); this.pos = loadModel(posLoc, verbose); this.maxSentenceLength = PropertiesUtils.getInt(props, annotatorName + ".maxlen", Integer.MAX_VALUE); this.nThreads = PropertiesUtils.getInt(props, annotatorName + ".nthreads", PropertiesUtils.getInt(props, "nthreads", 1)); this.reuseTags = PropertiesUtils.getBool(props, annotatorName + ".reuseTags", false); }
public static int maxMentionDistance(Properties props) { return PropertiesUtils.getInt(props, "coref.maxMentionDistance", conll(props) ? Integer.MAX_VALUE : 50); }
public void annotate(final Annotation annotation, final Consumer<Annotation> callback){ if (PropertiesUtils.getInt(properties, "threads", 1) == 1) { annotate(annotation); callback.accept(annotation); } else { try { availableProcessors.acquire(); } catch (InterruptedException e) { throw new RuntimeInterruptedException(e); } new Thread(() -> { try { annotate(annotation); } catch (Throwable t) { annotation.set(CoreAnnotations.ExceptionAnnotation.class, t); } callback.accept(annotation); availableProcessors.release(); }).start(); } }
public Options(Properties properties) { includeText = PropertiesUtils.getBool(properties, "output.includeText", false); encoding = properties.getProperty("encoding", "UTF-8"); pretty = PropertiesUtils.getBool(properties, "output.prettyPrint", true); String constituencyTreeStyle = properties.getProperty("output.constituencyTree", "penn"); constituencyTreePrinter = new TreePrint(constituencyTreeStyle); String dependencyTreeStyle = properties.getProperty("output.dependencyTree", "typedDependenciesCollapsed"); dependencyTreePrinter = new TreePrint(dependencyTreeStyle); coreferenceContextSize = PropertiesUtils.getInt(properties,"output.coreferenceContextSize", 0); printSingletons = PropertiesUtils.getBool(properties, "output.printSingletonEntities", false); relationsBeam = PropertiesUtils.getDouble(properties, "output.relation.beam", 0.0); keysToPrint = getKeysToPrint(properties.getProperty("output.columns", DEFAULT_KEYS)); }
public DependencyParseAnnotator(Properties properties) { String modelPath = PropertiesUtils.getString(properties, "model", DependencyParser.DEFAULT_MODEL); parser = DependencyParser.loadFromModelFile(modelPath, properties); nThreads = PropertiesUtils.getInt(properties, "nthreads", DEFAULT_NTHREADS); maxTime = PropertiesUtils.getLong(properties, "sentenceTimeout", DEFAULT_MAXTIME); extraDependencies = MetaClass.cast(properties.getProperty("extradependencies", "NONE"), GrammaticalStructure.Extras.class); }
private void setProperties(Properties props) { trainingThreads = PropertiesUtils.getInt(props, "trainingThreads", trainingThreads); wordCutOff = PropertiesUtils.getInt(props, "wordCutOff", wordCutOff); initRange = PropertiesUtils.getDouble(props, "initRange", initRange); maxIter = PropertiesUtils.getInt(props, "maxIter", maxIter); batchSize = PropertiesUtils.getInt(props, "batchSize", batchSize); adaEps = PropertiesUtils.getDouble(props, "adaEps", adaEps); adaAlpha = PropertiesUtils.getDouble(props, "adaAlpha", adaAlpha); regParameter = PropertiesUtils.getDouble(props, "regParameter", regParameter); dropProb = PropertiesUtils.getDouble(props, "dropProb", dropProb); hiddenSize = PropertiesUtils.getInt(props, "hiddenSize", hiddenSize); embeddingSize = PropertiesUtils.getInt(props, "embeddingSize", embeddingSize); numPreComputed = PropertiesUtils.getInt(props, "numPreComputed", numPreComputed); evalPerIter = PropertiesUtils.getInt(props, "evalPerIter", evalPerIter); clearGradientsPerIter = PropertiesUtils.getInt(props, "clearGradientsPerIter", clearGradientsPerIter); saveIntermediate = PropertiesUtils.getBool(props, "saveIntermediate", saveIntermediate); unlabeled = PropertiesUtils.getBool(props, "unlabeled", unlabeled);
ArgumentParser.threads = PropertiesUtils.getInt(this.properties, "threads"); this.availableProcessors = new Semaphore(ArgumentParser.threads); } else {
int nThreads = PropertiesUtils.getInt(options, "nthreads", 1); ArabicSegmenter segmenter = getSegmenter(options);
System.exit(-1); int maxLen = PropertiesUtils.getInt(options, "y", Integer.MAX_VALUE); boolean printTrees = PropertiesUtils.getBool(options, "p", false); boolean flattenTrees = PropertiesUtils.getBool(options, "f", false);
this.maxSentenceLength = PropertiesUtils.getInt(props, annotatorName + ".maxlen", -1); this.kBest = PropertiesUtils.getInt(props, annotatorName + ".kbest", 1); this.nThreads = PropertiesUtils.getInt(props, annotatorName + ".nthreads", PropertiesUtils.getInt(props, "nthreads", 1)); boolean usesBinary = StanfordCoreNLP.usesBinaryTrees(props); this.saveBinaryTrees = PropertiesUtils.getBool(props, annotatorName + ".binaryTrees", usesBinary);