Clarify EL example in docs (#13071)

* add comment that pipeline is a custom one

* add link to NEL tutorial

* prettier

* revert prettier reformat

* revert prettier reformat (2)

* fix typo

Co-authored-by: Raphael Mitsch <r.mitsch@outlook.com>

---------

Co-authored-by: Raphael Mitsch <r.mitsch@outlook.com>
This commit is contained in:
Sofie Van Landeghem 2023-10-31 21:58:29 +01:00 committed by GitHub
parent 0c15876502
commit 48248c62b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -290,10 +290,7 @@ for token in doc:
| toward | `prep` | shift | `NOUN` | manufacturers | | toward | `prep` | shift | `NOUN` | manufacturers |
| manufacturers | `pobj` | toward | `ADP` | | | manufacturers | `pobj` | toward | `ADP` | |
<ImageScrollable <ImageScrollable src="/images/displacy-long2.svg" width={1275} />
src="/images/displacy-long2.svg"
width={1275}
/>
Because the syntactic relations form a tree, every word has **exactly one Because the syntactic relations form a tree, every word has **exactly one
head**. You can therefore iterate over the arcs in the tree by iterating over head**. You can therefore iterate over the arcs in the tree by iterating over
@ -720,6 +717,10 @@ identifier from a knowledge base (KB). You can create your own
[`KnowledgeBase`](/api/kb) and [train](/usage/training) a new [`KnowledgeBase`](/api/kb) and [train](/usage/training) a new
[`EntityLinker`](/api/entitylinker) using that custom knowledge base. [`EntityLinker`](/api/entitylinker) using that custom knowledge base.
As an example on how to define a KnowledgeBase and train an entity linker model,
see [`this tutorial`](https://github.com/explosion/projects/blob/v3/tutorials/nel_emerson)
using [spaCy projects](/usage/projects).
### Accessing entity identifiers {id="entity-linking-accessing",model="entity linking"} ### Accessing entity identifiers {id="entity-linking-accessing",model="entity linking"}
The annotated KB identifier is accessible as either a hash value or as a string, The annotated KB identifier is accessible as either a hash value or as a string,
@ -730,6 +731,7 @@ object, or the `ent_kb_id` and `ent_kb_id_` attributes of a
```python ```python
import spacy import spacy
# "my_custom_el_pipeline" is assumed to be a custom NLP pipeline that was trained and serialized to disk
nlp = spacy.load("my_custom_el_pipeline") nlp = spacy.load("my_custom_el_pipeline")
doc = nlp("Ada Lovelace was born in London") doc = nlp("Ada Lovelace was born in London")