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)); }
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(); } }