Exemple #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);
        }
Exemple #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;
 }
Exemple #3
0
 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;
 }
Exemple #4
0
 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;
 }
Exemple #5
0
 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;
 }
Exemple #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);
        }