/** * Constructor for a tagger, loading a model stored in a particular file, * classpath resource, or URL. * The tagger data is loaded when the constructor is called (this can be * slow). This constructor first constructs a TaggerConfig object, which * loads the tagger options from the modelFile. * * @param modelFile Filename, classpath resource, or URL for the trained model * @throws RuntimeIOException if I/O errors or serialization errors */ public MaxentTagger(String modelFile) { this(modelFile, StringUtils.argsToProperties("-model", modelFile), true); }
/** * In this version each flag has zero or one argument. It has one argument * if there is a thing following a flag that does not begin with '-'. See * {@link #argsToProperties(String[], Map)} for full documentation. * * @param args Command line arguments * @return A Properties object representing the arguments. */ public static Properties argsToProperties(String... args) { return argsToProperties(args, Collections.emptyMap()); }
private static Properties updatePropertiesWithOptions(Properties props, String[] args) { Properties allProperties = new Properties(); // copy it so props isn't changed but can be overridden by args for (String key : props.stringPropertyNames()) { allProperties.setProperty(key, props.getProperty(key)); } Properties options = StringUtils.argsToProperties(args); for (String key : options.stringPropertyNames()) { allProperties.setProperty(key, options.getProperty(key)); } return allProperties; }
public static void main(final String[] args) throws ClassNotFoundException, IOException, InterruptedException { Properties props = StringUtils.argsToProperties(args); runThreadedTest(props); }
/** * Needs the following properties: * -props 'Location of coref.properties' * @throws Exception */ public static void main(String[] args) throws Exception { Properties props = StringUtils.argsToProperties(args); initializeAndRunCoref(props); }
/** * Populate with the given command-line arguments all static options in all * classes in the current classpath. * Note that this may take a while if the classpath is large. * * @param args The command-line arguments to use to fill options. */ public static void fillOptions(String... args) { fillOptions(StringUtils.argsToProperties(args), StringUtils.EMPTY_STRING_ARRAY); }
/** * For testing only * */ public static void main(String[] args) { Properties props = StringUtils.argsToProperties(args); String dateProperty = props.getProperty("date"); if (dateProperty != null) { ISODateInstance d = new ISODateInstance(dateProperty); System.out.println(dateProperty + " processed as " + d); } }
public static void main(String[] args) throws IOException { Properties p = StringUtils.argsToProperties(args); if (p.containsKey("input")){ FileInputStream fis = new FileInputStream(p.getProperty("input")); InputStreamReader isr = new InputStreamReader(fis,"UTF-8"); BufferedReader reader = new BufferedReader(isr); String thisLine; while( (thisLine = reader.readLine()) != null){ EncodingPrintWriter.out.println(normalize(thisLine),"UTF-8"); } } }
public static void main(String args[]) { Properties params = StringUtils.argsToProperties(args); if (params.getProperty("sentFile") != null) { log.error("Parsing sentences to constituency trees is not supported for Chinese. " + "Please parse your sentences first and then convert them to dependency trees using the -treeFile option." ); return; } GrammaticalStructureConversionUtils.convertTrees(args, "zh"); }
public static void main(String args[]) { Properties params = StringUtils.argsToProperties(args); if (params.getProperty("sentFile") != null) { log.error("Parsing sentences to constituency trees is not supported for Chinese. " + "Please parse your sentences first and then convert them to dependency trees using the -treeFile option." ); return; } GrammaticalStructureConversionUtils.convertTrees(args, "zh-sd"); }
public static void main(String[] args) throws Exception { Properties props = StringUtils.argsToProperties(args); CorefSystem coref = new CorefSystem(props); coref.runOnConll(props); } }
/** * Populate with the given command-line arguments all static {@link Option}-tagged fields in * the given classes. * * @param classes The classes to populate static {@link Option}-tagged fields in. * @param args The command-line arguments to use to fill in additional properties. */ public static void fillOptions(Class<?>[] classes, String... args) { Properties options = StringUtils.argsToProperties(args); //get options fillOptionsImpl(null, BOOTSTRAP_CLASSES, options, false, true); //bootstrap fillOptionsImpl(null, classes, options); }
public static void main(String[] args) throws Exception { // Generate rules files Properties props = StringUtils.argsToProperties(args); Options options = new Options("qe", props); generatePrefixDefs(options.prefixFilename, options.prefixRulesFilename); generateUnitsStage0Rules(options.unitsFilename, options.text2UnitMapping, options.unitsRulesFilename); }
/** * Some basic testing of the ClassifierCombiner. * * @param args Command-line arguments as properties: -loadClassifier1 serializedFile -loadClassifier2 serializedFile * @throws Exception If IO or serialization error loading classifiers */ public static void main(String[] args) throws Exception { Properties props = StringUtils.argsToProperties(args); ClassifierCombiner ec = new ClassifierCombiner(props); log.info(ec.classifyToString("Marketing : Sony Hopes to Win Much Bigger Market For Wide Range of Small-Video Products --- By Andrew B. Cohen Staff Reporter of The Wall Street Journal")); }
public static void main(String[] args) throws Exception { Properties props = StringUtils.argsToProperties("-props", args[0]); Dictionaries dictionaries = new Dictionaries(props); String outputPath = args[1]; exportData(outputPath, Dataset.TRAIN, props, dictionaries); exportData(outputPath, Dataset.DEV, props, dictionaries); exportData(outputPath, Dataset.TEST, props, dictionaries); }
public static void main(String[] args) throws Exception { Properties props = StringUtils.argsToProperties(new String[] {"-props", args[0]}); Dictionaries dictionaries = new Dictionaries(props); CorefProperties.setInput(props, Dataset.TRAIN); new MentionDetectionEvaluator().run(props, dictionaries); } }
public static void main(String[] args) throws Exception { // just a simple test, to make sure stuff works Properties props = StringUtils.argsToProperties(args); RothCONLL04Reader reader = new RothCONLL04Reader(); reader.setLoggerLevel(Level.INFO); reader.setProcessor(new StanfordCoreNLP(props)); Annotation doc = reader.parse("/u/nlp/data/RothCONLL04/conll04.corp"); System.out.println(AnnotationUtils.datasetToString(doc)); }
private static Annotation testAnnoation(String text,String[] args){ Annotation document = new Annotation(text); Properties props = StringUtils.argsToProperties(args); StanfordCoreNLP corenlp = new StanfordCoreNLP(props); corenlp.annotate(document); HybridCorefAnnotator hcoref = new HybridCorefAnnotator(props); hcoref.annotate(document); return document; }
public static void main(String[] args) throws IOException { Properties props = StringUtils.argsToProperties(args); AceReader r = new AceReader(new StanfordCoreNLP(props, false), false); r.setLoggerLevel(Level.INFO); r.parse("/u/scr/nlp/data/ACE2005/"); // Annotation a = r.parse("/user/mengqiu/scr/twitter/nlp/corpus_prep/standalone/ar/data"); // BasicEntityExtractor.saveCoNLLFiles("/tmp/conll", a, false, false); log.info("done"); }
public static void main(String[] args) throws Exception { Properties props = StringUtils.argsToProperties(new String[] {"-props", args[0]}); new CorefSystem(new DocumentMaker(props, new Dictionaries(props)), new FromFileCorefAlgorithm(args[1]), true, false).runOnConll(props); } }