Spelling.Checker

g GObject.Object GObject.Object Spelling.Checker Spelling.Checker GObject.Object->Spelling.Checker

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

get_default ()

class

new (provider, language)

add_word (word)

check_word (word, word_len)

get_extra_word_chars ()

get_language ()

get_provider ()

ignore_word (word)

list_corrections (word)

set_language (language)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

language

str

r/w/en

provider

Spelling.Provider

r/w/co

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class Spelling.Checker(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Spelling.CheckerClass

SpellingChecker is the core class of libspelling. It provides high-level APIs for spellchecking.

classmethod get_default()
Returns:

a SpellingChecker

Return type:

Spelling.Checker

Gets a default SpellingChecker using the default provider and language.

classmethod new(provider, language)
Parameters:
Returns:

a newly created SpellingChecker

Return type:

Spelling.Checker

Create a new SpellingChecker.

add_word(word)
Parameters:

word (str) – a word to be added

Adds word to the active dictionary.

check_word(word, word_len)
Parameters:
  • word (str) – a word to be checked

  • word_len (int) – length of the word, in bytes

Returns:

True if the dictionary contains the word

Return type:

bool

Checks if the active dictionary contains word.

get_extra_word_chars()
Returns:

extra word characters

Return type:

str

Gets the extra word characters of the active dictionary.

get_language()
Returns:

a string describing the current language.

Return type:

str or None

Gets the language being used by the spell checker.

get_provider()
Returns:

a SpellingProvider

Return type:

Spelling.Provider

Gets the spell provider used by the spell checker.

Currently, only Enchant-2 is supported.

ignore_word(word)
Parameters:

word (str) – a word to be ignored

Requests the active dictionary to ignore word.

list_corrections(word)
Parameters:

word (str) – a word to be checked

Returns:

A list of possible corrections, or None.

Return type:

[str] or None

Retrieves a list of possible corrections for word.

set_language(language)
Parameters:

language (str) – the language to use

Sets the language code to use when communicating with the provider, such as en_US.

Property Details

Spelling.Checker.props.language
Name:

language

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The “language” to use when checking words with the configured SpellingProvider. For example, en_US.

Spelling.Checker.props.provider
Name:

provider

Type:

Spelling.Provider

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The “provider” property contains the provider that is providing information to the spell checker.

Currently, only Enchant is supported, and requires using the SpellingEnchantProvider. Setting this to None will get the default provider.