diff options
author | Vlad Voicu <vladv@rosedu.org> | 2012-01-19 21:49:08 (GMT) |
---|---|---|
committer | vlad <vlad@tyrion.(none)> | 2012-10-13 13:55:44 (GMT) |
commit | eca3a097403adbd85fe3b0cf366f29ecc37cacc6 (patch) | |
tree | dbc86052c3c5e8f98eee56af06b20d79261d27f0 /SwifTools/HunspellChecker.cpp | |
parent | 66d6e33635a22bfdfdd82ffab1b1693aa77f6181 (diff) | |
download | swift-contrib-eca3a097403adbd85fe3b0cf366f29ecc37cacc6.zip swift-contrib-eca3a097403adbd85fe3b0cf366f29ecc37cacc6.tar.bz2 |
Big spell checker chunk
Diffstat (limited to 'SwifTools/HunspellChecker.cpp')
-rw-r--r-- | SwifTools/HunspellChecker.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/SwifTools/HunspellChecker.cpp b/SwifTools/HunspellChecker.cpp index a090311..ba7cedd 100644 --- a/SwifTools/HunspellChecker.cpp +++ b/SwifTools/HunspellChecker.cpp @@ -37,4 +37,17 @@ void HunspellChecker::getSuggestions(const std::string& word, std::vector<std::s } } +void HunspellChecker::checkFragment(const std::string& fragment, PositionPairVector& misspelledPositions) { + if (!fragment.empty()) { + parser_->check(fragment, misspelledPositions); + for (PositionPairVector::iterator it = misspelledPositions.begin(); it != misspelledPositions.end();) { + if (isCorrect(fragment.substr(boost::get<0>(*it), boost::get<1>(*it) - boost::get<0>(*it)))) { + misspelledPositions.erase(it++); + } else { + ++it; + } + } + } +} + } |