mirror of https://github.com/explosion/spaCy.git
config is not Optional (#9024)
This commit is contained in:
parent
fb9c31fbda
commit
1e974de837
|
@ -605,7 +605,7 @@ class Language:
|
||||||
factory_name: str,
|
factory_name: str,
|
||||||
name: Optional[str] = None,
|
name: Optional[str] = None,
|
||||||
*,
|
*,
|
||||||
config: Optional[Dict[str, Any]] = SimpleFrozenDict(),
|
config: Dict[str, Any] = SimpleFrozenDict(),
|
||||||
raw_config: Optional[Config] = None,
|
raw_config: Optional[Config] = None,
|
||||||
validate: bool = True,
|
validate: bool = True,
|
||||||
) -> Callable[[Doc], Doc]:
|
) -> Callable[[Doc], Doc]:
|
||||||
|
@ -615,8 +615,8 @@ class Language:
|
||||||
factory_name (str): Name of component factory.
|
factory_name (str): Name of component factory.
|
||||||
name (Optional[str]): Optional name to assign to component instance.
|
name (Optional[str]): Optional name to assign to component instance.
|
||||||
Defaults to factory name if not set.
|
Defaults to factory name if not set.
|
||||||
config (Optional[Dict[str, Any]]): Config parameters to use for this
|
config (Dict[str, Any]): Config parameters to use for this component.
|
||||||
component. Will be merged with default config, if available.
|
Will be merged with default config, if available.
|
||||||
raw_config (Optional[Config]): Internals: the non-interpolated config.
|
raw_config (Optional[Config]): Internals: the non-interpolated config.
|
||||||
validate (bool): Whether to validate the component config against the
|
validate (bool): Whether to validate the component config against the
|
||||||
arguments and types expected by the factory.
|
arguments and types expected by the factory.
|
||||||
|
@ -640,7 +640,6 @@ class Language:
|
||||||
)
|
)
|
||||||
raise ValueError(err)
|
raise ValueError(err)
|
||||||
pipe_meta = self.get_factory_meta(factory_name)
|
pipe_meta = self.get_factory_meta(factory_name)
|
||||||
config = config or {}
|
|
||||||
# This is unideal, but the alternative would mean you always need to
|
# This is unideal, but the alternative would mean you always need to
|
||||||
# specify the full config settings, which is not really viable.
|
# specify the full config settings, which is not really viable.
|
||||||
if pipe_meta.default_config:
|
if pipe_meta.default_config:
|
||||||
|
@ -722,7 +721,7 @@ class Language:
|
||||||
first: Optional[bool] = None,
|
first: Optional[bool] = None,
|
||||||
last: Optional[bool] = None,
|
last: Optional[bool] = None,
|
||||||
source: Optional["Language"] = None,
|
source: Optional["Language"] = None,
|
||||||
config: Optional[Dict[str, Any]] = SimpleFrozenDict(),
|
config: Dict[str, Any] = SimpleFrozenDict(),
|
||||||
raw_config: Optional[Config] = None,
|
raw_config: Optional[Config] = None,
|
||||||
validate: bool = True,
|
validate: bool = True,
|
||||||
) -> Callable[[Doc], Doc]:
|
) -> Callable[[Doc], Doc]:
|
||||||
|
@ -743,8 +742,8 @@ class Language:
|
||||||
last (bool): If True, insert component last in the pipeline.
|
last (bool): If True, insert component last in the pipeline.
|
||||||
source (Language): Optional loaded nlp object to copy the pipeline
|
source (Language): Optional loaded nlp object to copy the pipeline
|
||||||
component from.
|
component from.
|
||||||
config (Optional[Dict[str, Any]]): Config parameters to use for this
|
config (Dict[str, Any]): Config parameters to use for this component.
|
||||||
component. Will be merged with default config, if available.
|
Will be merged with default config, if available.
|
||||||
raw_config (Optional[Config]): Internals: the non-interpolated config.
|
raw_config (Optional[Config]): Internals: the non-interpolated config.
|
||||||
validate (bool): Whether to validate the component config against the
|
validate (bool): Whether to validate the component config against the
|
||||||
arguments and types expected by the factory.
|
arguments and types expected by the factory.
|
||||||
|
|
|
@ -446,7 +446,7 @@ component, adds it to the pipeline and returns it.
|
||||||
| `after` | Component name or index to insert component directly after. ~~Optional[Union[str, int]]~~ |
|
| `after` | Component name or index to insert component directly after. ~~Optional[Union[str, int]]~~ |
|
||||||
| `first` | Insert component first / not first in the pipeline. ~~Optional[bool]~~ |
|
| `first` | Insert component first / not first in the pipeline. ~~Optional[bool]~~ |
|
||||||
| `last` | Insert component last / not last in the pipeline. ~~Optional[bool]~~ |
|
| `last` | Insert component last / not last in the pipeline. ~~Optional[bool]~~ |
|
||||||
| `config` <Tag variant="new">3</Tag> | Optional config parameters to use for this component. Will be merged with the `default_config` specified by the component factory. ~~Optional[Dict[str, Any]]~~ |
|
| `config` <Tag variant="new">3</Tag> | Optional config parameters to use for this component. Will be merged with the `default_config` specified by the component factory. ~~Dict[str, Any]~~ |
|
||||||
| `source` <Tag variant="new">3</Tag> | Optional source pipeline to copy component from. If a source is provided, the `factory_name` is interpreted as the name of the component in the source pipeline. Make sure that the vocab, vectors and settings of the source pipeline match the target pipeline. ~~Optional[Language]~~ |
|
| `source` <Tag variant="new">3</Tag> | Optional source pipeline to copy component from. If a source is provided, the `factory_name` is interpreted as the name of the component in the source pipeline. Make sure that the vocab, vectors and settings of the source pipeline match the target pipeline. ~~Optional[Language]~~ |
|
||||||
| `validate` <Tag variant="new">3</Tag> | Whether to validate the component config and arguments against the types expected by the factory. Defaults to `True`. ~~bool~~ |
|
| `validate` <Tag variant="new">3</Tag> | Whether to validate the component config and arguments against the types expected by the factory. Defaults to `True`. ~~bool~~ |
|
||||||
| **RETURNS** | The pipeline component. ~~Callable[[Doc], Doc]~~ |
|
| **RETURNS** | The pipeline component. ~~Callable[[Doc], Doc]~~ |
|
||||||
|
@ -476,7 +476,7 @@ To create a component and add it to the pipeline, you should always use
|
||||||
| `factory_name` | Name of the registered component factory. ~~str~~ |
|
| `factory_name` | Name of the registered component factory. ~~str~~ |
|
||||||
| `name` | Optional unique name of pipeline component instance. If not set, the factory name is used. An error is raised if the name already exists in the pipeline. ~~Optional[str]~~ |
|
| `name` | Optional unique name of pipeline component instance. If not set, the factory name is used. An error is raised if the name already exists in the pipeline. ~~Optional[str]~~ |
|
||||||
| _keyword-only_ | |
|
| _keyword-only_ | |
|
||||||
| `config` <Tag variant="new">3</Tag> | Optional config parameters to use for this component. Will be merged with the `default_config` specified by the component factory. ~~Optional[Dict[str, Any]]~~ |
|
| `config` <Tag variant="new">3</Tag> | Optional config parameters to use for this component. Will be merged with the `default_config` specified by the component factory. ~~Dict[str, Any]~~ |
|
||||||
| `validate` <Tag variant="new">3</Tag> | Whether to validate the component config and arguments against the types expected by the factory. Defaults to `True`. ~~bool~~ |
|
| `validate` <Tag variant="new">3</Tag> | Whether to validate the component config and arguments against the types expected by the factory. Defaults to `True`. ~~bool~~ |
|
||||||
| **RETURNS** | The pipeline component. ~~Callable[[Doc], Doc]~~ |
|
| **RETURNS** | The pipeline component. ~~Callable[[Doc], Doc]~~ |
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue