1 // Copyright (c) 2012, Thomas Goyne <plorkyeran@aegisub.org> 2 // 3 // Permission to use, copy, modify, and distribute this software for any 4 // purpose with or without fee is hereby granted, provided that the above 5 // copyright notice and this permission notice appear in all copies. 6 // 7 // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 // 15 // Aegisub Project http://www.aegisub.org/ 16 17 #pragma once 18 19 #include <string> 20 #include <vector> 21 22 namespace agi { 23 class SpellChecker { 24 public: ~SpellChecker()25 virtual ~SpellChecker() { } 26 27 /// Add word to the dictionary 28 /// @param word Word to add 29 virtual void AddWord(std::string const& word)=0; 30 31 /// Remove word from the dictionary 32 /// @param word Word to remove 33 virtual void RemoveWord(std::string const& word)=0; 34 35 /// Can the word be added to the current dictionary? 36 /// @param word Word to check 37 /// @return Whether or not word can be added 38 virtual bool CanAddWord(std::string const& word)=0; 39 40 /// Can the word be removed from the current dictionary? 41 /// @param word Word to check 42 /// @return Whether or not word can be removed 43 virtual bool CanRemoveWord(std::string const& word)=0; 44 45 /// Check if the given word is spelled correctly 46 /// @param word Word to check 47 /// @return Whether or not the word is valid 48 virtual bool CheckWord(std::string const& word)=0; 49 50 /// Get possible corrections for a misspelled word 51 /// @param word Word to get suggestions for 52 /// @return List of suggestions, if any 53 virtual std::vector<std::string> GetSuggestions(std::string const& word)=0; 54 55 /// Get a list of languages which dictionaries are present for 56 virtual std::vector<std::string> GetLanguageList()=0; 57 }; 58 59 } 60