Ejemplo n.º 1
0
        private byte[] GetReply(byte[] bytes)
        {
            var command = Serialize.ByteArrayToObject(bytes);

            if (!(command is GetWordsByPrefixCommand getWordsByPrefix))
            {
                return(new byte[0]);
            }

            var prefix = getWordsByPrefix.Body;
            var result = dictionaryReader.GetMostFrequenciesWords(prefix, 5).ToArray();

            return(Serialize.ObjectToByteArray(result));
        }
Ejemplo n.º 2
0
        private static void ProcessInput(IDictionaryReader dictionaryReader)
        {
            var input = Input.ReadLineWithCancel();

            while (!string.IsNullOrWhiteSpace(input))
            {
                logger.Debug(input);
                var result = dictionaryReader
                             .GetMostFrequenciesWords(input, Count).ToList();
                result.ForEach(w => Console.WriteLine(w));
                Console.WriteLine();
                input = Input.ReadLineWithCancel();
            }
        }