public static Env getNewEnv() { Env env = TokenSequencePattern.getNewEnv(); // Do case insensitive matching env.setDefaultStringPatternFlags(Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE); initEnv(env); return env; }
int stringMatchFlags = ignoreCaseEntry? (NodePattern.CASE_INSENSITIVE | NodePattern.UNICODE_CASE):0; Env env = TokenSequencePattern.getNewEnv(); env.setDefaultStringPatternFlags(patternFlags); env.setDefaultStringMatchFlags(stringMatchFlags);
if (matchLowerCaseContext){ env.get(label).setDefaultStringMatchFlags(NodePattern.CASE_INSENSITIVE | NodePattern.UNICODE_CASE); env.get(label).setDefaultStringPatternFlags(Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);
private void initEnv() { env = TokenSequencePattern.getNewEnv(); env.setDefaultTokensAnnotationKey(CoreAnnotations.NumerizedTokensAnnotation.class); // Do case insensitive matching env.setDefaultStringMatchFlags(Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE); env.setDefaultStringPatternFlags(Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE); try { Units.registerUnits(env, options.unitsFilename); } catch (IOException ex) { throw new RuntimeException("Error loading units from " + options.unitsFilename, ex); } try { UnitPrefix.registerPrefixes(env, options.prefixFilename); } catch (IOException ex) { throw new RuntimeException("Error loading prefixes from " + options.prefixFilename, ex); } env.bind("options", options); env.bind("numcomptype", CoreAnnotations.NumericCompositeTypeAnnotation.class); env.bind("numcompvalue", CoreAnnotations.NumericCompositeValueAnnotation.class); }
public TokensRegexAnnotator(String name, Properties props) { String prefix = (name == null)? "": name + '.'; String[] files = PropertiesUtils.getStringArray(props, prefix + "rules"); env = TokenSequencePattern.getNewEnv(); env.bind("options", options); if (PropertiesUtils.getBool(props, prefix+"caseInsensitive")) { System.err.println("using case insensitive!"); env.setDefaultStringMatchFlags(NodePattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE); env.setDefaultStringPatternFlags(Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE); } if (files.length != 0) { extractor = CoreMapExpressionExtractor.createExtractorFromFiles(env, files); } else { extractor = null; } verbose = PropertiesUtils.getBool(props, prefix + "verbose", false); options.setTokenOffsets = PropertiesUtils.getBool(props, prefix + "setTokenOffsets", options.setTokenOffsets); options.extractWithTokens = PropertiesUtils.getBool(props, prefix + "extractWithTokens", options.extractWithTokens); options.flatten = PropertiesUtils.getBool(props, prefix + "flatten", options.flatten); String matchedExpressionsAnnotationKeyName = props.getProperty(prefix + "matchedExpressionsAnnotationKey"); if (matchedExpressionsAnnotationKeyName != null) { options.matchedExpressionsAnnotationKey = EnvLookup.lookupAnnotationKeyWithClassname(env, matchedExpressionsAnnotationKeyName); if (options.matchedExpressionsAnnotationKey == null) { String propName = prefix + "matchedExpressionsAnnotationKey"; throw new RuntimeException("Cannot determine annotation key for " + propName + '=' + matchedExpressionsAnnotationKeyName); } } }
env.bind("time", new TimeFormatter.TimePatternExtractRuleCreator()); env.setDefaultStringPatternFlags(Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);
public static Env getNewEnv() { Env env = TokenSequencePattern.getNewEnv(); // Do case insensitive matching env.setDefaultStringPatternFlags(Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE); initEnv(env); return env; }
public static Env getNewEnv() { Env env = TokenSequencePattern.getNewEnv(); // Do case insensitive matching env.setDefaultStringPatternFlags(Pattern.CASE_INSENSITIVE); initEnv(env); return env; }
env.get(label).bind("$MOD", "[{tag:/JJ.*/}]"); if (matchLowerCaseContext) env.get(label).setDefaultStringPatternFlags(Pattern.CASE_INSENSITIVE); env.get(label).bind("OTHERSEM", PatternsAnnotations.OtherSemanticLabel.class);
int stringMatchFlags = ignoreCaseEntry? (NodePattern.CASE_INSENSITIVE | NodePattern.UNICODE_CASE):0; Env env = TokenSequencePattern.getNewEnv(); env.setDefaultStringPatternFlags(patternFlags); env.setDefaultStringMatchFlags(stringMatchFlags);
if (matchLowerCaseContext){ env.get(label).setDefaultStringMatchFlags(NodePattern.CASE_INSENSITIVE | NodePattern.UNICODE_CASE); env.get(label).setDefaultStringPatternFlags(Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);
private void initEnv() { env = TokenSequencePattern.getNewEnv(); env.setDefaultTokensAnnotationKey(CoreAnnotations.NumerizedTokensAnnotation.class); // Do case insensitive matching env.setDefaultStringMatchFlags(Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE); env.setDefaultStringPatternFlags(Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE); try { Units.registerUnits(env, options.unitsFilename); } catch (IOException ex) { throw new RuntimeException("Error loading units from " + options.unitsFilename, ex); } try { UnitPrefix.registerPrefixes(env, options.prefixFilename); } catch (IOException ex) { throw new RuntimeException("Error loading prefixes from " + options.prefixFilename, ex); } env.bind("options", options); env.bind("numcomptype", CoreAnnotations.NumericCompositeTypeAnnotation.class); env.bind("numcompvalue", CoreAnnotations.NumericCompositeValueAnnotation.class); }
int stringMatchFlags = ignoreCase? NodePattern.CASE_INSENSITIVE:0; Env env = TokenSequencePattern.getNewEnv(); env.setDefaultStringPatternFlags(patternFlags); env.setDefaultStringMatchFlags(stringMatchFlags); NodePattern<String> posTagPattern = (validPosPattern != null && PosMatchType.MATCH_ALL_TOKENS.equals(posMatchType))?
public TokensRegexAnnotator(String name, Properties props) { String prefix = (name == null)? "": name + '.'; String[] files = PropertiesUtils.getStringArray(props, prefix + "rules"); env = TokenSequencePattern.getNewEnv(); env.bind("options", options); if (PropertiesUtils.getBool(props, prefix+"caseInsensitive")) { System.err.println("using case insensitive!"); env.setDefaultStringMatchFlags(NodePattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE); env.setDefaultStringPatternFlags(Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE); } if (files.length != 0) { extractor = CoreMapExpressionExtractor.createExtractorFromFiles(env, files); } else { extractor = null; } verbose = PropertiesUtils.getBool(props, prefix + "verbose", false); options.setTokenOffsets = PropertiesUtils.getBool(props, prefix + "setTokenOffsets", options.setTokenOffsets); options.extractWithTokens = PropertiesUtils.getBool(props, prefix + "extractWithTokens", options.extractWithTokens); options.flatten = PropertiesUtils.getBool(props, prefix + "flatten", options.flatten); String matchedExpressionsAnnotationKeyName = props.getProperty(prefix + "matchedExpressionsAnnotationKey"); if (matchedExpressionsAnnotationKeyName != null) { options.matchedExpressionsAnnotationKey = EnvLookup.lookupAnnotationKeyWithClassname(env, matchedExpressionsAnnotationKeyName); if (options.matchedExpressionsAnnotationKey == null) { String propName = prefix + "matchedExpressionsAnnotationKey"; throw new RuntimeException("Cannot determine annotation key for " + propName + '=' + matchedExpressionsAnnotationKeyName); } } }
env.bind("time", new TimeFormatter.TimePatternExtractRuleCreator()); env.setDefaultStringPatternFlags(Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);
env.bind("time", new TimeFormatter.TimePatternExtractRuleCreator()); env.setDefaultStringPatternFlags(Pattern.CASE_INSENSITIVE);