private void AddRareTemplatesNew(History h, string tag) { // Feature templates rare if (!(maxentTagger.IsRare(ExtractorFrames.cWord.Extract(h)))) { return; } int start = numFeatsGeneral; for (int i = start; i < numFeatsAll; i++) { string s = maxentTagger.extractorsRare.Extract(i - start, h); if (s.Equals(zeroSt)) { continue; } //do not add the feature //only this tag FeatureKey key = new FeatureKey(i, s, tag); if (!maxentTagger.extractorsRare.Get(i - start).Precondition(tag)) { continue; } Add(key); } }
protected internal TaggerFeature(int start, int end, FeatureKey key, int yTag, TaggerExperiments domain) { this.start = start; this.end = end; this.key = key; this.domain = domain; this.yTag = yTag; }
/// <summary>Adds a FeatureKey to the set of known FeatureKeys.</summary> /// <param name="s">The feature key to be added</param> /// <returns>Whether the key was already known (false) or added (true)</returns> protected internal virtual bool Add(FeatureKey s) { if ((sTemplates.Contains(s))) { return(false); } sTemplates.Add(s); return(true); }
// Add a new feature key in a hashtable of feature templates private void AddTemplatesNew(History h, string tag) { // Feature templates general for (int i = 0; i < numFeatsGeneral; i++) { string s = maxentTagger.extractors.Extract(i, h); if (s.Equals(zeroSt)) { continue; } //do not add the feature //iterate over tags in dictionary //only this tag FeatureKey key = new FeatureKey(i, s, tag); if (!maxentTagger.extractors.Get(i).Precondition(tag)) { continue; } Add(key); } }
protected internal virtual int[] GetPositions(FeatureKey s) { Pair <int, string> p = new Pair <int, string>(s.num, s.val); return(tempHash[p].GetPositions()); }
protected internal virtual void AddPositions(int start, int end, FeatureKey fK) { Pair <int, string> key = new Pair <int, string>(fK.num, fK.val); tempHash[key].AddPositions(start, end); }