Example #1
0
        private void AddWordElements(WordBank wordBank)
        {
            Console.WriteLine("Adding base words...");

            var symbolMapProvided             = !string.IsNullOrWhiteSpace(_symbolMap);
            ICharacterModifier symbolModifier = null;

            if (symbolMapProvided)
            {
                symbolModifier = new CharacterSymbolModifier(_symbolMap);
            }
            var caseModifier = new CharacterCaseModifier();

            foreach (var inputElement in _inputElements)
            {
                WordElement wordElement = new WordElement(inputElement.Key);

                Console.Write($"Word: '{inputElement.Key}'");

                var characterModifiers = new List <ICharacterModifier>();
                if (symbolMapProvided && inputElement.Value.SymbolVariation)
                {
                    Console.Write(" + symbol substitution");
                    wordElement.AddCharacterModifier(symbolModifier);
                }
                if (inputElement.Value.CaseVariation)
                {
                    Console.Write(" + case variation");
                    wordElement.AddCharacterModifier(caseModifier);
                }

                Console.Write(" ... ");
                wordElement.GenerateCharacterVariations();
                Console.WriteLine($"{wordElement.Count} variants");
                wordBank.AddWord(wordElement);
            }

            Console.WriteLine();
        }