spaCy API reference
194 public APIs from spaCy (explosion/spaCy) — 22 classes, 92 functions, 80 methods. Signatures extracted by static analysis of the actual source.
Repository: explosion/spaCy
| Kind | Count |
|---|---|
| Classes | 22 |
| Functions | 92 |
| Methods | 80 |
API list
func
spacy.cli._util.setup_gpu(use_gpu:int, silent=None) -> NoneConfigure the GPU and log info.
class
spacy.cli.benchmark_speed.time_contextRegister the running time of a context.
func
spacy.cli.find_threshold.set_nested_item(config:Dict[str, Any], keys:List[str], value:float) -> Dict[str, Any]Set item in nested dictionary.
func
spacy.cli.info.info_model(model:str, *silent:bool=True) -> Dict[str, Any]Generate info about a specific model.
func
spacy.cli.info.info_model_url(model:str) -> Dict[str, Any]Return the download URL for the latest version of a pipeline.
func
spacy.cli.info.info_spacy() -> Dict[str, Any]Generate info about the current spaCy intallation.
class
spacy.cli.init_config.InitValuesDefault values for initialization.
func
spacy.cli.package.generate_readme(meta:Dict[str, Any]) -> strGenerate a Markdown-formatted README text from a model meta.json.
func
spacy.cli.validate.reformat_version(version:str) -> strHack to reformat old versions ending on '-alpha' to match pip format.
func
spacy.displacy.render(docs:Union[Iterable[Union[Doc, Span, dict]], Doc, Span, dict], style:str='dep', page:bool=False, minify:bool=False, jupyter:Optional[bool]=None, options:Dict[str, Any]={}, manual:bool=False) -> strRender displaCy visualisation.
class
spacy.displacy.render.DependencyRendererRender dependency parses as SVGs.
method
spacy.displacy.render.DependencyRenderer.get_arc(x_start:int, y:int, y_curve:int, x_end:int) -> strRender individual arc.
method
spacy.displacy.render.DependencyRenderer.get_arrowhead(direction:str, x:int, y:int, end:int) -> strRender individual arrow head.
method
spacy.displacy.render.DependencyRenderer.get_levels(arcs:List[Dict[str, Any]]) -> Dict[Tuple[int, int, str], int]Calculate available arc height "levels".
method
spacy.displacy.render.DependencyRenderer.render(parsed:List[Dict[str, Any]], page:bool=False, minify:bool=False) -> strRender complete markup.
method
spacy.displacy.render.DependencyRenderer.render_arrow(label:str, start:int, end:int, direction:str, i:int) -> strRender individual arrow.
method
spacy.displacy.render.DependencyRenderer.render_svg(render_id:Union[int, str], words:List[Dict[str, Any]], arcs:List[Dict[str, Any]]) -> strRender SVG.
method
spacy.displacy.render.DependencyRenderer.render_word(text:str, tag:str, lemma:Optional[str], i:int) -> strRender individual word.
class
spacy.displacy.render.EntityRendererRender named entities as HTML.
method
spacy.displacy.render.EntityRenderer.render(parsed:List[Dict[str, Any]], page:bool=False, minify:bool=False) -> strRender complete markup.
method
spacy.displacy.render.EntityRenderer.render_ents(text:str, spans:List[Dict[str, Any]], title:Optional[str]) -> strRender entities in text.
class
spacy.displacy.render.SpanRendererRender Spans as SVGs.
method
spacy.displacy.render.SpanRenderer.render(parsed:List[Dict[str, Any]], page:bool=False, minify:bool=False) -> strRender complete markup.
method
spacy.displacy.render.SpanRenderer.render_spans(tokens:List[str], spans:List[Dict[str, Any]], title:Optional[str]) -> strRender span types in text.
func
spacy.displacy.serve(docs:Union[Iterable[Doc], Doc], style:str='dep', page:bool=True, minify:bool=False, options:Dict[str, Any]={}, manual:bool=False, port:int=5000, host:str='0.0.0.0', auto_select_port:bool=False) -> NoneServe displaCy visualisation.
func
spacy.lang.ar.lex_attrs.like_num(text)Check if text resembles a number
func
spacy.lang.bo.lex_attrs.like_num(text)Check if text resembles a number
func
spacy.lang.ca.syntax_iterators.noun_chunks(doclike:Union[Doc, Span]) -> Iterator[Tuple[int, int, int]]Detect base noun phrases from a dependency parse.
func
spacy.lang.de.syntax_iterators.noun_chunks(doclike:Union[Doc, Span]) -> Iterator[Tuple[int, int, int]]Detect base noun phrases from a dependency parse.
func
spacy.lang.el.syntax_iterators.noun_chunks(doclike:Union[Doc, Span]) -> Iterator[Tuple[int, int, int]]Detect base noun phrases from a dependency parse.
class
spacy.lang.en.lemmatizer.EnglishLemmatizerEnglish lemmatizer.
func
spacy.lang.en.syntax_iterators.noun_chunks(doclike:Union[Doc, Span]) -> Iterator[Tuple[int, int, int]]Detect base noun phrases from a dependency parse.
func
spacy.lang.es.syntax_iterators.noun_chunks(doclike:Union[Doc, Span]) -> Iterator[Tuple[int, int, int]]Detect base noun phrases from a dependency parse.
func
spacy.lang.fa.lex_attrs.like_num(text)check if text resembles a number
func
spacy.lang.fa.syntax_iterators.noun_chunks(doclike:Union[Doc, Span]) -> Iterator[Tuple[int, int, int]]Detect base noun phrases from a dependency parse.
func
spacy.lang.fi.syntax_iterators.noun_chunks(doclike:Union[Doc, Span]) -> Iterator[Tuple[int, int, int]]Detect base noun phrases from a dependency parse.
func
spacy.lang.fr.syntax_iterators.noun_chunks(doclike:Union[Doc, Span]) -> Iterator[Tuple[int, int, int]]Detect base noun phrases from a dependency parse.
class
spacy.lang.ht.lemmatizer.HaitianCreoleLemmatizerMinimal Haitian Creole lemmatizer.
func
spacy.lang.id.syntax_iterators.noun_chunks(doclike:Union[Doc, Span]) -> Iterator[Tuple[int, int, int]]Detect base noun phrases from a dependency parse.
func
spacy.lang.it.syntax_iterators.noun_chunks(doclike:Union[Doc, Span]) -> Iterator[Tuple[int, int, int]]Detect base noun phrases from a dependency parse.
func
spacy.lang.ja.syntax_iterators.noun_chunks(doclike:Union[Doc, Span]) -> Iterator[Tuple[int, int, int]]Detect base noun phrases from a dependency parse.
func
spacy.lang.lb.lex_attrs.like_num(text)check if text resembles a number
func
spacy.lang.ml.lex_attrs.like_num(text)Check if text resembles a number
func
spacy.lang.ms.syntax_iterators.noun_chunks(doclike:Union[Doc, Span]) -> Iterator[Tuple[int, int, int]]Detect base noun phrases from a dependency parse.
func
spacy.lang.nb.syntax_iterators.noun_chunks(doclike:Union[Doc, Span]) -> Iterator[Tuple[int, int, int]]Detect base noun phrases from a dependency parse.
func
spacy.lang.nl.syntax_iterators.noun_chunks(doclike:Union[Doc, Span]) -> Iterator[Tuple[int, int, int]]Detect base noun phrases from a dependency parse.
func
spacy.lang.pt.syntax_iterators.noun_chunks(doclike:Union[Doc, Span]) -> Iterator[Tuple[int, int, int]]Detect base noun phrases from a dependency parse.
func
spacy.lang.sa.lex_attrs.like_num(text)Check if text resembles a number
func
spacy.lang.sv.syntax_iterators.noun_chunks(doclike:Union[Doc, Span]) -> Iterator[Tuple[int, int, int]]Detect base noun phrases from a dependency parse.
func
spacy.lang.tr.syntax_iterators.noun_chunks(doclike:Union[Doc, Span]) -> Iterator[Tuple[int, int, int]]Detect base noun phrases from a dependency parse.
class
spacy.language.BaseDefaultsLanguage data defaults, available via Language.Defaults.
class
spacy.language.DisabledPipesManager for temporary pipeline disabling.
class
spacy.language.LanguageA text-processing pipeline.
method
spacy.language.Language.component(name:str, *assigns:Iterable[str]=SimpleFrozenList(), *requires:Iterable[str]=SimpleFrozenList(), *retokenizes:bool=False, *func:Optional[PipeCallable]=None) -> Callable[..., Any]Register a new pipeline component.
method
spacy.language.Language.component_names() -> List[str]Get the names of the available pipeline components.
method
spacy.language.Language.config() -> ConfigTrainable config for the current language instance.
method
spacy.language.Language.create_pipe(factory_name:str, name:Optional[str]=None, *config:Dict[str, Any]=SimpleFrozenDict(), *raw_config:Optional[Config]=None, *validate:bool=True) -> PipeCallableCreate a pipeline component.
method
spacy.language.Language.disable_pipe(name:str) -> NoneDisable a pipeline component.
method
spacy.language.Language.disable_pipes(*names) -> 'DisabledPipes'Disable one or more pipeline components.
method
spacy.language.Language.disabled() -> List[str]Get the names of all disabled components.
method
spacy.language.Language.factory_names() -> List[str]Get names of all available factories.
method
spacy.language.Language.from_bytes(bytes_data:bytes, *exclude:Iterable[str]=SimpleFrozenList()) -> 'Language'Load state from a binary string.
method
spacy.language.Language.from_disk(path:Union[str, Path], *exclude:Iterable[str]=SimpleFrozenList(), *overrides:Dict[str, Any]=SimpleFrozenDict()) -> 'Language'Loads state from a directory.
method
spacy.language.Language.get_factory_meta(name:str) -> 'FactoryMeta'Get the meta information for a given factory name.
method
spacy.language.Language.get_factory_name(name:str) -> strGet the internal factory name based on the language subclass.
method
spacy.language.Language.get_pipe(name:str) -> PipeCallableGet a pipeline component for a given component name.
method
spacy.language.Language.get_pipe_config(name:str) -> ConfigGet the config used to create a pipeline component.
method
spacy.language.Language.get_pipe_meta(name:str) -> 'FactoryMeta'Get the meta information for a given component name.
method
spacy.language.Language.has_factory(name:str) -> boolRETURNS (bool): Whether a factory of that name is registered.
method
spacy.language.Language.has_pipe(name:str) -> boolCheck if a component name is present in the pipeline.
method
spacy.language.Language.make_doc(text:str) -> DocTurn a text into a Doc object.
method
spacy.language.Language.meta() -> Dict[str, Any]Custom meta data of the language class.
method
spacy.language.Language.pipe_names() -> List[str]Get names of available active pipeline components.
method
spacy.language.Language.remove_pipe(name:str) -> Tuple[str, PipeCallable]Remove a component from the pipeline.
method
spacy.language.Language.rename_pipe(old_name:str, new_name:str) -> NoneRename a pipeline component.
method
spacy.language.Language.replace_pipe(name:str, factory_name:str, *config:Dict[str, Any]=SimpleFrozenDict(), *validate:bool=True) -> PipeCallableReplace a component in the pipeline.
method
spacy.language.Language.resume_training(*sgd:Optional[Optimizer]=None) -> OptimizerContinue training a pretrained model.
method
spacy.language.Language.select_pipes(*disable:Optional[Union[str, Iterable[str]]]=None, *enable:Optional[Union[str, Iterable[str]]]=None) -> 'DisabledPipes'Disable one or more pipeline components.
method
spacy.language.Language.set_factory_meta(name:str, value:'FactoryMeta') -> NoneSet the meta information for a given factory name.
method
spacy.language.Language.to_bytes(*exclude:Iterable[str]=SimpleFrozenList()) -> bytesSerialize the current state to a binary string.
method
spacy.language.Language.to_disk(path:Union[str, Path], *exclude:Iterable[str]=SimpleFrozenList()) -> NoneSave the current state to a directory.
func
spacy.language.create_tokenizer() -> Callable[['Language'], Tokenizer]Registered function to create a tokenizer.
class
spacy.lookups.LookupsContainer for large lookup tables and dictionaries, e.g.
method
spacy.lookups.Lookups.add_table(name:str, data:dict=SimpleFrozenDict()) -> TableAdd a new table to the lookups.
method
spacy.lookups.Lookups.from_bytes(bytes_data:bytes, **kwargs) -> 'Lookups'Load the lookups from a bytestring.
method
spacy.lookups.Lookups.from_disk(path:Union[str, Path], filename:str='lookups.bin', **kwargs) -> 'Lookups'Load lookups from a directory containing a lookups.bin.
method
spacy.lookups.Lookups.get_table(name:str, default:Any=UNSET) -> TableGet a table.
method
spacy.lookups.Lookups.has_table(name:str) -> boolCheck if the lookups contain a table of a given name.
method
spacy.lookups.Lookups.remove_table(name:str) -> TableRemove a table.
method
spacy.lookups.Lookups.set_table(name:str, table:Table) -> NoneSet a table.
method
spacy.lookups.Lookups.tables() -> List[str]RETURNS (List[str]): Names of all tables in the lookups.
method
spacy.lookups.Lookups.to_bytes(**kwargs) -> bytesSerialize the lookups to a bytestring.
method
spacy.lookups.Lookups.to_disk(path:Union[str, Path], filename:str='lookups.bin', **kwargs) -> NoneSave the lookups to a directory as lookups.bin.
class
spacy.lookups.TableA table in the lookups.
method
spacy.lookups.Table.from_bytes(bytes_data:bytes) -> 'Table'Load a table from a bytestring.
method
spacy.lookups.Table.from_dict(data:dict, name:Optional[str]=None) -> 'Table'Initialize a new table from a dict.
method
spacy.lookups.Table.get(key:Union[str, int], default:Optional[Any]=None) -> AnyGet the value for a given key.
method
spacy.lookups.Table.set(key:Union[str, int], value:Any) -> NoneSet new key/value pair.
method
spacy.lookups.Table.to_bytes() -> bytesSerialize table to a bytestring.
func
spacy.ml.extract_spans.forward(model:Model, source_spans:Tuple[Ragged, Ragged], is_train:bool) -> Tuple[Ragged, Callable]Get subsequences from source vectors.
func
spacy.ml.models.tok2vec.BiLSTMEncoder(width:int, depth:int, dropout:float) -> Model[List[Floats2d], List[Floats2d]]Encode context using bidirectonal LSTM layers.
func
spacy.pipeline._edit_tree_internals.schemas.validate_edit_tree(obj:Dict[str, Any]) -> List[str]Validate edit tree.
class
spacy.pipeline.entity_linker.EntityLinkerPipeline component for named entity linking.
method
spacy.pipeline.entity_linker.EntityLinker.from_disk(path:Union[str, Path], *exclude:Iterable[str]=SimpleFrozenList()) -> 'EntityLinker'Load the pipe from disk.
method
spacy.pipeline.entity_linker.EntityLinker.set_annotations(docs:Iterable[Doc], kb_ids:List[str]) -> NoneModify a batch of documents, using pre-computed scores.
method
spacy.pipeline.entity_linker.EntityLinker.to_disk(path:Union[str, Path], *exclude:Iterable[str]=SimpleFrozenList()) -> NoneSerialize the pipe to disk.
func
spacy.pipeline.factories.register_factories() -> NoneRegister all factories with the registry.
func
spacy.pipeline.functions.merge_entities(doc:Doc)Merge entities into a single token.
func
spacy.pipeline.functions.merge_noun_chunks(doc:Doc) -> DocMerge noun chunks into a single token.
func
spacy.pipeline.functions.merge_subtokens(doc:Doc, label:str='subtok') -> DocMerge subtokens into a single token.
class
spacy.pipeline.legacy.entity_linker.EntityLinker_v1Pipeline component for named entity linking.
method
spacy.pipeline.legacy.entity_linker.EntityLinker_v1.from_disk(path:Union[str, Path], *exclude:Iterable[str]=SimpleFrozenList()) -> 'EntityLinker_v1'Load the pipe from disk.
method
spacy.pipeline.legacy.entity_linker.EntityLinker_v1.to_disk(path:Union[str, Path], *exclude:Iterable[str]=SimpleFrozenList()) -> NoneSerialize the pipe to disk.
class
spacy.pipeline.span_finder.SpanFinderPipeline that learns span boundaries.
method
spacy.pipeline.span_finder.SpanFinder.set_annotations(docs:Iterable[Doc], scores:Floats2d) -> NoneModify a batch of Doc objects, using pre-computed scores.
class
spacy.pipeline.spancat.SpanCategorizerPipeline component to label spans of text.
method
spacy.pipeline.spancat.SpanCategorizer.add_label(label:str) -> intAdd a new label to the pipe.
method
spacy.pipeline.spancat.SpanCategorizer.key() -> strKey of the doc.spans dict to save the spans under.
method
spacy.pipeline.spancat.SpanCategorizer.set_annotations(docs:Iterable[Doc], indices_scores) -> NoneModify a batch of Doc objects, using pre-computed scores.
func
spacy.pipeline.spancat.build_ngram_suggester(sizes:List[int]) -> SuggesterSuggest all spans of the given lengths.
class
spacy.pipeline.textcat.TextCategorizerPipeline component for single-label text classification.
method
spacy.pipeline.textcat.TextCategorizer.add_label(label:str) -> intAdd a new label to the pipe.
method
spacy.pipeline.textcat.TextCategorizer.set_annotations(docs:Iterable[Doc], scores) -> NoneModify a batch of Doc objects, using pre-computed scores.
func
spacy.registrations.populate_registry() -> NonePopulate the registry with all necessary components.
class
spacy.schemas.DocJSONSchemaJSON/dict format for JSON representation of Doc objects.
func
spacy.schemas.get_arg_model(func:Callable, *exclude:Iterable[str]=tuple(), *name:str='ArgModel', *strict:bool=True) -> type[BaseModel]Generate a pydantic model for function arguments.
func
spacy.schemas.validate(schema:Type[BaseModel], obj:Dict[str, Any]) -> List[str]Validate data against a given pydantic schema.
class
spacy.scorer.PRFScoreA precision / recall / F score.
class
spacy.scorer.ROCAUCScoreAn AUC ROC score.
class
spacy.scorer.ScorerCompute evaluation scores.
method
spacy.scorer.Scorer.score(examples:Iterable[Example], *per_component:bool=False) -> Dict[str, Any]Evaluate a list of Examples.
method
spacy.scorer.Scorer.score_links(examples:Iterable[Example], *negative_labels:Iterable[str], **cfg) -> Dict[str, Any]Returns PRF for predicted links on the entity level.
method
spacy.scorer.Scorer.score_tokenization(examples:Iterable[Example], **cfg) -> Dict[str, Any]Returns accuracy and PRF scores for tokenization.
class
spacy.tokens._serialize.DocBinPack Doc objects for binary serialization.
method
spacy.tokens._serialize.DocBin.add(doc:Doc) -> NoneAdd a Doc's annotations to the DocBin for serialization.
method
spacy.tokens._serialize.DocBin.from_bytes(bytes_data:bytes) -> 'DocBin'Deserialize the DocBin's annotations from a bytestring.
method
spacy.tokens._serialize.DocBin.from_disk(path:Union[str, Path]) -> 'DocBin'Load the DocBin from a file (typically called .spacy).
method
spacy.tokens._serialize.DocBin.get_docs(vocab:Vocab) -> Iterator[Doc]Recover Doc objects from the annotations, using the given vocab.
method
spacy.tokens._serialize.DocBin.merge(other:'DocBin') -> NoneExtend the annotations of this DocBin with the annotations from another.
method
spacy.tokens._serialize.DocBin.to_bytes() -> bytesSerialize the DocBin's annotations to a bytestring.
method
spacy.tokens._serialize.DocBin.to_disk(path:Union[str, Path]) -> NoneSave the DocBin to a file (typically called .spacy).
func
spacy.tokens.underscore.get_ext_args(**kwargs:Any)Validate and convert arguments.
method
spacy.training.corpus.Corpus.read_docbin(vocab:Vocab, locs:Iterable[Union[str, Path]]) -> Iterator[Doc]Yield training examples as example dicts
func
spacy.training.initialize.open_file(loc:Union[str, Path]) -> IOHandle .gz, .tar.gz or unzipped files
func
spacy.training.loop.clean_output_dir(path:Optional[Path]) -> NoneRemove an existing output directory.
func
spacy.training.loop.train(nlp:'Language', output_path:Optional[Path]=None, *use_gpu:int=-1, *stdout:IO=sys.stdout, *stderr:IO=sys.stderr) -> Tuple['Language', Optional[Path]]Train a pipeline.
func
spacy.training.pretrain.make_update(model:Model, docs:Iterable[Doc], optimizer:Optimizer, objective_func:Callable) -> floatPerform an update over a single batch of documents.
func
spacy.util.add_lookups(default_func:Callable[[str], Any], *lookups) -> Callable[[str], Any]Extend an attribute function with special cases.
func
spacy.util.check_bool_env_var(env_var:str) -> boolConvert the value of an environment variable to a boolean.
func
spacy.util.compile_infix_regex(entries:Iterable[Union[str, Pattern]]) -> PatternCompile a sequence of infix rules into a regex object.
func
spacy.util.compile_prefix_regex(entries:Iterable[Union[str, Pattern]]) -> PatternCompile a sequence of prefix rules into a regex object.
func
spacy.util.compile_suffix_regex(entries:Iterable[Union[str, Pattern]]) -> PatternCompile a sequence of suffix rules into a regex object.
func
spacy.util.copy_config(config:Union[Dict[str, Any], Config]) -> ConfigDeep copy a Config.
func
spacy.util.dict_to_dot(obj:Dict[str, dict], *for_overrides:bool=False) -> Dict[str, Any]Convert dot notation to a dict.
func
spacy.util.dot_to_dict(values:Dict[str, Any]) -> Dict[str, dict]Convert dot notation to a dict.
func
spacy.util.ensure_path(path:Any) -> AnyEnsure string is converted to a Path.
func
spacy.util.escape_html(text:str) -> strReplace <, >, &, " with their HTML encoded representation.
func
spacy.util.filter_spans(spans:Iterable['Span']) -> List['Span']Filter a sequence of spans and remove duplicates or overlaps.
func
spacy.util.find_available_port(start:int, host:str, auto_select:bool=False) -> intGiven a starting port and a host, handle finding a port.
func
spacy.util.get_arg_names(func:Callable) -> List[str]Get a list of all named arguments of a function (regular, keyword-only).
func
spacy.util.get_base_version(version:str) -> strGenerate the base version without any prerelease identifiers.
func
spacy.util.get_lang_class(lang:str) -> Type['Language']Import and load a Language class.
func
spacy.util.get_model_lower_version(constraint:str) -> Optional[str]From a version range like >=1.2.3,<1.3.0 return the lower pin.
func
spacy.util.get_model_meta(path:Union[str, Path]) -> Dict[str, Any]Get model meta.json from a directory path and validate its contents.
func
spacy.util.get_module_path(module:ModuleType) -> PathGet the path of a Python module.
func
spacy.util.get_object_name(obj:Any) -> strGet a human-readable name of a Python object, e.g.
func
spacy.util.get_package_path(name:str) -> PathGet the path to an installed package.
func
spacy.util.get_package_version(name:str) -> Optional[str]Get the version of an installed package.
func
spacy.util.import_file(name:str, loc:Union[str, Path]) -> ModuleTypeImport module from a file.
func
spacy.util.is_compatible_version(version:str, constraint:str, prereleases:bool=True) -> Optional[bool]Check if a version (e.g.
func
spacy.util.is_cython_func(func:Callable) -> boolSlightly hacky check for whether a callable is implemented in Cython.
func
spacy.util.is_package(name:str) -> boolCheck if string maps to a package installed via pip.
func
spacy.util.is_prerelease_version(version:str) -> boolCheck whether a version is a prerelease version.
func
spacy.util.lang_class_is_loaded(lang:str) -> boolCheck whether a Language class is already loaded.
func
spacy.util.load_config(path:Union[str, Path], overrides:Dict[str, Any]=SimpleFrozenDict(), interpolate:bool=False) -> ConfigLoad a config file.
func
spacy.util.load_config_from_str(text:str, overrides:Dict[str, Any]=SimpleFrozenDict(), interpolate:bool=False)Load a full config from a string.
func
spacy.util.load_language_data(path:Union[str, Path]) -> Union[dict, list]Load JSON language data using the given path as a base.
func
spacy.util.load_meta(path:Union[str, Path]) -> Dict[str, Any]Load a model meta.json from a path and validate its contents.
func
spacy.util.minibatch(items, size)Iterate over batches of items.
func
spacy.util.minify_html(html:str) -> strPerform a template-specific, rudimentary HTML minification for displaCy.
method
spacy.util.registry.ensure_populated() -> NoneEnsure the registry is populated with all necessary components.
method
spacy.util.registry.get(registry_name:str, func_name:str) -> CallableGet a registered function from the registry.
method
spacy.util.registry.get_registry_names() -> List[str]List all available registries.
method
spacy.util.registry.has(registry_name:str, func_name:str) -> boolCheck whether a function is available in a registry.
func
spacy.util.replace_model_node(model:Model, target:Model, replacement:Model) -> NoneReplace a node within a model with a new one, updating refs.
func
spacy.util.resolve_dot_names(config:Config, dot_names:List[Optional[str]]) -> Tuple[Any, ...]Resolve one or more "dot notation" names, e.g.
func
spacy.util.run_command(command:Union[str, List[str]], *stdin:Optional[Any]=None, *capture:bool=False) -> subprocess.CompletedProcessRun a command on the command line as a subprocess.
func
spacy.util.set_dot_to_object(config:Config, section:str, value:Any) -> NoneUpdate a config at a given position from a dot notation.
func
spacy.util.set_lang_class(name:str, cls:Type['Language']) -> NoneSet a custom Language class name that can be loaded via get_lang_class.
func
spacy.util.split_command(command:str) -> List[str]Split a string command using shlex.
func
spacy.util.split_requirement(requirement:str) -> Tuple[str, str]Split a requirement like spacy>=1.2.3 into ("spacy", ">=1.2.3").
func
spacy.util.update_exc(base_exceptions:Dict[str, List[dict]], *addition_dicts) -> Dict[str, List[dict]]Update and validate tokenizer exceptions.
func
spacy.util.walk_dict(node:Dict[str, Any], parent:List[str]=[], *for_overrides:bool=False) -> Iterator[Tuple[List[str], Any]]Walk a dict and yield the path and values of the leaves.
func
spacy.util.working_dir(path:Union[str, Path]) -> Iterator[Path]Change current working directory and returns to previous on exit.
About this data
These signatures were extracted from the public source of explosion/spaCy
using Python's ast module. Argument names, default values,
type annotations and return types are taken verbatim from the code.
Implementation bodies are never stored. See
how it works for details.