Hunspell::Dictionary
Inherits Reference < Object
Represents a dictionary for a specific language.
Constants
The affix file extension
The dictionary file extension
Constructors
Creates a new dictionary.
@param [String] affix_path
The path to the .aff file.
@param [String] dic_path
The path to the .dic file.
@param [String] key The optional key for encrypted dictionary files.
@raise [RuntimeError]
Either the .aff or .dic files did not exist.
Opens a Hunspell dictionary.
@param [Symbol, String] name The name of the dictionary to open.
@yield [dict] The given block will be passed the Hunspell dictionary.
@yieldparam [Dictionary] dict The opened dictionary.
@return [Dictionary] If no block is given, the open dictionary will be returned.
@raise [ArgumentError] The dictionary files could not be found in any of the directories.
Class methods
Instance methods
Adds a word to the dictionary.
@param [String] word The word to add to the dictionary.
Load an extra dictionary file. The extra dictionaries use the affix file of the allocated Hunspell object.
Maximal number of extra dictionaries is limited in the source code (20)
@param [String] dic_path
The path to the extra .dic file.
@raise [ArgumentError]
The extra .dic file did not exist.
@since 0.6.0
Adds a word to the dictionary with affix flags.
@param [String] word The word to add to the dictionary.
@param [String] example Affix flags.
@since 0.4.0
Checks if the word is validate.
@param [#to_s] word The word in question.
@return [Boolean] Specifies whether the word is valid.
Determines if the dictionary is closed.
@return [Boolean] Specifies whether the dictionary was closed.
Finalizes the underlying libhunspell handler pointer, if it already
hasn't been deallocated by #close.
Removes a word from the dictionary.
@param [#to_s] word The word to remove.
Finds the stems of a word.
@param [#to_s] word The word in question.
@return [Array<String>] The stems of the word.
Suggests alternate spellings of a word.
@param [#to_s] word The word in question.
@return [Array<String>] The suggestions for the word.
Converts the dictionary to a pointer.
@return [LibHunspell::HunhandlePtr] The pointer for the dictionary.