VendingMachine.Console.AbstractConsoleReadBuffer.MakeDictionary C# (CSharp) Method

MakeDictionary() private method

private MakeDictionary ( IEnumerable inPhrases ) : IEnumerable
inPhrases IEnumerable
return IEnumerable
        private IEnumerable<string> MakeDictionary(IEnumerable<string> inPhrases)
        {
            return inPhrases
                .Select(p => p.Split(' '))
                .SelectMany(words => words.Select((_, i) => string.Join(" ", words, 0, i+1)))
                .GroupBy(item => item)
                .Select(item => item.Key)
                .ToList()
            ;
        }