Skip to content
Discussion options

You must be logged in to vote

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():

def foo(a, *, b=10, c="hello"):
    Bar(**locals())

class Bar:
    def __init__(self, *, a, b, c):
	    print(a, b, c)

foo(42, c="world")

You could also use inspect to inspect the frame and pry out the argments:

import inspect

def get_args():
    parent_frame = inspect.currentframe().f_back
    args, _, _, locals = inspect.getargvalues(parent_fr…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@BramVanroy
Comment options

@vmenger
Comment options

@danieldk
Comment options

Answer selected by danieldk
@vmenger
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
usage General spaCy usage
3 participants