parley
answervalidatorold.cpp
Go to the documentation of this file.
83 kDebug() << "No spellchecker for current language found: " << m_doc->identifier(m_translation).locale();
151 bool AnswerValidatorOld::spellcheckerInSuggestionList(const QString& solution, const QString& userAnswer)
157 kDebug() << "entered: " << userAnswer << " misspelled: " << m_speller->isMisspelled(userAnswer) << " suggestions: " << m_speller->suggest(userAnswer);
188 foreach(KEduVocTranslation * synonym, m_entry->entry()->translation(m_translation)->synonyms()) {
202 m_entry->setLastPercentage(1.0 - ((double)levensthein / qMax(m_solution.length(), m_userAnswer.length())));
204 kDebug() << "simpleCorrector" << m_userAnswer << "-" << m_solution << "has levensthein distance: " << levensthein << " grade: " << m_entry->lastPercentage();
234 if (ParleyStringHandlerOld::stripAccents(m_solution) == ParleyStringHandlerOld::stripAccents(m_userAnswer)) {
244 foreach(KEduVocTranslation * synonym, m_entry->entry()->translation(m_translation)->synonyms()) {
321 void AnswerValidatorOld::checkUserAnswer(const QString & solution, const QString & userAnswer, const QString& language)
336 void AnswerValidatorOld::wordCompare(const QString & solution, const QString & userWord, double& grade, TestEntry::ErrorTypes& errorTypes)
357 if (ParleyStringHandlerOld::stripAccents(solution) == ParleyStringHandlerOld::stripAccents(userWord)) {
384 // htmlCorrection = QString::fromLatin1("<font color=\"#8C1818\">NOOOO! That was a false friend!</font> ");
391 // htmlCorrection = QString::fromLatin1("<font color=\"#8C1818\">Do you have any idea what you are talking about? (Wrong word, you spelled it correct I guess.)</font> ");
397 if (((double)levenshtein / qMax(solution.length(), userWord.length())) < LEVENSHTEIN_THRESHOLD) {
398 // htmlCorrection = QString::fromLatin1("<font color=\"#8C1818\">Seems like you got the spellig wrong.</font> ");
402 // htmlCorrection = QString::fromLatin1("<font color=\"#8C1818\">I don't know that word and it is not similar to the solution.</font> ");
408 if (((double)levenshtein / qMax(solution.length(), userWord.length())) < LEVENSHTEIN_THRESHOLD) {
410 // htmlCorrection = QString::fromLatin1("<font color=\"#8C1818\">No spellchecker, but seems like a spelling error.</font> ");
415 // htmlCorrection = QString::fromLatin1("<font color=\"#8C1818\">No dictionary and no clue.</font> ");
464 correction.append(QString::fromLatin1("<font color=\"#188C18\">") + correctWord + QString::fromLatin1("</font> "));
469 correction.append(QString::fromLatin1("<font color=\"#8C1818\">") + wrongWord + QString::fromLatin1("</font> "));
476 m_entry->setLastPercentage(1.0 - ((double)levenshtein / qMax(m_solution.length(), m_userAnswer.length())));
481 QList< QPair < QString , QString > > AnswerValidatorOld::bestPairs(const QStringList& solutionWords , const QStringList& userAnswerWords)
< solution is correct with the article interchanged
Definition: testentry.h:30
Definition: testentry.h:26
QString & append(QChar ch)
char at(int i) const
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
void removeAt(int i)
QString simplified() const
void checkUserAnswer(const QString &userAnswer)
Checks the user answer.
Definition: answervalidatorold.cpp:308
QString normalized(NormalizationForm mode) const
T value(int i) const
void resize(int size)
int count(const T &value) const
void append(const T &value)
void setLanguage(int translation)
Set the language for the spell checker.
Definition: answervalidatorold.cpp:66
bool isEmpty() const
QString stripAccents(const QString &original)
Definition: answervalidatorold.cpp:29
bool spellcheckerAvailable()
Definition: answervalidatorold.cpp:527
QString toLower() const
static bool countSynonymsAsCorrect()
Get When the synonym instead of the word was entered, does it count as correct?
Definition: prefs.h:678
static bool ignoreAccentMistakes()
Get Count answers as right when only the accentuation is wrong.
Definition: prefs.h:507
int length() const
QString fromLatin1(const char *str, int size)
int indexOf(const QRegExp &rx, int from) const
AnswerValidatorOld(KEduVocDocument *doc)
Definition: answervalidatorold.cpp:52
static bool ignoreCapitalizationMistakes()
Get Count answers as right when only the capitalization is wrong.
Definition: prefs.h:526
int size() const
Definition: testentry.h:22
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:15:56 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:15:56 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.