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

parley

  • sources
  • kde-4.12
  • 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  class Speller;
24 }
25 
31 class AnswerValidatorOld{
32 public:
33  AnswerValidatorOld(KEduVocDocument* doc);
34 
35  ~AnswerValidatorOld();
36 
37  bool spellcheckerAvailable();
38 
43  void setTestEntry(TestEntry* entry);
44 
49  void setLanguage(int translation);
50 
57  void checkUserAnswer(const QString& userAnswer);
58  void checkUserAnswer(const QString& solution, const QString& userAnswer, const QString& language = QString());
59 
60 private:
64  void defaultCorrector();
65 
69  void simpleCorrector();
70 
79  int levenshteinDistance(const QString& s, const QString& t);
80 
81  bool spellcheckerMisspelled(const QString& s);
82 
83  bool spellcheckerInSuggestionList(const QString& solution, const QString& userAnswer);
84 
92  void wordCompare(const QString& solution, const QString& userWord, double& grade, TestEntry::ErrorTypes& errorTypes);
93 
97  void sentenceAnalysis();
98 
105  QList< QPair < QString, QString > > bestPairs(const QStringList& solutionWords , const QStringList& userAnswerWords );
106 
108  KEduVocDocument* m_doc;
109 
111  TestEntry* m_entry;
112  int m_translation;
113 
115  QString m_solution;
116 
118  QString m_userAnswer;
119 
121  QByteArray m_d;
122 
124  Sonnet::Speller* m_speller;
125  bool m_spellerAvailable;
126 
127  static const double LEVENSHTEIN_THRESHOLD;
128  static const double UNRELATED_WORD_GRADE;
129  static const double FALSE_FRIEND_GRADE;
130  static const double SPELLING_MISTAKE_PER_LETTER_PUNISHMENT;
131  static const double ACCENT_MISTAKE_PUNISHMENT;
132  static const double CAPITALIZATION_MISTAKE_PUNISHMENT;
133  static const double WRONG_ARTICLE_PUNISHMENT;
134 };
135 
136 #endif
AnswerValidatorOld::setTestEntry
void setTestEntry(TestEntry *entry)
Sets the current entry.
Definition: answervalidatorold.cpp:92
AnswerValidatorOld::checkUserAnswer
void checkUserAnswer(const QString &userAnswer)
Checks the user answer.
Definition: answervalidatorold.cpp:307
testentry.h
AnswerValidatorOld
Provides different comparison methods to determine the quality of the answer.
Definition: answervalidatorold.h:31
AnswerValidatorOld::setLanguage
void setLanguage(int translation)
Set the language for the spell checker.
Definition: answervalidatorold.cpp:64
AnswerValidatorOld::spellcheckerAvailable
bool spellcheckerAvailable()
Definition: answervalidatorold.cpp:526
AnswerValidatorOld::~AnswerValidatorOld
~AnswerValidatorOld()
Definition: answervalidatorold.cpp:58
AnswerValidatorOld::AnswerValidatorOld
AnswerValidatorOld(KEduVocDocument *doc)
Definition: answervalidatorold.cpp:50
TestEntry
Definition: testentry.h:22
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:42:05 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
  • kstars
  • libkdeedu
  •   keduvocdocument
  • 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