private string GetText(Vocable vocable, Language language) { var text = vocable.Words .Where(x => x.Language == language) .Select(x => x.Text) .Shuffle(_shuffleAlgorithm) .First(); return(text); }
private Question CreateQuestion(Vocable vocable) { var text = GetTextToTranslate(vocable); var correctAnswer = GetTranslation(vocable); var falseAnswers = GetIncorrectTranslations(vocable); var question = new Question(_shuffleAlgorithm, text, correctAnswer, falseAnswers); return(question); }
private IEnumerable <string> GetIncorrectTranslations(Vocable vocableToTranslate) { var falseTranslationsCandidates = _vocabulary.Vocables .Where(x => x != vocableToTranslate) .Shuffle(_shuffleAlgorithm) .Take(3) .Select(x => GetText(x, TranslateToLanguage)) .ToList(); return(falseTranslationsCandidates); }
private string GetTranslation(Vocable vocable) { return(GetText(vocable, TranslateToLanguage)); }
private string GetTextToTranslate(Vocable vocable) { return(GetText(vocable, TranslateFromLanguage)); }