예제 #1
0
        public bool IsMatchExcluded(MprFeatureSet mprFeats, out MprFeatureGroup mismatchGroup)
        {
            foreach (IGrouping <MprFeatureGroup, MprFeature> group in this.GroupBy(mf => mf.Group))
            {
                if (group.Key == null || group.Key.MatchType == MprFeatureGroupMatchType.All)
                {
                    if (group.Any(mf => mprFeats.Contains(mf)))
                    {
                        mismatchGroup = group.Key;
                        return(false);
                    }
                }
                else
                {
                    if (group.All(mf => mprFeats.Contains(mf)))
                    {
                        mismatchGroup = group.Key;
                        return(false);
                    }
                }
            }

            mismatchGroup = null;
            return(true);
        }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LexEntry"/> class.
 /// </summary>
 public LexEntry()
 {
     MprFeatures                    = new MprFeatureSet();
     SyntacticFeatureStruct         = FeatureStruct.New().Value;
     _allomorphs                    = new ObservableCollection <RootAllomorph>();
     _allomorphs.CollectionChanged += AllomorphsChanged;
 }
예제 #3
0
파일: Word.cs 프로젝트: papeh/hermitcrab
 public Word(RootAllomorph rootAllomorph, FeatureStruct realizationalFS)
 {
     _allomorphs  = new Dictionary <string, Allomorph>();
     _mprFeatures = new MprFeatureSet();
     _shape       = rootAllomorph.Segments.Shape.DeepClone();
     ResetDirty();
     SetRootAllomorph(rootAllomorph);
     RealizationalFeatureStruct = realizationalFS;
     _mrules                      = new Stack <IMorphologicalRule>();
     _mrulesUnapplied             = new Dictionary <IMorphologicalRule, int>();
     _mrulesApplied               = new Dictionary <IMorphologicalRule, int>();
     _nonHeads                    = new Stack <Word>();
     _obligatorySyntacticFeatures = new IDBearerSet <Feature>();
     _isLastAppliedRuleFinal      = null;
 }
예제 #4
0
파일: Word.cs 프로젝트: papeh/hermitcrab
 public Word(Stratum stratum, Shape shape)
 {
     _allomorphs = new Dictionary <string, Allomorph>();
     Stratum     = stratum;
     _shape      = shape;
     ResetDirty();
     SyntacticFeatureStruct     = new FeatureStruct();
     RealizationalFeatureStruct = new FeatureStruct();
     _mprFeatures                 = new MprFeatureSet();
     _mrules                      = new Stack <IMorphologicalRule>();
     _mrulesUnapplied             = new Dictionary <IMorphologicalRule, int>();
     _mrulesApplied               = new Dictionary <IMorphologicalRule, int>();
     _nonHeads                    = new Stack <Word>();
     _obligatorySyntacticFeatures = new IDBearerSet <Feature>();
     _isLastAppliedRuleFinal      = null;
     _isPartial                   = false;
 }
예제 #5
0
파일: Word.cs 프로젝트: papeh/hermitcrab
 protected Word(Word word)
 {
     _allomorphs                  = new Dictionary <string, Allomorph>(word._allomorphs);
     Stratum                      = word.Stratum;
     _shape                       = word._shape.DeepClone();
     _rootAllomorph               = word._rootAllomorph;
     SyntacticFeatureStruct       = word.SyntacticFeatureStruct.DeepClone();
     RealizationalFeatureStruct   = word.RealizationalFeatureStruct.DeepClone();
     _mprFeatures                 = word.MprFeatures.DeepClone();
     _mrules                      = new Stack <IMorphologicalRule>(word._mrules.Reverse());
     _mrulesUnapplied             = new Dictionary <IMorphologicalRule, int>(word._mrulesUnapplied);
     _mrulesApplied               = new Dictionary <IMorphologicalRule, int>(word._mrulesApplied);
     _nonHeads                    = new Stack <Word>(word._nonHeads.Reverse().DeepClone());
     _obligatorySyntacticFeatures = new IDBearerSet <Feature>(word._obligatorySyntacticFeatures);
     _isLastAppliedRuleFinal      = word._isLastAppliedRuleFinal;
     _isPartial                   = word._isPartial;
     CurrentTrace                 = word.CurrentTrace;
 }
예제 #6
0
        public void AddOutput(MprFeatureSet mprFeats)
        {
            foreach (MprFeatureGroup group in mprFeats.Groups)
            {
                if (group.Output == MprFeatureGroupOutput.Overwrite)
                {
                    foreach (MprFeature mprFeat in group.MprFeatures)
                    {
                        if (!mprFeats.Contains(mprFeat))
                        {
                            Remove(mprFeat);
                        }
                    }
                }
            }

            UnionWith(mprFeats);
        }