private static void annotateByCommandLineArguments(String[] args) throws AnnotatorException, ConfigurationFileDuplicateKeyException, ConfigurationException, ParserRunException, ConllConverterException, SentenceSplitterException, FileNotFoundException, IOException { if (args.length < (1)) throw new AnnotatorException(String.format("usage: %s configurationFile.xml sentence(s)", AnnotateSentenceToConll.class.getSimpleName())); List<String> argsList = Utils.arrayToCollection(args, new Vector<String>()); Iterator<String> argsIterator = argsList.iterator(); ConfigurationFile confFile = new ConfigurationFile(new File(argsIterator.next())); confFile.setExpandingEnvironmentVariables(true); AnnotateSentenceToConll app = new AnnotateSentenceToConll(confFile); Iterable<String> sentencesToAnnotate = getSentencesIterable(argsIterator,app); List<ExtendedNode> list = new ArrayList<ExtendedNode>(); for (String sentence : sentencesToAnnotate) { ExtendedNode annotatedSentece = app.annotateSentece(sentence); list.add(annotatedSentece); } AnnotatedTreeToConllCoverter.treesToConllFiles(list, app.conllOutputFolder, CONLL_CONVERTER); } }
confFile.setExpandingEnvironmentVariables(true); WordnetLexicalResource wnLexR = new WordnetLexicalResource(confFile.getModuleConfiguration(moduleName));
public static void main(String[] args) throws EntailmentCompilationException, ConfigurationException, ConllConverterException { if (args.length == 0) throw new EntailmentCompilationException("usage: EntailmentRuleCompiler configurationFile.xml"); ConfigurationFile confFile = new ConfigurationFile(new File(args[0])); confFile.setExpandingEnvironmentVariables(true); ConfigurationParams compilationParams = confFile.getModuleConfiguration(RuleCompilerParameterNames.RULE_COMPILER_PARAMS_MODULE); File dir = compilationParams.getDirectory(RuleCompilerParameterNames.ENTAILMENT_RULES_DIRECTORY); final String ruleFileSuffix = compilationParams.get(RuleCompilerParameterNames.RULE_FILE_SUFFIX); // create an english node rule compliler EntailmentRuleCompiler compiler = new EntailmentRuleCompiler(); Set<RuleWithConfidenceAndDescription<Info, BasicNode>> rulesWithCD = new LinkedHashSet<RuleWithConfidenceAndDescription<Info,BasicNode>>( compiler.compileFolder(dir, ruleFileSuffix)); File conllDir = new File(compilationParams.get(RuleCompilerParameterNames.CONLL_RULES_DIRECTORY)); conllDir.mkdirs(); System.out.println("Now printing " + rulesWithCD.size() + " rules into CoNLL format..."); rulesToConllFiles(rulesWithCD, conllDir, new BasicConllStringConvertor()); System.out.println("Done!"); }
throw new AnnotationCompilationException("usage: AnnotationRuleCompiler configurationFile.xml"); ConfigurationFile confFile = new ConfigurationFile(new File(args[0])); confFile.setExpandingEnvironmentVariables(true); ConfigurationParams compilationParams = confFile.getModuleConfiguration(RuleCompilerParameterNames.RULE_COMPILER_PARAMS_MODULE);
throw new EntailmentCompilationException("usage: EntailmentRuleCompiler configurationFile.xml"); ConfigurationFile confFile = new ConfigurationFile(new File(args[0])); confFile.setExpandingEnvironmentVariables(true); ConfigurationParams compilationParams = confFile.getModuleConfiguration(RuleCompilerParameterNames.RULE_COMPILER_PARAMS_MODULE);
configurationFile.setExpandingEnvironmentVariables(true); configurationParams = configurationFile.getModuleConfiguration(configurationModuleName);
/** * Ctor * @throws ConfigurationException * @throws ConllConverterException */ public AnnotateSentenceToConll(ConfigurationFile confFile) throws ConfigurationException, ConllConverterException { confFile.setExpandingEnvironmentVariables(true); annotationParams = confFile.getModuleConfiguration(TransformationsConfigurationParametersNames.TRUTH_TELLER_MODULE_NAME); try { annotator = new DefaultSentenceAnnotator(annotationParams); String posTaggerString = annotationParams.get(TransformationsConfigurationParametersNames.PREPROCESS_EASYFIRST); String easyFirstHost = annotationParams.get(TransformationsConfigurationParametersNames.PREPROCESS_EASYFIRST_HOST); int easyFirstPort = annotationParams.getInt(TransformationsConfigurationParametersNames.PREPROCESS_EASYFIRST_PORT); parser = new EasyFirstParser(easyFirstHost, easyFirstPort, posTaggerString); parser.init(); } catch (Exception e) { throw new ConllConverterException("see nested", e); } String conllOutputFolderPath = annotationParams.get(TransformationsConfigurationParametersNames.CONLL_FORMAT_OUTPUT_DIRECTORY); conllOutputFolder = new File(conllOutputFolderPath); conllOutputFolder.mkdirs(); }
throw new AnnotationCompilationException("usage: AnnotationRuleCompiler configurationFile.xml"); ConfigurationFile confFile = new ConfigurationFile(new File(args[0])); confFile.setExpandingEnvironmentVariables(true); ConfigurationParams compilationParams = confFile.getModuleConfiguration(RuleCompilerParameterNames.RULE_COMPILER_PARAMS_MODULE); ConfigurationParams annotationParams = confFile.getModuleConfiguration(TransformationsConfigurationParametersNames.TRUTH_TELLER_MODULE_NAME);
private void readConfigurationFile() throws ConfigurationFileDuplicateKeyException, ConfigurationException, NumberFormatException, TeEngineMlException, ParserRunException, NamedEntityRecognizerException, TextPreprocessorException { configurationFile = SystemInitialization.loadConfigurationFile(this.configurationFileName); configurationFile.setExpandingEnvironmentVariables(true); ConfigurationParams params = configurationFile.getModuleConfiguration(RTE_PAIRS_PREPROCESS_MODULE_NAME); instruments = new InstrumentsFactory().getDefaultInstruments(params); if (params.containsKey(PREPROCESS_DO_NER)) { doNer = params.getBoolean(PREPROCESS_DO_NER); } else { doNer = true; } if (params.containsKey(PREPROCESS_DO_TEXT_NORMALIZATION)) { doTextNormalization = params.getBoolean(PREPROCESS_DO_TEXT_NORMALIZATION); } else { doTextNormalization=true; } }
public void preprocess() throws ConfigurationFileDuplicateKeyException, ConfigurationException, NumberFormatException, TeEngineMlException, ParserRunException, NamedEntityRecognizerException, TextPreprocessorException, CoreferenceResolutionException, Rte6mainIOException, TreeCoreferenceInformationException, FileNotFoundException, IOException this.configurationFile.setExpandingEnvironmentVariables(true); preprocessParameters = configurationFile.getModuleConfiguration(RTE_SUM_PREPROCESS_MODULE_NAME); this.instruments = new InstrumentsFactory().getDefaultInstruments(preprocessParameters);
private void readConfigurationFile() throws ConfigurationFileDuplicateKeyException, ConfigurationException, NumberFormatException, TeEngineMlException, ParserRunException, NamedEntityRecognizerException, TextPreprocessorException configurationFile.setExpandingEnvironmentVariables(true); ConfigurationParams params = configurationFile.getModuleConfiguration(RTE_PAIRS_PREPROCESS_MODULE_NAME);