• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

parley

  • sources
  • kde-4.14
  • kdeedu
  • parley
  • src
  • practice
answervalidatorold.h
Go to the documentation of this file.
1 /***************************************************************************
2  Copyright 2007 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
3  ***************************************************************************/
4 
5 /***************************************************************************
6  * *
7  * This program is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  ***************************************************************************/
13 #ifndef ANSWERVALIDATOROLD_H
14 #define ANSWERVALIDATOROLD_H
15 
16 #include "testentry.h"
17 
18 #include <QtCore/QString>
19 #include <QtCore/QPair>
20 
21 class KEduVocDocument;
22 namespace Sonnet
23 {
24 class Speller;
25 }
26 
32 class AnswerValidatorOld
33 {
34 public:
35  AnswerValidatorOld(KEduVocDocument* doc);
36 
37  ~AnswerValidatorOld();
38 
39  bool spellcheckerAvailable();
40 
45  void setTestEntry(TestEntry* entry);
46 
51  void setLanguage(int translation);
52 
59  void checkUserAnswer(const QString& userAnswer);
60  void checkUserAnswer(const QString& solution, const QString& userAnswer, const QString& language = QString());
61 
62 private:
66  void defaultCorrector();
67 
71  void simpleCorrector();
72 
81  int levenshteinDistance(const QString& s, const QString& t);
82 
83  bool spellcheckerMisspelled(const QString& s);
84 
85  bool spellcheckerInSuggestionList(const QString& solution, const QString& userAnswer);
86 
94  void wordCompare(const QString& solution, const QString& userWord, double& grade, TestEntry::ErrorTypes& errorTypes);
95 
99  void sentenceAnalysis();
100 
107  QList< QPair < QString, QString > > bestPairs(const QStringList& solutionWords , const QStringList& userAnswerWords);
108 
110  KEduVocDocument* m_doc;
111 
113  TestEntry* m_entry;
114  int m_translation;
115 
117  QString m_solution;
118 
120  QString m_userAnswer;
121 
123  QByteArray m_d;
124 
126  Sonnet::Speller* m_speller;
127  bool m_spellerAvailable;
128 
129  static const double LEVENSHTEIN_THRESHOLD;
130  static const double UNRELATED_WORD_GRADE;
131  static const double FALSE_FRIEND_GRADE;
132  static const double SPELLING_MISTAKE_PER_LETTER_PUNISHMENT;
133  static const double ACCENT_MISTAKE_PUNISHMENT;
134  static const double CAPITALIZATION_MISTAKE_PUNISHMENT;
135  static const double WRONG_ARTICLE_PUNISHMENT;
136 };
137 
138 #endif
AnswerValidatorOld::setTestEntry
void setTestEntry(TestEntry *entry)
Sets the current entry.
Definition: answervalidatorold.cpp:94
QByteArray
AnswerValidatorOld::checkUserAnswer
void checkUserAnswer(const QString &userAnswer)
Checks the user answer.
Definition: answervalidatorold.cpp:308
testentry.h
AnswerValidatorOld
Provides different comparison methods to determine the quality of the answer.
Definition: answervalidatorold.h:32
AnswerValidatorOld::setLanguage
void setLanguage(int translation)
Set the language for the spell checker.
Definition: answervalidatorold.cpp:66
AnswerValidatorOld::spellcheckerAvailable
bool spellcheckerAvailable()
Definition: answervalidatorold.cpp:527
AnswerValidatorOld::~AnswerValidatorOld
~AnswerValidatorOld()
Definition: answervalidatorold.cpp:60
QString
QList
QStringList
AnswerValidatorOld::AnswerValidatorOld
AnswerValidatorOld(KEduVocDocument *doc)
Definition: answervalidatorold.cpp:52
TestEntry
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

KDE's Doxygen guidelines are available online.

parley

Skip menu "parley"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal