spaCy - Util.update_exc



As the name suggests, this function will update, validate, and overwrite tokenizer expectations. We can also use it to combine the global exceptions with custom, language-specific exceptions.

Arguments

The table below explains its arguments −

NAME TYPE DESCRIPTION
base_exceptions Dict It represents the base tokenizer exceptions.
addition_dicts Dicts These are the exception dictionaries that should be added to the base exceptions in order.

Example

An example of util.update_exc() function is as follows −

import spacy
BASE = {"a.": [{ORTH: "a."}], ":)": [{ORTH: ":)"}]}
NEW = {"a.": [{ORTH: "a.", NORM: "all"}]}
exceptions_to_add = spacy.util.update_exc(BASE, NEW)

Output

You will see the following output −

This is Tutorialspoint.com!
spacy_util_get_data_path.htm
Advertisements