Exemplo n.º 1
0
        internal void AddNext(string phrase, PhraseReader reader)
        {
            var token = reader.Read();

            if (token == null)
            {
                this.Phrase = phrase;
                return;
            }

            var nextPortion = (PhrasePortion)this.NextPortions[token.Portion];

            if (nextPortion == null)
            {
                nextPortion = new PhrasePortion(token.Portion);
                this.NextPortions[token.Portion] = nextPortion;
            }

            nextPortion.AddNext(phrase, reader);
        }
Exemplo n.º 2
0
        public void AddPhrase(string phrase)
        {
            if (string.IsNullOrWhiteSpace(phrase))
            {
                return;
            }

            phrase = phrase.Trim();
            var reader = new PhraseReader(phrase);

            var token   = reader.Read();
            var portion = (PhrasePortion)dictionary[token.Portion];

            if (portion == null)
            {
                portion = new PhrasePortion(token.Portion);
                dictionary[token.Portion] = portion;
            }

            portion.AddNext(phrase, reader);
        }