public MorphoFeatures(Edu.Stanford.Nlp.International.Morph.MorphoFeatures other) : this() { foreach (KeyValuePair <MorphoFeatureSpecification.MorphoFeatureType, string> entry in other.fSpec) { this.fSpec[entry.Key] = entry.Value; } this.altTag = other.altTag; }
public virtual int NumFeatureMatches(Edu.Stanford.Nlp.International.Morph.MorphoFeatures other) { int nMatches = 0; foreach (KeyValuePair <MorphoFeatureSpecification.MorphoFeatureType, string> fPair in fSpec) { if (other.HasFeature(fPair.Key) && other.GetValue(fPair.Key).Equals(fPair.Value)) { nMatches++; } } return(nMatches); }
/// <summary>Assumes that the tag string has been formed using a call to getTag().</summary> /// <remarks> /// Assumes that the tag string has been formed using a call to getTag(). As such, /// it removes the basic category from the feature string. /// <p> /// Note that this method returns a <b>new</b> MorphoFeatures object. As a result, it /// behaves like a static method, but is non-static so that subclasses can override /// this method. /// </remarks> /// <param name="str"/> public virtual Edu.Stanford.Nlp.International.Morph.MorphoFeatures FromTagString(string str) { IList <string> feats = Arrays.AsList(str.Split("\\-")); Edu.Stanford.Nlp.International.Morph.MorphoFeatures mFeats = new Edu.Stanford.Nlp.International.Morph.MorphoFeatures(); foreach (string fPair in feats) { string[] keyValue = fPair.Split(KeyValDelim); if (keyValue.Length != 2) { //Manual state split annotations continue; } MorphoFeatureSpecification.MorphoFeatureType fName = MorphoFeatureSpecification.MorphoFeatureType.ValueOf(keyValue[0].Trim()); mFeats.AddFeature(fName, keyValue[1].Trim()); } return(mFeats); }