mirror of https://github.com/explosion/spaCy.git
add docs for entity_ruler.initialize
This commit is contained in:
parent
3ac3447eee
commit
193e0d5a98
|
@ -199,7 +199,7 @@ class EntityRuler(Pipe):
|
||||||
nlp (Language): The current nlp object the component is part of.
|
nlp (Language): The current nlp object the component is part of.
|
||||||
patterns_path: Path to serialized patterns.
|
patterns_path: Path to serialized patterns.
|
||||||
|
|
||||||
DOCS (TODO): https://nightly.spacy.io/api/entityruler#initialize
|
DOCS: https://nightly.spacy.io/api/entityruler#initialize
|
||||||
"""
|
"""
|
||||||
if patterns_path:
|
if patterns_path:
|
||||||
patterns = srsly.read_jsonl(patterns_path)
|
patterns = srsly.read_jsonl(patterns_path)
|
||||||
|
|
|
@ -74,6 +74,30 @@ be a token pattern (list) or a phrase pattern (string). For example:
|
||||||
| `ent_id_sep` | Separator used internally for entity IDs. Defaults to `"||"`. ~~str~~ |
|
| `ent_id_sep` | Separator used internally for entity IDs. Defaults to `"||"`. ~~str~~ |
|
||||||
| `patterns` | Optional patterns to load in on initialization. ~~Optional[List[Dict[str, Union[str, List[dict]]]]]~~ |
|
| `patterns` | Optional patterns to load in on initialization. ~~Optional[List[Dict[str, Union[str, List[dict]]]]]~~ |
|
||||||
|
|
||||||
|
## EntityRuler.initialize {#initialize tag="method" new="3"}
|
||||||
|
|
||||||
|
Initialize the component with patterns from a file.
|
||||||
|
|
||||||
|
> #### Example
|
||||||
|
>
|
||||||
|
> ```python
|
||||||
|
> entity_ruler = nlp.add_pipe("entity_ruler")
|
||||||
|
> entity_ruler.initialize(lambda: [], nlp=nlp, patterns_path=patterns_path)
|
||||||
|
> ```
|
||||||
|
>
|
||||||
|
> ```ini
|
||||||
|
> ### config.cfg
|
||||||
|
> [initialize.components.entity_ruler]
|
||||||
|
> patterns_path = "data/patterns/patterns.jsonl"
|
||||||
|
> ```
|
||||||
|
|
||||||
|
| Name | Description |
|
||||||
|
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
|
| `get_examples` | Function that returns gold-standard annotations in the form of [`Example`](/api/example) objects. Not used by the `EntityRuler`. ~~Callable[[], Iterable[Example]]~~ |
|
||||||
|
| _keyword-only_ | |
|
||||||
|
| `nlp` | The current `nlp` object. Defaults to `None`. ~~Optional[Language]~~ |
|
||||||
|
| `labels` | Path to the .json file holding the serialized patterns. ~~Path~~ |
|
||||||
|
|
||||||
## EntityRuler.\_\len\_\_ {#len tag="method"}
|
## EntityRuler.\_\len\_\_ {#len tag="method"}
|
||||||
|
|
||||||
The number of all patterns added to the entity ruler.
|
The number of all patterns added to the entity ruler.
|
||||||
|
|
Loading…
Reference in New Issue