コード例 #1
0
        /// <exception cref="System.Exception"/>
        public static IList <Edu.Stanford.Nlp.Coref.Hybrid.Sieve.Sieve> LoadSieves(Properties props)
        {
            IList <Edu.Stanford.Nlp.Coref.Hybrid.Sieve.Sieve> sieves = new List <Edu.Stanford.Nlp.Coref.Hybrid.Sieve.Sieve>();
            string sieveProp            = HybridCorefProperties.GetSieves(props);
            string currentSieveForTrain = HybridCorefProperties.GetCurrentSieveForTrain(props);

            string[] sievenames = (currentSieveForTrain == null) ? sieveProp.Trim().Split(",\\s*") : sieveProp.Split(currentSieveForTrain)[0].Trim().Split(",\\s*");
            foreach (string sievename in sievenames)
            {
                Edu.Stanford.Nlp.Coref.Hybrid.Sieve.Sieve sieve = LoadSieve(props, sievename);
                sieves.Add(sieve);
            }
            return(sieves);
        }
コード例 #2
0
        /// <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"));
            }
        }