diff --git a/spacy/lexeme.pxd b/spacy/lexeme.pxd
index c99b6912a..8dea0d6a2 100644
--- a/spacy/lexeme.pxd
+++ b/spacy/lexeme.pxd
@@ -18,11 +18,12 @@ cdef class Lexeme:
cdef readonly attr_t orth
@staticmethod
- cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab, int vector_length):
+ cdef inline Lexeme from_ptr(LexemeC* lex, Vocab vocab):
cdef Lexeme self = Lexeme.__new__(Lexeme, vocab, lex.orth)
self.c = lex
self.vocab = vocab
self.orth = lex.orth
+ return self
@staticmethod
cdef inline void set_struct_attr(LexemeC* lex, attr_id_t name, attr_t value) nogil:
diff --git a/spacy/pipeline/pipe.pyx b/spacy/pipeline/pipe.pyx
index bed4cdd16..96a8b5944 100644
--- a/spacy/pipeline/pipe.pyx
+++ b/spacy/pipeline/pipe.pyx
@@ -1,4 +1,4 @@
-# cython: infer_types=True, profile=True, binding=True
+# cython: infer_types=True, profile=True
import srsly
from ..tokens.doc cimport Doc
diff --git a/spacy/pipeline/tagger.pyx b/spacy/pipeline/tagger.pyx
index 9be562b61..937290d5f 100644
--- a/spacy/pipeline/tagger.pyx
+++ b/spacy/pipeline/tagger.pyx
@@ -43,7 +43,7 @@ DEFAULT_TAGGER_MODEL = Config().from_str(default_model_config)["model"]
scores=["tag_acc"],
default_score_weights={"tag_acc": 1.0},
)
-def make_tagger(nlp: Language, name: str, model: Model[List[Doc], List[Floats2d]]):
+def make_tagger(nlp: Language, name: str, model: Model):
"""Construct a part-of-speech tagger component.
model (Model[List[Doc], List[Floats2d]]): A model instance that predicts
diff --git a/spacy/pipeline/textcat.py b/spacy/pipeline/textcat.py
index d632825bd..7b9cc1e24 100644
--- a/spacy/pipeline/textcat.py
+++ b/spacy/pipeline/textcat.py
@@ -172,7 +172,7 @@ class TextCategorizer(Pipe):
return scores
def set_annotations(self, docs: Iterable[Doc], scores) -> None:
- """Modify a batch of documents, using pre-computed scores.
+ """Modify a batch of [`Doc`](/api/doc) objects, using pre-computed scores.
docs (Iterable[Doc]): The documents to modify.
scores: The scores to set, produced by TextCategorizer.predict.
diff --git a/spacy/tests/doc/test_doc_api.py b/spacy/tests/doc/test_doc_api.py
index a0106348d..954181df5 100644
--- a/spacy/tests/doc/test_doc_api.py
+++ b/spacy/tests/doc/test_doc_api.py
@@ -2,6 +2,7 @@ import pytest
import numpy
from spacy.tokens import Doc, Span
from spacy.vocab import Vocab
+from spacy.lexeme import Lexeme
from spacy.lang.en import English
from spacy.attrs import ENT_TYPE, ENT_IOB, SENT_START, HEAD, DEP, MORPH
@@ -389,3 +390,11 @@ def test_doc_lang(en_vocab):
assert doc.lang == en_vocab.strings["en"]
assert doc[0].lang_ == "en"
assert doc[0].lang == en_vocab.strings["en"]
+
+
+def test_token_lexeme(en_vocab):
+ """Test that tokens expose their lexeme."""
+ token = Doc(en_vocab, words=["Hello", "world"])[0]
+ assert isinstance(token.lex, Lexeme)
+ assert token.lex.text == token.text
+ assert en_vocab[token.orth] == token.lex
diff --git a/spacy/tokens/token.pyx b/spacy/tokens/token.pyx
index 9ad57e21b..8afde60ee 100644
--- a/spacy/tokens/token.pyx
+++ b/spacy/tokens/token.pyx
@@ -226,6 +226,11 @@ cdef class Token:
cdef hash_t key = self.vocab.morphology.add(features)
self.c.morph = key
+ @property
+ def lex(self):
+ """RETURNS (Lexeme): The underlying lexeme."""
+ return self.vocab[self.c.lex.orth]
+
@property
def lex_id(self):
"""RETURNS (int): Sequential ID of the token's lexical type."""
diff --git a/website/docs/api/dependencyparser.md b/website/docs/api/dependencyparser.md
index 6c9222781..187abfdbb 100644
--- a/website/docs/api/dependencyparser.md
+++ b/website/docs/api/dependencyparser.md
@@ -162,7 +162,8 @@ Initialize the pipe for training, using data examples if available. Returns an
## DependencyParser.predict {#predict tag="method"}
-Apply the pipeline's model to a batch of docs, without modifying them.
+Apply the component's model to a batch of [`Doc`](/api/doc) objects, without
+modifying them.
> #### Example
>
@@ -178,7 +179,7 @@ Apply the pipeline's model to a batch of docs, without modifying them.
## DependencyParser.set_annotations {#set_annotations tag="method"}
-Modify a batch of documents, using pre-computed scores.
+Modify a batch of [`Doc`](/api/doc) objects, using pre-computed scores.
> #### Example
>
diff --git a/website/docs/api/entitylinker.md b/website/docs/api/entitylinker.md
index cb5145909..930188e26 100644
--- a/website/docs/api/entitylinker.md
+++ b/website/docs/api/entitylinker.md
@@ -162,9 +162,9 @@ Initialize the pipe for training, using data examples if available. Returns an
## EntityLinker.predict {#predict tag="method"}
-Apply the pipeline's model to a batch of docs, without modifying them. Returns
-the KB IDs for each entity in each doc, including `NIL` if there is no
-prediction.
+Apply the component's model to a batch of [`Doc`](/api/doc) objects, without
+modifying them. Returns the KB IDs for each entity in each doc, including `NIL`
+if there is no prediction.
> #### Example
>
diff --git a/website/docs/api/entityrecognizer.md b/website/docs/api/entityrecognizer.md
index a6368e62b..2d66710d7 100644
--- a/website/docs/api/entityrecognizer.md
+++ b/website/docs/api/entityrecognizer.md
@@ -151,7 +151,8 @@ Initialize the pipe for training, using data examples if available. Returns an
## EntityRecognizer.predict {#predict tag="method"}
-Apply the pipeline's model to a batch of docs, without modifying them.
+Apply the component's model to a batch of [`Doc`](/api/doc) objects, without
+modifying them.
> #### Example
>
@@ -167,7 +168,7 @@ Apply the pipeline's model to a batch of docs, without modifying them.
## EntityRecognizer.set_annotations {#set_annotations tag="method"}
-Modify a batch of documents, using pre-computed scores.
+Modify a batch of [`Doc`](/api/doc) objects, using pre-computed scores.
> #### Example
>
diff --git a/website/docs/api/morphologizer.md b/website/docs/api/morphologizer.md
index 942440234..04d189939 100644
--- a/website/docs/api/morphologizer.md
+++ b/website/docs/api/morphologizer.md
@@ -142,7 +142,8 @@ Initialize the pipe for training, using data examples if available. Returns an
## Morphologizer.predict {#predict tag="method"}
-Apply the pipeline's model to a batch of docs, without modifying them.
+Apply the component's model to a batch of [`Doc`](/api/doc) objects, without
+modifying them.
> #### Example
>
@@ -158,7 +159,7 @@ Apply the pipeline's model to a batch of docs, without modifying them.
## Morphologizer.set_annotations {#set_annotations tag="method"}
-Modify a batch of documents, using pre-computed scores.
+Modify a batch of [`Doc`](/api/doc) objects, using pre-computed scores.
> #### Example
>
@@ -175,8 +176,9 @@ Modify a batch of documents, using pre-computed scores.
## Morphologizer.update {#update tag="method"}
-Learn from a batch of documents and gold-standard information, updating the
-pipe's model. Delegates to [`predict`](/api/morphologizer#predict) and
+Learn from a batch of [`Example`](/api/example) objects containing the
+predictions and gold-standard annotations, and update the component's model.
+Delegates to [`predict`](/api/morphologizer#predict) and
[`get_loss`](/api/morphologizer#get_loss).
> #### Example
diff --git a/website/docs/api/pipe.md b/website/docs/api/pipe.md
index 99d06c79f..b41ec210e 100644
--- a/website/docs/api/pipe.md
+++ b/website/docs/api/pipe.md
@@ -8,7 +8,18 @@ This class is a base class and **not instantiated directly**. Trainable pipeline
components like the [`EntityRecognizer`](/api/entityrecognizer) or
[`TextCategorizer`](/api/textcategorizer) inherit from it and it defines the
interface that components should follow to function as trainable components in a
-spaCy pipeline.
+spaCy pipeline. See the docs on
+[writing trainable components](/usage/processing-pipelines#trainable) for how to
+use the `Pipe` base class to implement custom components.
+
+> #### Why is Pipe implemented in Cython?
+>
+> The `Pipe` class is implemented in a `.pyx` module, the extension used by
+> [Cython](/api/cython). This is needed so that **other** Cython classes, like
+> the [`EntityRecognizer`](/api/entityrecognizer) can inherit from it. But it
+> doesn't mean you have to implement trainable components in Cython – pure
+> Python components like the [`TextCategorizer`](/api/textcategorizer) can also
+> inherit from `Pipe`.
```python
https://github.com/explosion/spaCy/blob/develop/spacy/pipeline/pipe.pyx
@@ -115,7 +126,8 @@ Initialize the pipe for training, using data examples if available. Returns an
## Pipe.predict {#predict tag="method"}
-Apply the pipeline's model to a batch of docs, without modifying them.
+Apply the component's model to a batch of [`Doc`](/api/doc) objects, without
+modifying them.
@@ -137,7 +149,7 @@ This method needs to be overwritten with your own custom `predict` method.
## Pipe.set_annotations {#set_annotations tag="method"}
-Modify a batch of documents, using pre-computed scores.
+Modify a batch of [`Doc`](/api/doc) objects, using pre-computed scores.
@@ -161,8 +173,8 @@ method.
## Pipe.update {#update tag="method"}
-Learn from a batch of documents and gold-standard information, updating the
-pipe's model. Delegates to [`predict`](/api/pipe#predict).
+Learn from a batch of [`Example`](/api/example) objects containing the
+predictions and gold-standard annotations, and update the component's model.
diff --git a/website/docs/api/sentencerecognizer.md b/website/docs/api/sentencerecognizer.md
index fdc950bb0..59ada7fcb 100644
--- a/website/docs/api/sentencerecognizer.md
+++ b/website/docs/api/sentencerecognizer.md
@@ -136,7 +136,8 @@ Initialize the pipe for training, using data examples if available. Returns an
## SentenceRecognizer.predict {#predict tag="method"}
-Apply the pipeline's model to a batch of docs, without modifying them.
+Apply the component's model to a batch of [`Doc`](/api/doc) objects, without
+modifying them.
> #### Example
>
@@ -152,7 +153,7 @@ Apply the pipeline's model to a batch of docs, without modifying them.
## SentenceRecognizer.set_annotations {#set_annotations tag="method"}
-Modify a batch of documents, using pre-computed scores.
+Modify a batch of [`Doc`](/api/doc) objects, using pre-computed scores.
> #### Example
>
@@ -169,8 +170,9 @@ Modify a batch of documents, using pre-computed scores.
## SentenceRecognizer.update {#update tag="method"}
-Learn from a batch of documents and gold-standard information, updating the
-pipe's model. Delegates to [`predict`](/api/sentencerecognizer#predict) and
+Learn from a batch of [`Example`](/api/example) objects containing the
+predictions and gold-standard annotations, and update the component's model.
+Delegates to [`predict`](/api/sentencerecognizer#predict) and
[`get_loss`](/api/sentencerecognizer#get_loss).
> #### Example
diff --git a/website/docs/api/tagger.md b/website/docs/api/tagger.md
index 233171779..7ea29e53c 100644
--- a/website/docs/api/tagger.md
+++ b/website/docs/api/tagger.md
@@ -134,7 +134,8 @@ Initialize the pipe for training, using data examples if available. Returns an
## Tagger.predict {#predict tag="method"}
-Apply the pipeline's model to a batch of docs, without modifying them.
+Apply the component's model to a batch of [`Doc`](/api/doc) objects, without
+modifying them.
> #### Example
>
@@ -150,7 +151,7 @@ Apply the pipeline's model to a batch of docs, without modifying them.
## Tagger.set_annotations {#set_annotations tag="method"}
-Modify a batch of documents, using pre-computed scores.
+Modify a batch of [`Doc`](/api/doc) objects, using pre-computed scores.
> #### Example
>
@@ -167,8 +168,9 @@ Modify a batch of documents, using pre-computed scores.
## Tagger.update {#update tag="method"}
-Learn from a batch of documents and gold-standard information, updating the
-pipe's model. Delegates to [`predict`](/api/tagger#predict) and
+Learn from a batch of [`Example`](/api/example) objects containing the
+predictions and gold-standard annotations, and update the component's model.
+Delegates to [`predict`](/api/tagger#predict) and
[`get_loss`](/api/tagger#get_loss).
> #### Example
diff --git a/website/docs/api/textcategorizer.md b/website/docs/api/textcategorizer.md
index 5af540828..494bc569f 100644
--- a/website/docs/api/textcategorizer.md
+++ b/website/docs/api/textcategorizer.md
@@ -142,7 +142,8 @@ Initialize the pipe for training, using data examples if available. Returns an
## TextCategorizer.predict {#predict tag="method"}
-Apply the pipeline's model to a batch of docs, without modifying them.
+Apply the component's model to a batch of [`Doc`](/api/doc) objects, without
+modifying them.
> #### Example
>
@@ -158,7 +159,7 @@ Apply the pipeline's model to a batch of docs, without modifying them.
## TextCategorizer.set_annotations {#set_annotations tag="method"}
-Modify a batch of documents, using pre-computed scores.
+Modify a batch of [`Doc`](/api/doc) objects, using pre-computed scores.
> #### Example
>
@@ -175,8 +176,9 @@ Modify a batch of documents, using pre-computed scores.
## TextCategorizer.update {#update tag="method"}
-Learn from a batch of documents and gold-standard information, updating the
-pipe's model. Delegates to [`predict`](/api/textcategorizer#predict) and
+Learn from a batch of [`Example`](/api/example) objects containing the
+predictions and gold-standard annotations, and update the component's model.
+Delegates to [`predict`](/api/textcategorizer#predict) and
[`get_loss`](/api/textcategorizer#get_loss).
> #### Example
diff --git a/website/docs/api/tok2vec.md b/website/docs/api/tok2vec.md
index dce595023..8e5f78bf7 100644
--- a/website/docs/api/tok2vec.md
+++ b/website/docs/api/tok2vec.md
@@ -145,7 +145,8 @@ Initialize the pipe for training, using data examples if available. Returns an
## Tok2Vec.predict {#predict tag="method"}
-Apply the pipeline's model to a batch of docs, without modifying them.
+Apply the component's model to a batch of [`Doc`](/api/doc) objects, without
+modifying them.
> #### Example
>
@@ -161,7 +162,7 @@ Apply the pipeline's model to a batch of docs, without modifying them.
## Tok2Vec.set_annotations {#set_annotations tag="method"}
-Modify a batch of documents, using pre-computed scores.
+Modify a batch of [`Doc`](/api/doc) objects, using pre-computed scores.
> #### Example
>
@@ -178,8 +179,9 @@ Modify a batch of documents, using pre-computed scores.
## Tok2Vec.update {#update tag="method"}
-Learn from a batch of documents and gold-standard information, updating the
-pipe's model. Delegates to [`predict`](/api/tok2vec#predict).
+Learn from a batch of [`Example`](/api/example) objects containing the
+predictions and gold-standard annotations, and update the component's model.
+Delegates to [`predict`](/api/tok2vec#predict).
> #### Example
>
diff --git a/website/docs/api/token.md b/website/docs/api/token.md
index ca6b57a5b..6390ab975 100644
--- a/website/docs/api/token.md
+++ b/website/docs/api/token.md
@@ -392,73 +392,74 @@ The L2 norm of the token's vector representation.
## Attributes {#attributes}
-| Name | Type | Description |
-| -------------------------------------------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `doc` | `Doc` | The parent document. |
-| `sent` 2.0.12 | `Span` | The sentence span that this token is a part of. |
-| `text` | str | Verbatim text content. |
-| `text_with_ws` | str | Text content, with trailing space character if present. |
-| `whitespace_` | str | Trailing space character if present. |
-| `orth` | int | ID of the verbatim text content. |
-| `orth_` | str | Verbatim text content (identical to `Token.text`). Exists mostly for consistency with the other attributes. |
-| `vocab` | `Vocab` | The vocab object of the parent `Doc`. |
-| `tensor` 2.1.7 | `ndarray` | The tokens's slice of the parent `Doc`'s tensor. |
-| `head` | `Token` | The syntactic parent, or "governor", of this token. |
-| `left_edge` | `Token` | The leftmost token of this token's syntactic descendants. |
-| `right_edge` | `Token` | The rightmost token of this token's syntactic descendants. |
-| `i` | int | The index of the token within the parent document. |
-| `ent_type` | int | Named entity type. |
-| `ent_type_` | str | Named entity type. |
-| `ent_iob` | int | IOB code of named entity tag. `3` means the token begins an entity, `2` means it is outside an entity, `1` means it is inside an entity, and `0` means no entity tag is set. |
-| `ent_iob_` | str | IOB code of named entity tag. "B" means the token begins an entity, "I" means it is inside an entity, "O" means it is outside an entity, and "" means no entity tag is set. |
-| `ent_kb_id` 2.2 | int | Knowledge base ID that refers to the named entity this token is a part of, if any. |
-| `ent_kb_id_` 2.2 | str | Knowledge base ID that refers to the named entity this token is a part of, if any. |
-| `ent_id` | int | ID of the entity the token is an instance of, if any. Currently not used, but potentially for coreference resolution. |
-| `ent_id_` | str | ID of the entity the token is an instance of, if any. Currently not used, but potentially for coreference resolution. |
-| `lemma` | int | Base form of the token, with no inflectional suffixes. |
-| `lemma_` | str | Base form of the token, with no inflectional suffixes. |
-| `norm` | int | The token's norm, i.e. a normalized form of the token text. Usually set in the language's [tokenizer exceptions](/usage/adding-languages#tokenizer-exceptions) or [norm exceptions](/usage/adding-languages#norm-exceptions). |
-| `norm_` | str | The token's norm, i.e. a normalized form of the token text. Usually set in the language's [tokenizer exceptions](/usage/adding-languages#tokenizer-exceptions) or [norm exceptions](/usage/adding-languages#norm-exceptions). |
-| `lower` | int | Lowercase form of the token. |
-| `lower_` | str | Lowercase form of the token text. Equivalent to `Token.text.lower()`. |
-| `shape` | int | Transform of the tokens's string, to show orthographic features. Alphabetic characters are replaced by `x` or `X`, and numeric characters are replaced by `d`, and sequences of the same character are truncated after length 4. For example,`"Xxxx"`or`"dd"`. |
-| `shape_` | str | Transform of the tokens's string, to show orthographic features. Alphabetic characters are replaced by `x` or `X`, and numeric characters are replaced by `d`, and sequences of the same character are truncated after length 4. For example,`"Xxxx"`or`"dd"`. |
-| `prefix` | int | Hash value of a length-N substring from the start of the token. Defaults to `N=1`. |
-| `prefix_` | str | A length-N substring from the start of the token. Defaults to `N=1`. |
-| `suffix` | int | Hash value of a length-N substring from the end of the token. Defaults to `N=3`. |
-| `suffix_` | str | Length-N substring from the end of the token. Defaults to `N=3`. |
-| `is_alpha` | bool | Does the token consist of alphabetic characters? Equivalent to `token.text.isalpha()`. |
-| `is_ascii` | bool | Does the token consist of ASCII characters? Equivalent to `all(ord(c) < 128 for c in token.text)`. |
-| `is_digit` | bool | Does the token consist of digits? Equivalent to `token.text.isdigit()`. |
-| `is_lower` | bool | Is the token in lowercase? Equivalent to `token.text.islower()`. |
-| `is_upper` | bool | Is the token in uppercase? Equivalent to `token.text.isupper()`. |
-| `is_title` | bool | Is the token in titlecase? Equivalent to `token.text.istitle()`. |
-| `is_punct` | bool | Is the token punctuation? |
-| `is_left_punct` | bool | Is the token a left punctuation mark, e.g. `"("` ? |
-| `is_right_punct` | bool | Is the token a right punctuation mark, e.g. `")"` ? |
-| `is_space` | bool | Does the token consist of whitespace characters? Equivalent to `token.text.isspace()`. |
-| `is_bracket` | bool | Is the token a bracket? |
-| `is_quote` | bool | Is the token a quotation mark? |
-| `is_currency` 2.0.8 | bool | Is the token a currency symbol? |
-| `like_url` | bool | Does the token resemble a URL? |
-| `like_num` | bool | Does the token represent a number? e.g. "10.9", "10", "ten", etc. |
-| `like_email` | bool | Does the token resemble an email address? |
-| `is_oov` | bool | Does the token have a word vector? |
-| `is_stop` | bool | Is the token part of a "stop list"? |
-| `pos` | int | Coarse-grained part-of-speech from the [Universal POS tag set](https://universaldependencies.org/docs/u/pos/). |
-| `pos_` | str | Coarse-grained part-of-speech from the [Universal POS tag set](https://universaldependencies.org/docs/u/pos/). |
-| `tag` | int | Fine-grained part-of-speech. |
-| `tag_` | str | Fine-grained part-of-speech. |
-| `morph` | `MorphAnalysis` | Morphological analysis. |
-| `morph_` | str | Morphological analysis in UD FEATS format. |
-| `dep` | int | Syntactic dependency relation. |
-| `dep_` | str | Syntactic dependency relation. |
-| `lang` | int | Language of the parent document's vocabulary. |
-| `lang_` | str | Language of the parent document's vocabulary. |
-| `prob` | float | Smoothed log probability estimate of token's word type (context-independent entry in the vocabulary). |
-| `idx` | int | The character offset of the token within the parent document. |
-| `sentiment` | float | A scalar value indicating the positivity or negativity of the token. |
-| `lex_id` | int | Sequential ID of the token's lexical type, used to index into tables, e.g. for word vectors. |
-| `rank` | int | Sequential ID of the token's lexical type, used to index into tables, e.g. for word vectors. |
-| `cluster` | int | Brown cluster ID. |
-| `_` | `Underscore` | User space for adding custom [attribute extensions](/usage/processing-pipelines#custom-components-attributes). |
+| Name | Type | Description |
+| -------------------------------------------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `doc` | `Doc` | The parent document. |
+| `lex` 3 | [`Lexeme`](/api/lexeme) | The underlying lexeme. |
+| `sent` 2.0.12 | [`Span`](/api/span) | The sentence span that this token is a part of. |
+| `text` | str | Verbatim text content. |
+| `text_with_ws` | str | Text content, with trailing space character if present. |
+| `whitespace_` | str | Trailing space character if present. |
+| `orth` | int | ID of the verbatim text content. |
+| `orth_` | str | Verbatim text content (identical to `Token.text`). Exists mostly for consistency with the other attributes. |
+| `vocab` | `Vocab` | The vocab object of the parent `Doc`. |
+| `tensor` 2.1.7 | `ndarray` | The tokens's slice of the parent `Doc`'s tensor. |
+| `head` | `Token` | The syntactic parent, or "governor", of this token. |
+| `left_edge` | `Token` | The leftmost token of this token's syntactic descendants. |
+| `right_edge` | `Token` | The rightmost token of this token's syntactic descendants. |
+| `i` | int | The index of the token within the parent document. |
+| `ent_type` | int | Named entity type. |
+| `ent_type_` | str | Named entity type. |
+| `ent_iob` | int | IOB code of named entity tag. `3` means the token begins an entity, `2` means it is outside an entity, `1` means it is inside an entity, and `0` means no entity tag is set. |
+| `ent_iob_` | str | IOB code of named entity tag. "B" means the token begins an entity, "I" means it is inside an entity, "O" means it is outside an entity, and "" means no entity tag is set. |
+| `ent_kb_id` 2.2 | int | Knowledge base ID that refers to the named entity this token is a part of, if any. |
+| `ent_kb_id_` 2.2 | str | Knowledge base ID that refers to the named entity this token is a part of, if any. |
+| `ent_id` | int | ID of the entity the token is an instance of, if any. Currently not used, but potentially for coreference resolution. |
+| `ent_id_` | str | ID of the entity the token is an instance of, if any. Currently not used, but potentially for coreference resolution. |
+| `lemma` | int | Base form of the token, with no inflectional suffixes. |
+| `lemma_` | str | Base form of the token, with no inflectional suffixes. |
+| `norm` | int | The token's norm, i.e. a normalized form of the token text. Usually set in the language's [tokenizer exceptions](/usage/adding-languages#tokenizer-exceptions) or [norm exceptions](/usage/adding-languages#norm-exceptions). |
+| `norm_` | str | The token's norm, i.e. a normalized form of the token text. Usually set in the language's [tokenizer exceptions](/usage/adding-languages#tokenizer-exceptions) or [norm exceptions](/usage/adding-languages#norm-exceptions). |
+| `lower` | int | Lowercase form of the token. |
+| `lower_` | str | Lowercase form of the token text. Equivalent to `Token.text.lower()`. |
+| `shape` | int | Transform of the tokens's string, to show orthographic features. Alphabetic characters are replaced by `x` or `X`, and numeric characters are replaced by `d`, and sequences of the same character are truncated after length 4. For example,`"Xxxx"`or`"dd"`. |
+| `shape_` | str | Transform of the tokens's string, to show orthographic features. Alphabetic characters are replaced by `x` or `X`, and numeric characters are replaced by `d`, and sequences of the same character are truncated after length 4. For example,`"Xxxx"`or`"dd"`. |
+| `prefix` | int | Hash value of a length-N substring from the start of the token. Defaults to `N=1`. |
+| `prefix_` | str | A length-N substring from the start of the token. Defaults to `N=1`. |
+| `suffix` | int | Hash value of a length-N substring from the end of the token. Defaults to `N=3`. |
+| `suffix_` | str | Length-N substring from the end of the token. Defaults to `N=3`. |
+| `is_alpha` | bool | Does the token consist of alphabetic characters? Equivalent to `token.text.isalpha()`. |
+| `is_ascii` | bool | Does the token consist of ASCII characters? Equivalent to `all(ord(c) < 128 for c in token.text)`. |
+| `is_digit` | bool | Does the token consist of digits? Equivalent to `token.text.isdigit()`. |
+| `is_lower` | bool | Is the token in lowercase? Equivalent to `token.text.islower()`. |
+| `is_upper` | bool | Is the token in uppercase? Equivalent to `token.text.isupper()`. |
+| `is_title` | bool | Is the token in titlecase? Equivalent to `token.text.istitle()`. |
+| `is_punct` | bool | Is the token punctuation? |
+| `is_left_punct` | bool | Is the token a left punctuation mark, e.g. `"("` ? |
+| `is_right_punct` | bool | Is the token a right punctuation mark, e.g. `")"` ? |
+| `is_space` | bool | Does the token consist of whitespace characters? Equivalent to `token.text.isspace()`. |
+| `is_bracket` | bool | Is the token a bracket? |
+| `is_quote` | bool | Is the token a quotation mark? |
+| `is_currency` 2.0.8 | bool | Is the token a currency symbol? |
+| `like_url` | bool | Does the token resemble a URL? |
+| `like_num` | bool | Does the token represent a number? e.g. "10.9", "10", "ten", etc. |
+| `like_email` | bool | Does the token resemble an email address? |
+| `is_oov` | bool | Does the token have a word vector? |
+| `is_stop` | bool | Is the token part of a "stop list"? |
+| `pos` | int | Coarse-grained part-of-speech from the [Universal POS tag set](https://universaldependencies.org/docs/u/pos/). |
+| `pos_` | str | Coarse-grained part-of-speech from the [Universal POS tag set](https://universaldependencies.org/docs/u/pos/). |
+| `tag` | int | Fine-grained part-of-speech. |
+| `tag_` | str | Fine-grained part-of-speech. |
+| `morph` | `MorphAnalysis` | Morphological analysis. |
+| `morph_` | str | Morphological analysis in UD FEATS format. |
+| `dep` | int | Syntactic dependency relation. |
+| `dep_` | str | Syntactic dependency relation. |
+| `lang` | int | Language of the parent document's vocabulary. |
+| `lang_` | str | Language of the parent document's vocabulary. |
+| `prob` | float | Smoothed log probability estimate of token's word type (context-independent entry in the vocabulary). |
+| `idx` | int | The character offset of the token within the parent document. |
+| `sentiment` | float | A scalar value indicating the positivity or negativity of the token. |
+| `lex_id` | int | Sequential ID of the token's lexical type, used to index into tables, e.g. for word vectors. |
+| `rank` | int | Sequential ID of the token's lexical type, used to index into tables, e.g. for word vectors. |
+| `cluster` | int | Brown cluster ID. |
+| `_` | `Underscore` | User space for adding custom [attribute extensions](/usage/processing-pipelines#custom-components-attributes). |
diff --git a/website/docs/api/transformer.md b/website/docs/api/transformer.md
index 57f06cd9e..a8b328688 100644
--- a/website/docs/api/transformer.md
+++ b/website/docs/api/transformer.md
@@ -179,7 +179,8 @@ Initialize the pipe for training, using data examples if available. Returns an
## Transformer.predict {#predict tag="method"}
-Apply the pipeline's model to a batch of docs, without modifying them.
+Apply the component's model to a batch of [`Doc`](/api/doc) objects, without
+modifying them.
> #### Example
>
diff --git a/website/docs/images/architecture.svg b/website/docs/images/architecture.svg
index 8279e6432..2e271e98a 100644
--- a/website/docs/images/architecture.svg
+++ b/website/docs/images/architecture.svg
@@ -1,132 +1,226 @@
-
+--->
## Extension attributes {#custom-components-attributes new="2"}
diff --git a/website/docs/usage/spacy-101.md b/website/docs/usage/spacy-101.md
index 27c4e3eb3..49cdd96ea 100644
--- a/website/docs/usage/spacy-101.md
+++ b/website/docs/usage/spacy-101.md
@@ -6,11 +6,11 @@ menu:
- ['Features', 'features']
- ['Linguistic Annotations', 'annotations']
- ['Pipelines', 'pipelines']
+ - ['Architecture', 'architecture']
- ['Vocab', 'vocab']
- ['Serialization', 'serialization']
- ['Training', 'training']
- ['Language Data', 'language-data']
- - ['Architecture', 'architecture']
- ['Community & FAQ', 'community-faq']
---
@@ -71,12 +71,11 @@ systems, or to pre-process text for **deep learning**.
- [Named entities](#annotations-ner)
- [Word vectors and similarity](#vectors-similarity)
- [Pipelines](#pipelines)
+- [Library architecture](#architecture)
- [Vocab, hashes and lexemes](#vocab)
- [Serialization](#serialization)
- [Training](#training)
- [Language data](#language-data)
-- [Lightning tour](#lightning-tour)
-- [Architecture](#architecture)
- [Community & FAQ](#community)
@@ -266,6 +265,12 @@ guide on [language processing pipelines](/usage/processing-pipelines).
+## Architecture {#architecture}
+
+import Architecture101 from 'usage/101/\_architecture.md'
+
+
+
## Vocab, hashes and lexemes {#vocab}
Whenever possible, spaCy tries to store data in a vocabulary, the
@@ -411,12 +416,6 @@ import LanguageData101 from 'usage/101/\_language-data.md'
-## Architecture {#architecture}
-
-import Architecture101 from 'usage/101/\_architecture.md'
-
-
-
## Community & FAQ {#community-faq}
We're very happy to see the spaCy community grow and include a mix of people