Exemple #1
0
        public bool IsDerivableFrom(IEarleyData data)
        {
            var typedData = (OrientedTreeNode)data;

            if (this.IsAdjunctionTree == AdjunctionType.Complex)
            {
                throw new InvalidOperationException("Complexe adjunction is not supported (yet).");
            }

            return(this.RootNode.Name == typedData.Node.Name &&
                   (typedData.Node.AcceptsAdjunction &&
                    (this.IsAdjunctionTree == AdjunctionType.Left && typedData.Direction == Direction.Right ||
                     this.IsAdjunctionTree == AdjunctionType.Right && typedData.Direction == Direction.Left) ||
                    this.IsAdjunctionTree == AdjunctionType.None && typedData.Node.AcceptsSubstitution));
        }
 public bool IsDerivableFrom(IEarleyData data)
 {
     return(this.Left.Equals(data));
 }
Exemple #3
0
 public IEnumerable <IEarleyGrammarRule> GetRulesWithLeft(IEarleyData left)
 {
     return(this.rules.Where(rule => rule.IsDerivableFrom(left)));
 }