Exemplo n.º 1
0
        // load sieve (from file or make a deterministic sieve)
        /// <exception cref="System.Exception"/>
        public static Edu.Stanford.Nlp.Coref.Hybrid.Sieve.Sieve LoadSieve(Properties props, string sievename)
        {
            switch (HybridCorefProperties.GetClassifierType(props, sievename))
            {
            case Sieve.ClassifierType.Rule:
            {
                // log.info("Loading sieve: "+sievename+" ...");
                DeterministicCorefSieve sieve = (DeterministicCorefSieve)Sharpen.Runtime.GetType("edu.stanford.nlp.coref.hybrid.sieve." + sievename).GetConstructor().NewInstance();
                sieve.props = props;
                sieve.lang  = HybridCorefProperties.GetLanguage(props);
                return(sieve);
            }

            case Sieve.ClassifierType.Rf:
            {
                log.Info("Loading sieve: " + sievename + " from " + HybridCorefProperties.GetPathModel(props, sievename) + " ... ");
                RFSieve rfsieve = IOUtils.ReadObjectFromURLOrClasspathOrFileSystem(HybridCorefProperties.GetPathModel(props, sievename));
                rfsieve.thresMerge = HybridCorefProperties.GetMergeThreshold(props, sievename);
                log.Info("done. Merging threshold: " + rfsieve.thresMerge);
                return(rfsieve);
            }

            case Sieve.ClassifierType.Oracle:
            {
                OracleSieve oracleSieve = new OracleSieve(props, sievename);
                oracleSieve.props = props;
                return(oracleSieve);
            }

            default:
            {
                throw new Exception("no sieve type specified");
            }
            }
        }
Exemplo n.º 2
0
 public Sieve(Properties props, string sievename)
 {
     this.lang        = HybridCorefProperties.GetLanguage(props);
     this.sievename   = sievename;
     this.aType       = HybridCorefProperties.GetAntecedentType(props, sievename);
     this.mType       = HybridCorefProperties.GetMentionType(props, sievename);
     this.maxSentDist = HybridCorefProperties.GetMaxSentDistForSieve(props, sievename);
     this.mTypeStr    = HybridCorefProperties.GetMentionTypeStr(props, sievename);
     this.aTypeStr    = HybridCorefProperties.GetAntecedentTypeStr(props, sievename);
 }