Commits

Anonymous committed 9f53295 Draft

[dictionary] case insensetive checks

  • Participants
  • Parent commits 0ebd6c1

Comments (0)

Files changed (5)

File dictionary/WordDictionary.h

 
 public:
     bool IsCorrect(const string &word) {
+        string loweredWord = word;
+        std::transform(loweredWord.begin(), loweredWord.end(), loweredWord.begin(), tolower);
         boost::lock_guard<boost::recursive_mutex> l(m_lock);
-        return m_words.find(word) != m_words.end();
+        return m_words.find(loweredWord) != m_words.end();
     }
 
     shared_ptr<WordCorrection> GetCorrections(const string &word) {
 
 #include <boost/thread.hpp>
 
+#include <algorithm>

File output/SynchronizedWordOutput.h

         FlushSpaces();
         m_pNextOutput->Flush();
     }
-
 };

File testcases/caseinsensetive.in

+this is da test
+===
+tHiSe Ise DUBSTEP tEsTe
+===

File testcases/caseinsensetive.out

+
+tHiS Is {DUBSTEP?} tEsT