Avoid repetition of arguments when using Language.factory with maker #12762
-
Hi all, I implemented a custom component that wraps a trained Transformer model to detect whether a As recommended in the docs, I use the
My question is: is there any way to avoid repetition of the arguments so many times and reduce the amount of boilerplate code? Solutions I tried are:
Any suggestions appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
@BramVanroy I noticed you had a similar question here (#10606) but didn't see your final solution, any suggestions? (Sorry if I'm being too forward by tagging you directly 😊) |
Beta Was this translation helpful? Give feedback.
As far as I am aware, it is not possible to simplify the function arguments. confection inspects the function signature to get the configuration fields and types. The procedure is described in this blog post:
https://explosion.ai/blog/spacy-design-concepts#type-hints
Even though it is extremely hacky, you may be able to get away with
locals()
:You could also use
inspect
to inspect the frame and pry out the argments: