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); }
/// <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; }
public Word(RootAllomorph rootAllomorph, FeatureStruct realizationalFS) { _allomorphs = new Dictionary <string, Allomorph>(); _mprFeatures = new MprFeatureSet(); _shape = rootAllomorph.Segments.Shape.Clone(); ResetDirty(); SetRootAllomorph(rootAllomorph); RealizationalFeatureStruct = realizationalFS; _mruleApps = new List <IMorphologicalRule>(); _mrulesUnapplied = new Dictionary <IMorphologicalRule, int>(); _mrulesApplied = new Dictionary <IMorphologicalRule, int>(); _nonHeadApps = new List <Word>(); _obligatorySyntacticFeatures = new IDBearerSet <Feature>(); _isLastAppliedRuleFinal = null; }
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(); _mruleApps = new List <IMorphologicalRule>(); _mrulesUnapplied = new Dictionary <IMorphologicalRule, int>(); _mrulesApplied = new Dictionary <IMorphologicalRule, int>(); _nonHeadApps = new List <Word>(); _obligatorySyntacticFeatures = new IDBearerSet <Feature>(); _isLastAppliedRuleFinal = null; _isPartial = false; }
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); }
protected Word(Word word) { _allomorphs = new Dictionary <string, Allomorph>(word._allomorphs); Stratum = word.Stratum; _shape = word._shape.Clone(); _rootAllomorph = word._rootAllomorph; SyntacticFeatureStruct = word.SyntacticFeatureStruct.Clone(); RealizationalFeatureStruct = word.RealizationalFeatureStruct.Clone(); _mprFeatures = word.MprFeatures.Clone(); _mruleApps = new List <IMorphologicalRule>(word._mruleApps); _mruleAppIndex = word._mruleAppIndex; _mrulesUnapplied = new Dictionary <IMorphologicalRule, int>(word._mrulesUnapplied); _mrulesApplied = new Dictionary <IMorphologicalRule, int>(word._mrulesApplied); _nonHeadApps = new List <Word>(word._nonHeadApps.CloneItems()); _nonHeadAppIndex = word._nonHeadAppIndex; _obligatorySyntacticFeatures = new IDBearerSet <Feature>(word._obligatorySyntacticFeatures); _isLastAppliedRuleFinal = word._isLastAppliedRuleFinal; _isPartial = word._isPartial; CurrentTrace = word.CurrentTrace; }