import_dictionary method

import_dictionary

Imports a dictionary from the specified file.

Each dictionary class derives from DictionaryBase, which provides export_dictionary and import_dictionary for saving to and loading from a file. These methods do not raise an exception if the file cannot be written or read, or if it has an invalid format.

def import_dictionary(self, file_path):
    ...
Parameter Type Description
file_path str The file to import from.
Raises Description
RuntimeError The call changes a dictionary that defines how the text of documents is divided into terms (see DictionaryRepository), and the index of the dictionary contains documents, is not in the IndexStatus.ready status or is disposed.

Example

# Import aliases from a file
aliases.import_dictionary("./Aliases.dat")

# Import homophones from a file
homophones.import_dictionary("./Homophones.dat")

Aliases

These names call import_dictionary too, limited to the overloads listed.

Alias Accepts
import_dictionary_file import_dictionary_file(file_path)
import_dictionary_string import_dictionary_string(file_path)

See Also