summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVlad Voicu <vladv@rosedu.org>2012-01-19 21:49:08 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-03-09 15:04:00 (GMT)
commit65679c27623512a79de7c6d92c75d1a9530fb756 (patch)
tree0f4baf79436fb592702bc6830c7b032528a0e55b /SwifTools/HunspellChecker.cpp
parent4ba6dfe66b5898c3b7162b263b2529c534feddc1 (diff)
downloadswift-contrib-65679c27623512a79de7c6d92c75d1a9530fb756.zip
swift-contrib-65679c27623512a79de7c6d92c75d1a9530fb756.tar.bz2
Big spell checker chunk
Diffstat (limited to 'SwifTools/HunspellChecker.cpp')
-rw-r--r--SwifTools/HunspellChecker.cpp13
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;
+ }
+ }
+ }
+}
+
}