public TokensRegexAnnotator(string name, Properties props) { string prefix = (name == null) ? string.Empty : name + '.'; string[] files = PropertiesUtils.GetStringArray(props, prefix + "rules"); env = TokenSequencePattern.GetNewEnv(); env.Bind("options", options); if (PropertiesUtils.GetBool(props, prefix + "caseInsensitive")) { System.Console.Error.WriteLine("using case insensitive!"); env.SetDefaultStringMatchFlags(NodePattern.CaseInsensitive | Pattern.UnicodeCase); env.SetDefaultStringPatternFlags(Pattern.CaseInsensitive | Pattern.UnicodeCase); } 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 Exception("Cannot determine annotation key for " + propName + '=' + matchedExpressionsAnnotationKeyName); } } }
public Dictionaries(Properties props) : this(props.GetProperty(Constants.DemonymProp, DefaultPaths.DefaultDcorefDemonym), props.GetProperty(Constants.AnimateProp, DefaultPaths.DefaultDcorefAnimate), props.GetProperty(Constants.InanimateProp, DefaultPaths.DefaultDcorefInanimate), props.GetProperty(Constants.MaleProp), props.GetProperty(Constants.NeutralProp), props.GetProperty(Constants.FemaleProp), props.GetProperty(Constants.PluralProp), props.GetProperty(Constants.SingularProp), props.GetProperty(Constants.StatesProp , DefaultPaths.DefaultDcorefStates), props.GetProperty(Constants.GenderNumberProp, DefaultPaths.DefaultDcorefGenderNumber), props.GetProperty(Constants.CountriesProp, DefaultPaths.DefaultDcorefCountries), props.GetProperty(Constants.StatesProvincesProp , DefaultPaths.DefaultDcorefStatesAndProvinces), props.GetProperty(Constants.SievesProp, Constants.Sievepasses).Contains("CorefDictionaryMatch"), PropertiesUtils.GetStringArray(props, Constants.DictListProp, new string[] { DefaultPaths.DefaultDcorefDict1 , DefaultPaths.DefaultDcorefDict2, DefaultPaths.DefaultDcorefDict3, DefaultPaths.DefaultDcorefDict4 }), props.GetProperty(Constants.DictPmiProp, DefaultPaths.DefaultDcorefDict1), props.GetProperty(Constants.SignaturesProp, DefaultPaths.DefaultDcorefNeSignatures )) { }
/// <exception cref="System.TypeLoadException"/> /// <exception cref="System.IO.IOException"/> public Dictionaries(Properties props) : this(props.GetProperty(HybridCorefProperties.LangProp, HybridCorefProperties.LanguageDefault.ToLanguageTag()), props.GetProperty(HybridCorefProperties.DemonymProp, DefaultPaths.DefaultDcorefDemonym), props.GetProperty(HybridCorefProperties .AnimateProp, DefaultPaths.DefaultDcorefAnimate), props.GetProperty(HybridCorefProperties.InanimateProp, DefaultPaths.DefaultDcorefInanimate), props.GetProperty(HybridCorefProperties.MaleProp), props.GetProperty(HybridCorefProperties.NeutralProp ), props.GetProperty(HybridCorefProperties.FemaleProp), props.GetProperty(HybridCorefProperties.PluralProp), props.GetProperty(HybridCorefProperties.SingularProp), props.GetProperty(HybridCorefProperties.StatesProp, DefaultPaths.DefaultDcorefStates ), props.GetProperty(HybridCorefProperties.GenderNumberProp, HybridCorefProperties.GetGenderNumber(props)), props.GetProperty(HybridCorefProperties.CountriesProp, DefaultPaths.DefaultDcorefCountries), props.GetProperty(HybridCorefProperties .StatesProvincesProp, DefaultPaths.DefaultDcorefStatesAndProvinces), HybridCorefProperties.GetSieves(props).Contains("CorefDictionaryMatch"), PropertiesUtils.GetStringArray(props, HybridCorefProperties.DictListProp, new string[] { DefaultPaths .DefaultDcorefDict1, DefaultPaths.DefaultDcorefDict2, DefaultPaths.DefaultDcorefDict3, DefaultPaths.DefaultDcorefDict4 }), props.GetProperty(HybridCorefProperties.DictPmiProp, DefaultPaths.DefaultDcorefDict1), props.GetProperty(HybridCorefProperties .SignaturesProp, DefaultPaths.DefaultDcorefNeSignatures)) { // if(Boolean.parseBoolean(props.getProperty("useValDictionary"))) { // log.info("LOAD: ValDictionary"); // for(String line : IOUtils.readLines(valDict)) { // String[] split = line.toLowerCase().split("\t"); // strToEntity.put(split[0], split[2]); // dictScore.setCount(split[0], Double.parseDouble(split[1])); // } // } /*if(CorefProperties.useSemantics(props)) { * loadSemantics(props); * } else { * log.info("SEMANTICS NOT LOADED"); * }*/ if (props.Contains("coref.zh.dict")) { LoadChineseGenderNumberAnimacy(props.GetProperty("coref.zh.dict")); } }