Pass context in custom pipeline component #5154
Replies: 6 comments
-
A real use case would be to create a pipeline component to do a prediction based on the text and an optional property passed in the context (for example a |
Beta Was this translation helpful? Give feedback.
-
Alternatively if the context was inside the
Another solution could be to change |
Beta Was this translation helpful? Give feedback.
-
External features are definitely something that's not easy to handle in the current pipeline configuration and there's a lot of room for improvement. I like the idea of having With the current implementation, it's not as compact as
|
Beta Was this translation helpful? Give feedback.
-
That seems to work. Is there an equivalent for the tokenizer? eg piping a list of For example if I want to use spacy for
|
Beta Was this translation helpful? Give feedback.
-
There's no way to pass a doc to a tokenizer. It doesn't really make sense to do so, since if you already have a doc with tokens, there's nothing for the tokenizer to do. With
I think you'll probably want to do language detection outside of spacy just on the plain texts (I don't think that tokenization will make much of a difference for language detection and you wouldn't want to spend time tokenizing and creating spacy docs twice) and then have a method that calls the right spacy pipeline for each text. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the details. I did that and it works ok. I still think it would be nice to build end to end pipeline with Spacy, but I understand that this is maybe not really in your scope. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Is it possible to access the context in a custom component so the custom component can be used to set an extension? Something like that
Otherwise is there an alternive way to do it?
Beta Was this translation helpful? Give feedback.
All reactions