コード例 #1
0
        public virtual void ApplyPats(ICounter <E> patterns, string label, TwoDimensionalCounter <CandidatePhrase, E> wordsandLemmaPatExtracted, CollectionValuedMap <E, Triple <string, int, int> > matchedTokensByPat, ICollection <CandidatePhrase> alreadyLabeledWords
                                      )
        {
            //   Counter<E> patternsLearnedThisIterConsistsOnlyGeneralized = new ClassicCounter<E>();
            //   Counter<E> patternsLearnedThisIterRest = new ClassicCounter<E>();
            //    Set<String> specialWords = constVars.invertedIndex.getSpecialWordsList();
            foreach (KeyValuePair <string, Env> en in constVars.env)
            {
                en.Value.GetVariables().PutAll(ConstantsAndVariables.globalEnv.GetVariables());
            }
            IDictionary <E, IDictionary <string, DataInstance> > sentencesForPatterns = GetSentences(constVars.invertedIndex.QueryIndex(patterns.KeySet()));

            foreach (KeyValuePair <E, IDictionary <string, DataInstance> > en_1 in sentencesForPatterns)
            {
                RunParallelApplyPats(en_1.Value, label, en_1.Key, wordsandLemmaPatExtracted, matchedTokensByPat, alreadyLabeledWords);
            }
            Redwood.Log(Redwood.Dbg, "# words/lemma and pattern pairs are " + wordsandLemmaPatExtracted.Size());
        }