Beispiel #1
0
        public void Enter(NewWordsService service)
        {
            var allWords = service.GetAll();

            RenderKnowledgeHistogram(allWords);
            Console.WriteLine();
            Console.WriteLine();
            RenderAddingTimeLine(allWords);
            RenderExamsTimeLine(service.GetAllExams());

            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();
            Console.WriteLine();

            Console.WriteLine($"Context phrases count = {service.GetContextPhraseCount()}");
            Console.WriteLine($"Words count = {allWords.Count(w=>!w.OriginWord.Contains(' '))}");
            Console.WriteLine($"Words and sentences count = {allWords.Length}");


            var groups = allWords
                         .GroupBy(s => s.State)
                         .OrderBy(s => (int)s.Key)
                         .Select(s => new { state = s.Key, count = s.Count() });

            var doneCount = allWords.Count(a => a.PassedScore >= PairModel.MaxExamScore);

            Console.WriteLine($"Done: {doneCount} words  ({(doneCount * 100 / allWords.Length)}%)");
            Console.WriteLine($"Unknown: {allWords.Length - doneCount} words");
            Console.WriteLine();
            var learningRate = GetLearningRate(allWords);

            Console.WriteLine("Score is " + learningRate);
            if (learningRate < 100)
            {
                Console.WriteLine("You has to add more words!");
            }
            else if (learningRate < 200)
            {
                Console.WriteLine("It's time to add new words!");
            }
            else if (learningRate < 300)
            {
                Console.WriteLine("Zen!");
            }
            else if (learningRate < 400)
            {
                Console.WriteLine("Let's do some exams");
            }
            else
            {
                Console.WriteLine("Exams exams exams!");
                Console.WriteLine($"You have to make at least {(learningRate-300)/10} more exams");
            }
        }
Beispiel #2
0
        public async Task Enter()
        {
            var allWords = _wordsService.GetAll();

            /*
             * //todo Histogram output
             *
             * var historgramMessage = new StringBuilder();
             * historgramMessage.Append("```\r\n");
             * RenderKnowledgeHistogram(allWords,historgramMessage);
             * historgramMessage.Append("```\r\n");
             * await _chat.SendMessage(historgramMessage.ToString());
             * historgramMessage.Clear();
             *
             * historgramMessage.Append("```\r\n");
             * RenderAddingTimeLine(allWords,historgramMessage);
             * historgramMessage.Append("```\r\n");
             * await _chat.SendMessage(historgramMessage.ToString());
             * historgramMessage.Clear();
             *
             * historgramMessage.Append("```\r\n");
             * RenderExamsTimeLine(_wordsService.GetAllExams(),historgramMessage);
             * historgramMessage.Append("```\r\n");
             * await _chat.SendMessage(historgramMessage.ToString());
             */

            var sb = new StringBuilder();

            sb.AppendLine($"Context phrases count = {_wordsService.GetContextPhraseCount()}");
            sb.AppendLine($"Words count = {allWords.Count(w=>!w.OriginWord.Contains(' '))}");
            sb.AppendLine($"Words and sentences count = {allWords.Length}");


            var groups = allWords
                         .GroupBy(s => s.State)
                         .OrderBy(s => (int)s.Key)
                         .Select(s => new { state = s.Key, count = s.Count() });

            var doneCount = allWords.Count(a => a.PassedScore >= PairModel.MaxExamScore);

            sb.AppendLine($"Done: {doneCount} words  ({(doneCount * 100 / allWords.Length)}%)");
            sb.AppendLine($"Unknown: {allWords.Length - doneCount} words");
            sb.AppendLine();
            var learningRate = GetLearningRate(allWords);

            Console.WriteLine("Score is " + learningRate);
            if (learningRate < 100)
            {
                sb.AppendLine("You have to add more words!");
            }
            else if (learningRate < 200)
            {
                sb.AppendLine("It's time to add new words!");
            }
            else if (learningRate < 300)
            {
                sb.AppendLine("Zen!");
            }
            else if (learningRate < 400)
            {
                sb.AppendLine("Let's do some exams");
            }
            else
            {
                sb.AppendLine("Exams exams exams!");
                sb.AppendLine($"You have to make at least {(learningRate-300)/10} more exams");
            }
            var __ = _chat.SendMessage(sb.ToString());
        }