Spelling¶
Provide abstracted access to a range of spellchecking backends. Also provides word suggestions. The API is inspired by enchant, but other backends can be added that implement the same API.
- class kivy.core.spelling.SpellingBase(language=None)¶
Bases: object
Base class for all spelling providers. Supports some abstract methods for checking words and getting suggestions.
- check(word)¶
If word is a valid word in self._language, return True.
Parameters : - word : str
The word to check. If the word is a valid word in the currently active language, True is returned. If the word shouldn’t be checked, return None (e.g. for ‘’).
- list_languages()¶
Return a list of all languages supported by the registered languages. E.g.: [‘en’, ‘en_GB’, ‘en_US’, ‘de’, ...]
- select_language(language)¶
From the set of registered languages, select the first language for language.
Parameters : - language : str
Language identifier. Needs to be one of the options returned by list_languages(). Sets the language used for spell checking and word suggestions.
- suggest(fragment)¶
For a given fragment (i.e., part of a word or a word by itself), provide corrections (fragment may be misspelled) or completions as a list of strings.
Parameters : - fragment : str
The word fragment to get suggestions/corrections for. E.g.: ‘foo’ might become ‘of’, ‘food’ or ‘foot’.
- class kivy.core.spelling.NoSuchLangError¶
Bases: exceptions.Exception
Exception to be raised when a specific language could not be found.
- class kivy.core.spelling.NoLanguageSelectedError¶
Bases: exceptions.Exception
Exception to be raised when a language-using method is called but no language was selected prior to the call.