Common¶
Exceptions¶
Resources¶
-
class
forte.common.
Resources
(**kwargs)[source]¶ The
Resources
object is a global registry used in the pipeline. Objects defined asResources
will be passed on to the processors in the pipeline for initialization.-
save
(keys=None, output_dir=None)[source]¶ Save the resources specified by
keys
in binary format.- Parameters
keys (optional) –
list or dict
If
keys
is a list, the objects corresponding to those keys are savedIf
keys
is a dict mapping from a key to a serialize function, then the serialize function will be used to save the object corresponding to that keyIf
keys
is None, all objects in this resource will be saved.
output_dir (optional) – str A directory specifying the location to save the resources.
-
load
(keys, path=None)[source]¶ Load the resources specified by
keys
.- Parameters
keys –
list or dict
If
keys
is a list, the objects corresponding to those keys are loadedIf
keys
is a dict mapping from a key to a deserialize function, then the deserialize function will be used to load the object corresponding to that key
path (optional) – str A directory specifying the location to load the resources from.
-