mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 05:07:00 -04:00
Fix #35
This commit is contained in:
@@ -110,13 +110,6 @@ bool SpellChecker::spell(const String& word) {
|
||||
return Hunspell::spell(str);
|
||||
}
|
||||
|
||||
bool SpellChecker::spell_with_punctuation(const String& word) {
|
||||
size_t start = 0, end = String::npos;
|
||||
trim_punctuation(word, start, end);
|
||||
if (start >= end) return true; // just punctuation is wrong
|
||||
return spell(word.substr(start,end-start));
|
||||
}
|
||||
|
||||
void SpellChecker::suggest(const String& word, vector<String>& suggestions_out) {
|
||||
CharBuffer str;
|
||||
if (!convert_encoding(word,str)) return;
|
||||
|
||||
@@ -39,8 +39,6 @@ public:
|
||||
|
||||
/// Check the spelling of a single word
|
||||
bool spell(const String& word);
|
||||
/// Check the spelling of a single word, ignore punctuation
|
||||
bool spell_with_punctuation(const String& word);
|
||||
|
||||
/// Give spelling suggestions
|
||||
void suggest(const String& word, vector<String>& suggestions_out);
|
||||
|
||||
@@ -115,12 +115,6 @@ String strip_last_word(const String& s) {
|
||||
const String word_start_chars = String(_("[({\"\'")) + LEFT_SINGLE_QUOTE + LEFT_DOUBLE_QUOTE;
|
||||
const String word_end_chars = String(_("])}.,;:?!\"\'")) + RIGHT_SINGLE_QUOTE + RIGHT_DOUBLE_QUOTE;
|
||||
|
||||
void trim_punctuation(const String& str, size_t& start, size_t& end) {
|
||||
start = str.find_first_not_of(word_start_chars, start);
|
||||
end = str.find_last_not_of(word_end_chars, min(end,str.size()-1)) + 1;
|
||||
if (start >= end) start = end;
|
||||
}
|
||||
|
||||
bool is_word_start_punctuation(Char c) {
|
||||
return word_start_chars.find_first_of(c) != String::npos;
|
||||
}
|
||||
|
||||
@@ -140,9 +140,6 @@ String last_word(const String&);
|
||||
/// Remove the last word from a string, leaves whitespace before that word
|
||||
String strip_last_word(const String&);
|
||||
|
||||
/// Trim punctuation at the start/end of a word in the range [start..end)
|
||||
void trim_punctuation(const String&, size_t& start, size_t& end);
|
||||
|
||||
bool is_word_start_punctuation(Char c);
|
||||
bool is_word_end_punctuation(Char c);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user