/** * Returns a RegexNamefinder that will utilize specified default regexes. * * @param defaults the OpenNLP default regexes * @return {@link RegexNameFinder} */ public static synchronized RegexNameFinder getDefaultRegexNameFinders( DEFAULT_REGEX_NAME_FINDER... defaults) { Objects.requireNonNull(defaults, "defaults must not be null"); return new RegexNameFinder(defaultsToMap(defaults)); }
@Before public void setUp() { regexNameFinder = RegexNameFinderFactory.getDefaultRegexNameFinders( RegexNameFinderFactory.DEFAULT_REGEX_NAME_FINDER.DEGREES_MIN_SEC_LAT_LON, RegexNameFinderFactory.DEFAULT_REGEX_NAME_FINDER.EMAIL, RegexNameFinderFactory.DEFAULT_REGEX_NAME_FINDER.MGRS, RegexNameFinderFactory.DEFAULT_REGEX_NAME_FINDER.USA_PHONE_NUM, RegexNameFinderFactory.DEFAULT_REGEX_NAME_FINDER.URL); }
/** * Allows for use of selected Defaults as well as regexes from external * configuration * * @param config a map where the key is a type, and the value is a * Pattern[]. If the keys clash with default keys, the config * map will win * @param defaults the OpenNLP default regexes * @return {@link RegexNameFinder} */ public static synchronized RegexNameFinder getDefaultRegexNameFinders( Map<String, Pattern[]> config, DEFAULT_REGEX_NAME_FINDER... defaults) { Objects.requireNonNull(config, "config must not be null"); Map<String, Pattern[]> defaultsToMap = new HashMap<>(); if (defaults != null) { defaultsToMap = defaultsToMap(defaults); } defaultsToMap.putAll(config); return new RegexNameFinder(defaultsToMap); }
/** * Returns a RegexNamefinder that will utilize specified default regexes. * * @param defaults the OpenNLP default regexes * @return {@link RegexNameFinder} */ public static synchronized RegexNameFinder getDefaultRegexNameFinders( DEFAULT_REGEX_NAME_FINDER... defaults) { Objects.requireNonNull(defaults, "defaults must not be null"); return new RegexNameFinder(defaultsToMap(defaults)); }
/** * Returns a RegexNamefinder that will utilize specified default regexes. * * @param defaults the OpenNLP default regexes * @return {@link RegexNameFinder} */ public static synchronized RegexNameFinder getDefaultRegexNameFinders( DEFAULT_REGEX_NAME_FINDER... defaults) { Objects.requireNonNull(defaults, "defaults must not be null"); return new RegexNameFinder(defaultsToMap(defaults)); }
/** * Allows for use of selected Defaults as well as regexes from external * configuration * * @param config a map where the key is a type, and the value is a * Pattern[]. If the keys clash with default keys, the config * map will win * @param defaults the OpenNLP default regexes * @return {@link RegexNameFinder} */ public static synchronized RegexNameFinder getDefaultRegexNameFinders( Map<String, Pattern[]> config, DEFAULT_REGEX_NAME_FINDER... defaults) { Objects.requireNonNull(config, "config must not be null"); Map<String, Pattern[]> defaultsToMap = new HashMap<>(); if (defaults != null) { defaultsToMap = defaultsToMap(defaults); } defaultsToMap.putAll(config); return new RegexNameFinder(defaultsToMap); }
/** * Allows for use of selected Defaults as well as regexes from external * configuration * * @param config a map where the key is a type, and the value is a * Pattern[]. If the keys clash with default keys, the config * map will win * @param defaults the OpenNLP default regexes * @return {@link RegexNameFinder} */ public static synchronized RegexNameFinder getDefaultRegexNameFinders( Map<String, Pattern[]> config, DEFAULT_REGEX_NAME_FINDER... defaults) { Objects.requireNonNull(config, "config must not be null"); Map<String, Pattern[]> defaultsToMap = new HashMap<>(); if (defaults != null) { defaultsToMap = defaultsToMap(defaults); } defaultsToMap.putAll(config); return new RegexNameFinder(defaultsToMap); }