Quick search


Provides abstracted access to a range of spellchecking backends as well as word suggestions. The API is inspired by enchant but other backends can be added that implement the same API.

Spelling currently requires python-enchant for all platforms except OSX, where a native implementation exists.

>>> from kivy.core.spelling import Spelling
>>> s = Spelling()
>>> s.list_languages()
['en', 'en_CA', 'en_GB', 'en_US']
>>> s.select_language('en_US')
>>> s.suggest('helo')
[u'hole', u'help', u'helot', u'hello', u'halo', u'hero', u'hell', u'held',
 u'helm', u'he-lo']
exception kivy.core.spelling.NoLanguageSelectedError[source]

Bases: Exception

Exception to be raised when a language-using method is called but no language was selected prior to the call.

exception kivy.core.spelling.NoSuchLangError[source]

Bases: Exception

Exception to be raised when a specific language could not be found.

class kivy.core.spelling.SpellingBase(language=None)[source]

Bases: builtins.object

Base class for all spelling providers. Supports some abstract methods for checking words and getting suggestions.


If word is a valid word in self._language (the currently active language), returns True. If the word shouldn’t be checked, returns None (e.g. for ‘’). If it is not a valid word in self._language, return False.

word: str

The word to check.


Return a list of all supported languages. E.g. [‘en’, ‘en_GB’, ‘en_US’, ‘de’, …]


From the set of registered languages, select the first language for language.

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.


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.

fragment: str

The word fragment to get suggestions/corrections for. E.g. ‘foo’ might become ‘of’, ‘food’ or ‘foot’.