public Redis(ConfigurationParams params) throws ConfigurationException { this.dbFile = params.get(Configuration.REDIS_FILE); this.jedis = null; this.currID = -1; this.bVM = false; try { bVM = params.getBoolean(eu.excitementproject.eop.redis.Configuration.REDIS_VM); } catch (ConfigurationException e) {} }
public WordnetLexicalResource(ConfigurationParams params) throws LexicalResourceException, ConfigurationException { this( params.getDirectory(PARAM_WN_DIR), params.getBoolean(PARAM_ONLY_FIRST_LEFT), params.getBoolean(PARAM_ONLY_FIRST_RIGHT), params.getEnumSet(WordNetRelation.class, PARAM_DEFAULT_RELATIONS), params.getInt(PARAM_CHAINING_LENGTH), params.containsKey(PARAM_WORDNET_DICTIONARY_IMPLEMENTATION_TYPE) ? params.getEnum(WordnetDictionaryImplementationType.class, PARAM_WORDNET_DICTIONARY_IMPLEMENTATION_TYPE) : null); }
public WikiLexicalResource(ConfigurationParams params) throws LexicalResourceException, ConfigurationException { this( params.getFile(PARAM_STOP_WORDS), WikiExtractionType.parseExtractionTypeListOfStrings(params.getString(PARAM_EXTRACTION_TYPES)), params.getString(PARAM_DB_CONN_STRING), null, null, params.getDouble(PARAM_COOCURRENCE_THRESHOLD)); }
/** * Ctor with {@link ConfigurationParams} * @throws LexicalResourceException * @throws ConfigurationException */ public LinProximityOriginalLexicalResource(ConfigurationParams params) throws LexicalResourceException, ConfigurationException { this(params.getString(PARAM_CONNECTION_STRING), null, null, params.getInt(PARAM_RULES_LIMIT) ); }
public WiktionaryLexicalResource(ConfigurationParams params) throws LexicalResourceException, ConfigurationException { this( params.getString(PARAM_WKT_DIRECTORY), params.getString(PARAM_POS_TAGGER_MODEL_FILE), params.getInt(PARAM_LEFT_SENSE), params.getInt(PARAM_RIGHT_SENSE), params.getBoolean(PARAM_USE_ENTRY_INFO), params.getEnumSet(WiktionaryRelation.class, PARAM_RELATIONS)); }
private File retrieveDatasetDirAndSetFileSystemNames(ConfigurationParams configurationParams) throws ConfigurationException, TeEngineMlException String datasetParameterValue = configurationParams.get(RTE_SUM_DATASET_DIR_NAME); String[] datasetValueComponents = datasetParameterValue.split(RTESUM_DATASET_PARAM_DELIMITER); Iterator<String> datasetValueIterator = Utils.arrayToCollection(datasetValueComponents, new LinkedList<String>()).iterator(); if (configurationParams.containsKey(RTE_SUM_IS_NOVELTY_TASK_FLAG)) isNoveltyTask = configurationParams.getBoolean(RTE_SUM_IS_NOVELTY_TASK_FLAG); logger.info("Loading " + (isNoveltyTask ? "Novelty" : "Main") + " task files");
String bartServer = null; String bartPort = null; if (params.containsKey(PREPROCESS_COREFERENCE_RESOLUTION_ENGINE)) corefChoice = params.getEnum(CoreferenceEngineChoice.class, PREPROCESS_COREFERENCE_RESOLUTION_ENGINE); bartServer = params.get(PREPROCESS_BART_SERVER); if (params.containsKey(PREPROCESS_BART_PORT)) bartPort = params.get(PREPROCESS_BART_PORT); String stanfordNERClassifierPath = params.getFile(PREPROCESS_STANFORD_NE_CLASSIFIER_PATH).getAbsolutePath(); boolean doNer = true; if (params.containsKey(PREPROCESS_DO_NER)) doNer = params.getBoolean(PREPROCESS_DO_NER);
public InsertionTool(ConfigurationParams params) throws ConfigurationException { try { m_driver = params.get("driver"); m_url = params.get("url"); m_username = params.get("username"); m_password = params.get("password"); m_insertionBatchSize=params.getInt("insertion batch size"); } catch (ConfigurationException e) { throw new ConfigurationException("Error getting parameters for Database connection. make sure you have values for driver,url,username and password params in Database module on the configuration file you supplied", e); } }
private boolean isHybridMode() throws ConfigurationException { boolean hybridMode = false; if (configurationParams.containsKey(RTE_ENGINE_GAP_HYBRID_MODE)) { hybridMode = configurationParams.getBoolean(RTE_ENGINE_GAP_HYBRID_MODE); } return hybridMode; }
redisDir = params.get(Configuration.REDIS_BIN_DIR); } catch (ConfigurationException e) {} int portRight = -1; try { hostLeft = params.get(Configuration.L2R_REDIS_HOST); portLeft = params.getInt(Configuration.L2R_REDIS_PORT); hostRight = params.get(Configuration.R2L_REDIS_HOST); portRight = params.getInt(Configuration.R2L_REDIS_PORT); } catch (ConfigurationException e) { bVM = params.getBoolean(Configuration.REDIS_VM); } catch (ConfigurationException e) { leftRules = (redisDir == null ? new RedisBasedStringListBasicMap(params.get(Configuration.L2R_REDIS_DB_FILE),bVM) : new RedisBasedStringListBasicMap(params.get(Configuration.L2R_REDIS_DB_FILE),redisDir,bVM)); rightRules = (redisDir == null ? new RedisBasedStringListBasicMap(params.get(Configuration.R2L_REDIS_DB_FILE),bVM) : new RedisBasedStringListBasicMap(params.get(Configuration.R2L_REDIS_DB_FILE), redisDir,bVM)); } catch (Exception e) { throw new RedisRunException(e);
loadFromSerFile = params.containsKey(TransformationsConfigurationParametersNames.DIRT_LIKE_SER_FILE_PARAMETER_NAME); File serFile = params.getFile(TransformationsConfigurationParametersNames.DIRT_LIKE_SER_FILE_PARAMETER_NAME); return new DirtDBRuleBase(serFile,ruleBaseName,parser); Class.forName(params.get(DB_DRIVER)); String dbUrl = params.get(DB_URL); Connection connection = DriverManager.getConnection(dbUrl); String templates = params.get(TEMPLATES_TABLE_NAME); String rules = params.get(RULES_TABLE_NAME); int limit = params.getInt(LIMIT_NUMBER_OF_RULES); DistSimParameters distSimParameters = new DistSimParameters(templates, rules, limit, Constants.DEFAULT_DIRT_LIKE_RESOURCES_CACHE_SIZE, Constants.DEFAULT_DIRT_LIKE_RESOURCES_CACHE_SIZE);
public LineBasedStringCountSentenceReader(ConfigurationParams params) { super(params); try { delimiter = params.get(Configuration.DELIMITER); } catch (ConfigurationException e) { delimiter = DEFAULT_DELIMITER; } }
Set<RuleWithConfidenceAndDescription<Info, BasicNode>> rulesWithConfidenceAndDescription; try { ObjectInputStream ois = new ObjectInputStream(new FileInputStream(resourceParams.getFile(TransformationsConfigurationParametersNames.SYNTACTIC_RULES_FILE))); try throw new OperationException("Error reading the syntactic rules set from "+resourceParams.get(TransformationsConfigurationParametersNames.SYNTACTIC_RULES_FILE), e); boolean useManual = resourceParams.getBoolean(MANUAL_FILE_RULEBASE_USE_PARAMETER_NAME); if (useManual) File rulesFile = new File(resourceParams.get(MANUAL_FILE_RULEBASE_FILE_PARAMETER_NAME)); boolean dynamicMode = resourceParams.getBoolean(MANUAL_FILE_RULEBASE_DYNAMIC_PARAMETER_NAME); FromTextFileRuleBase manualRuleBase = new FromTextFileRuleBase(rulesFile, dynamicMode); ruleBasesEnvelopes.put(resource.getDisplayName(),new RuleBaseEnvelope<Info, BasicNode>(manualRuleBase)); logger.info("Creating rule base for lexical chain"); if (logger.isDebugEnabled()){logger.info("Creating SimpleLexicalChainRuleBase");} int depth = resourceParams.getInt(TransformationsConfigurationParametersNames.SIMPLE_LEXICAL_CHAIN_DEPTH_PARAMETER_NAME); ConstructorOfLexicalResourcesForChain consturcotOfRules = new ConstructorOfLexicalResourcesForChain(this.configurationFile, resourceParams);
for (String extractionType : params.getStringArray(PARAM_EXTRACTION_TYPES)) extractionTypes.add(extractionType); } catch (ConfigurationException e) { this.m_limitOnRetrievedRules = params.getInt("limitOnRetrievedRules"); String classifierPathName; String classifierClassName; double NPBouns; classifierPathName = params.getString("classifierPath"); classifierClassName = params.getString("classifierClass"); NPBouns = params.getDouble("NPBouns");
PropertyConfigurator.configure(loggingParams.get(Configuration.PROPERTIES_FILE)); ElementSimilarityCombiner combiner = (ElementSimilarityCombiner)Factory.create(similarityCombinerParams.get(Configuration.CLASS),similarityCombinerParams); String storageClass = similarityCombinerParams.get(Configuration.STORAGE_DEVICE_CLASS); bSort = !similarityCombinerParams.getBoolean(Configuration.IS_SORTED); } catch (ConfigurationException e) { tmpSortDir = similarityCombinerParams.get(Configuration.TMP_DIR); } catch (ConfigurationException e) { PersistenceDevice combinedDevice = (PersistenceDevice)Factory.create(storageClass,new java.io.File(similarityCombinerParams.getString(Configuration.OUT_COMBINED_FILE)),false); combinedDevice.open(); SimilarityCombination similarityCombination = (SimilarityCombination)Factory.create(similarityCombinerParams.get(Configuration.SIMILARITY_COMBINATION_CLASS),similarityCombinerParams); String[] infiles = similarityCombinerParams.getStringArray(Configuration.IN_FILES);
public static EnglishSingleTreeParser getParser(ConfigurationParams params) throws TeEngineMlException, ParserRunException, ConfigurationException if ( (params.containsKey(PREPROCESS_EASYFIRST)) && (params.containsKey(PREPROCESS_MINIPAR)) ) throw new TeEngineMlException("The configuration file specify both easy first and minipar parsers, but only one of them should be specified, not both!"); if (params.containsKey(PREPROCESS_EASYFIRST)) String parameter = params.get(PREPROCESS_EASYFIRST); String host=null; Integer port=null; if (params.containsKey(ConfigurationParametersNames.PREPROCESS_EASYFIRST_HOST)) host = params.get(ConfigurationParametersNames.PREPROCESS_EASYFIRST_HOST); if (params.containsKey(ConfigurationParametersNames.PREPROCESS_EASYFIRST_PORT)) port = params.getInt(ConfigurationParametersNames.PREPROCESS_EASYFIRST_PORT); else if (params.containsKey(PREPROCESS_MINIPAR)) String parameter = params.get(PREPROCESS_EASYFIRST); ret = getParserMinipar(parameter);
if (params.containsKey("table_file")) { return mapFromTwoColumnsText( FileUtils.loadFileOrUrlToList(params.getString("table_file")), params.getString("table_separator")); } else if (params.containsKey("table_contents")) { return mapFromTwoColumnsText( params.getString("table_contents").split("[\n\r]+"), params.getString("table_separator")); } else if (params.containsKey("wiki_file")) { return mapFromWikiText( FileUtils.loadFileOrUrlToList(params.getString("wiki_file")), params.containsKey("add_heading_to_heading_match")? params.getBoolean("add_heading_to_heading_match"): false, params.containsKey("headings_are_keys")? params.getBoolean("headings_are_keys"): false ); } else if (params.containsKey("wiki_contents")) { return mapFromWikiText( params.getString("wiki_contents").split("[\n\r]+"), params.containsKey("add_heading_to_heading_match")? params.getBoolean("add_heading_to_heading_match"): false, params.containsKey("headings_are_keys")? params.getBoolean("headings_are_keys"): false ); } else {
public TextProParser(ConfigurationParams params) throws InstrumentCombinationException { try { this.textProPath = params.getString("textPro-path"); this.parser = params.get("parser"); this.parserPath = params.getString("parser-path"); this.encoding = params.getString("encoding"); } catch (ConfigurationException e) { throw new InstrumentCombinationException("Nested exception in reading the configuration file", e); } }
/** * Create an initialized NamedEntityRecognizer using the given configuration params. */ public static NamedEntityRecognizer createNamedEntityRecognizer(ConfigurationParams params) throws InstrumentCombinationException{ boolean doNer; try { doNer = (params.containsKey("do_named_entity_recognition")? params.getBoolean("do_named_entity_recognition"): false); if (doNer) { NamedEntityRecognizer ner = new StanfordNamedEntityRecognizer(new File(params.getFile("ner-classifier-path").getAbsolutePath())); ner.init(); return ner; } else return null; } catch (ConfigurationException e) { throw new InstrumentCombinationException("Nested exception with configuration file while initializing the NER", e); } catch (NamedEntityRecognizerException e) { throw new InstrumentCombinationException("Nested exception while initializing the NER", e); } } }
/** * @param params configuration params for initialization. Should include: * <li>table_file - path to the file that contains the rules, in table format. Can also be a URL. * <li>table_separator - pattern of column-separator, e.g. "->". * <li>part_of_speech - canonical name of the part-of-speech for this rule-base. For possible values, see {@link SimplerCanonicalPosTag}. * <li>relation_name - name of relation to put in rules (the same for all rules). * <li>minimum_seconds_between_loads (int) - The minimum number of seconds between each consecutive loads from the file. * <li>(NOTE: The params.getModuleName() is used as the resource_name). */ public OnlineFileBasedLexicalResource(ConfigurationParams params) throws UnsupportedPosTagStringException, IOException, ConfigurationException { super( null, params.getEnum(SimplerCanonicalPosTag.class, "part_of_speech"), params.getModuleName(), params.getString("relation_name")); this.file = params.getString("file"); this.separator = params.getString("separator"); this.minimumSecondsBetweenLoads = params.getInt("minimum_seconds_between_loads"); this.map = ValueSetMapFromStringCreator.mapFromConfigurationParams(params); }