Skip to content
Discussion options

You must be logged in to vote

Hi @yw2903 ,

There are two ways you can solve this:

  1. A minimal correction might be to use Language.factory instead of Language.component, then include the extra settings in the my_component function (c.f. https://spacy.io/usage/processing-pipelines#custom-components-factories). Something like this:
@Language.factory("sklearn-cat")
def my_component(doc, sklearn_model: str, label: str, classes: List[str])):
    # do something
    return doc

This might work as a toy example but it's not the best practice (harder to extend, you have something happening in the global namespace, etc.). Ideally you want everything to happen inside a single class, it's more extensible that way. And so, another a…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@yw2903
Comment options

@yw2903
Comment options

@ljvmiranda921
Comment options

@yw2903
Comment options

@ljvmiranda921
Comment options

Answer selected by adrianeboyd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
third-party Third-party packages and services
2 participants