Example #1
0
        public ICollection <ISentence> ReplaceWordWithString(string str, int number, Parsing parser, int length)
        {
            ICollection <ISentence> newCollection = DuplicateCollection();
            ISentence sentence = newCollection.ElementAt(number);

            foreach (var component in sentence.ComponentsCollection)
            {
                if (component.GetType() == typeof(Word))
                {
                    if ((component as Word).Component.Length == length)
                    {
                        (component as Word).Component = str;
                    }
                }
            }
            string buffer = null;

            foreach (var component in sentence.ComponentsCollection)
            {
                buffer += component.Component;
            }
            sentence.ComponentsCollection = parser.GetSentenceComponent(buffer);
            return(newCollection);
        }