示例#1
0
        private IProcessable ProcessElement(Numeral num, ISentenceGraph graph)
        {
            num.DependencyType    = this.DependencyType;
            this.DependingNumeral = num;

            return(this);
        }
示例#2
0
        private IProcessable ProcessElement(Numeral num, ISentenceGraph graph)
        {
            IProcessable processElem = this;

            num.DependingDrawables.ForEach(dd => processElem = processElem.Process(dd, graph));
            num.DependingActions.ForEach(da => processElem   = processElem.Process(da, graph));
            this.Process(num.DependingNumeral, graph);

            // Process appositional
            if (this.DependencyHelper.IsAppositional(num.DependencyType))
            {
                return(processElem);
            }

            // Process numeral expressing part of noun phrase
            if (this.DependencyHelper.IsNounPhrase(this.DependencyType) || this.DependencyHelper.IsCompound(this.DependencyType))
            {
                this.Extensions.Add(num);
                return(processElem);
            }

            // We don't process time
            if (this.DependencyHelper.IsTime(num.DependencyType))
            {
                return(processElem);
            }

            // Add extension if numeral is not modifying number of instances
            if (!this.DependencyHelper.IsNumeralModifier(num.DependencyType))
            {
                if (num.Id > this.Id)
                {
                    this.Suffixes.Add(num);
                }
                else
                {
                    this.Extensions.Add(num);
                }

                return(processElem);
            }

            // no need to create noun set
            if (num.GetValue() <= 1)
            {
                return(processElem);
            }

            // Create new noun with given number of values
            return(new NounSet(this.ElementFactory, this.EdgeFactory, this, num.GetValue()));
        }
示例#3
0
        private IProcessable ProcessElement(Numeral num, ISentenceGraph graph)
        {
            // Appositinal represents offset to nouns in the set
            if (this.DependencyTypeHelper.IsAppositional(num.DependencyType) && num.GetValue() < this.NumberOfInstances)
            {
                this.GetAllNouns();

                for (int i = this.LastProcessedNoun; i <= num.GetValue() - 1 + LastProcessedNoun; i++)
                {
                    num.DependingDrawables.ForEach(dd => this.Nouns[i].Process(dd, graph));
                    num.DependingActions.ForEach(da => this.Nouns[i].Process(da, graph));
                }

                LastProcessedNoun += num.GetValue();
                this.Process(num.DependingNumeral, graph);
                return(this);
            }

            // We don't process time
            if (this.DependencyTypeHelper.IsTime(num.DependencyType))
            {
                return(this);
            }

            // Process if not numeral modifier
            if (!this.DependencyTypeHelper.IsNumeralModifier(num.DependencyType))
            {
                this.Nouns.ForEach(noun => noun.Process(num, graph));
                return(this);
            }

            // Generate number of instances with given value
            this.NumberOfInstances = num.GetValue();
            this.GenerateNouns(num.GetValue());
            return(this);
        }