diff options
author | Vlad Voicu <vladv@rosedu.org> | 2012-02-01 13:09:53 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2012-03-09 15:04:01 (GMT) |
commit | 2944711aefec9a9dd66052440bc4f921910dd780 (patch) | |
tree | 9c1ec9e2284da3d4c23c98d9456031f3fb8c022b /SwifTools/SpellChecker.cpp | |
parent | 21224565867c695bc41028ce31e567554eb25a0a (diff) | |
download | swift-contrib-2944711aefec9a9dd66052440bc4f921910dd780.zip swift-contrib-2944711aefec9a9dd66052440bc4f921910dd780.tar.bz2 |
Context Menu improvements
Diffstat (limited to 'SwifTools/SpellChecker.cpp')
-rw-r--r-- | SwifTools/SpellChecker.cpp | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/SwifTools/SpellChecker.cpp b/SwifTools/SpellChecker.cpp deleted file mode 100644 index 8a27fc5..0000000 --- a/SwifTools/SpellChecker.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2011 Vlad Voicu - * Licensed under the Simplified BSD license. - * See Documentation/Licenses/BSD-simplified.txt for more information. - */ - -#include <SwifTools/SpellChecker.h> - -#include <algorithm> -#include <hunspell/hunspell.hxx> -#include <boost/algorithm/string.hpp> - - -namespace Swift { - -SpellChecker::SpellChecker() { - const char* dictionary_path = "/usr/share/hunspell/en_US.dic"; - const char* affix_path = "/usr/share/hunspell/en_US.aff"; - speller_ = new Hunspell(affix_path, dictionary_path); -} - -SpellChecker::~SpellChecker() { - delete speller_; -} - -bool SpellChecker::isCorrect(const std::string& word) { - return speller_->spell(word.c_str()); -} - -void SpellChecker::getSuggestions(const std::string& word, std::vector<std::string>& list) { - char **suggestList; - int words_returned; - if (!word.empty()) { - words_returned = speller_->suggest(&suggestList, word.c_str()); - } - for (int i = 0; i < words_returned; ++i) { - list.push_back(suggestList[i]); - free(suggestList[i]); - } -} - -} |