Compare commits

..

6 Commits

Author SHA1 Message Date
Lise dfe27516d9 extend abbreviations list in Faroese tokenizer exceptions (#13366)
tests / Validate (push) Has been cancelled
tests / Test (macos-latest, 3.11) (push) Has been cancelled
tests / Test (macos-latest, 3.12) (push) Has been cancelled
tests / Test (macos-latest, 3.8) (push) Has been cancelled
tests / Test (ubuntu-latest, 3.12) (push) Has been cancelled
tests / Test (ubuntu-latest, 3.9) (push) Has been cancelled
tests / Test (windows-latest, 3.10) (push) Has been cancelled
tests / Test (windows-latest, 3.12) (push) Has been cancelled
tests / Test (windows-latest, 3.7) (push) Has been cancelled
2024-03-25 15:36:11 +01:00
Sofie Van Landeghem c32c1289a9 Merge pull request #13282 from danieldk/maintenance/merge-main-into-develop-20240129
Merge main into `develop`
2024-01-30 13:51:33 +01:00
Daniël de Kok a36474600f Merge remote-tracking branch 'upstream/master' into maintenance/merge-main-into-develop-20240129 2024-01-29 14:31:09 +01:00
Daniël de Kok b25927251d Merge pull request #13271 from danieldk/maintenance/develop-merge-master-20240125
Merge `master` into `develop`
2024-01-26 12:50:51 +01:00
Daniël de Kok e1c1889acf Merge remote-tracking branch 'upstream/master' into develop 2024-01-25 16:09:51 +01:00
Adriane Boyd 7174588155 Merge pull request #13107 from adrianeboyd/chore/update-develop-from-master-v3.8-1
Update develop from master for v3.8
2023-11-05 16:12:08 +01:00
40 changed files with 532 additions and 2096 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: false
matrix:
branch: [master, main]
branch: [master, v4]
if: github.repository_owner == 'explosion'
runs-on: ubuntu-latest
steps:
+1 -1
View File
@@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: false
matrix:
branch: [master, main]
branch: [master, v4]
if: github.repository_owner == 'explosion'
runs-on: ubuntu-latest
steps:
+6 -5
View File
@@ -449,12 +449,13 @@ and plugins in spaCy v3.0, and we can't wait to see what you build with it!
[`spacy`](https://github.com/topics/spacy?o=desc&s=stars) and
[`spacy-extensions`](https://github.com/topics/spacy-extension?o=desc&s=stars)
to make it easier to find. Those are also the topics we're linking to from the
spaCy website. If you're sharing your project on X, feel free to tag
[@spacy_io](https://x.com/spacy_io) so we can check it out.
spaCy website. If you're sharing your project on Twitter, feel free to tag
[@spacy_io](https://twitter.com/spacy_io) so we can check it out.
- Once your extension is published, you can open a
[PR](https://github.com/explosion/spaCy/pulls) to suggest it for the
[Universe](https://spacy.io/universe) page.
- Once your extension is published, you can open an issue on the
[issue tracker](https://github.com/explosion/spacy/issues) to suggest it for the
[resources directory](https://spacy.io/usage/resources#extensions) on the
website.
📖 **For more tips and best practices, see the [checklist for developing spaCy extensions](https://spacy.io/usage/processing-pipelines#extensions).**
+1
View File
@@ -28,6 +28,7 @@ open-source software, released under the
<br />
[![PyPi downloads](https://static.pepy.tech/personalized-badge/spacy?period=total&units=international_system&left_color=grey&right_color=orange&left_text=pip%20downloads)](https://pypi.org/project/spacy/)
[![Conda downloads](https://img.shields.io/conda/dn/conda-forge/spacy?label=conda%20downloads)](https://anaconda.org/conda-forge/spacy)
[![spaCy on Twitter](https://img.shields.io/twitter/follow/spacy_io.svg?style=social&label=Follow)](https://twitter.com/spacy_io)
## 📖 Documentation
+1 -1
View File
@@ -1,5 +1,5 @@
# fmt: off
__title__ = "spacy"
__version__ = "3.7.3"
__version__ = "3.7.2"
__download_url__ = "https://github.com/explosion/spacy-models/releases/download"
__compatibility__ = "https://raw.githubusercontent.com/explosion/spacy-models/master/compatibility.json"
+2 -2
View File
@@ -39,7 +39,7 @@ def find_threshold_cli(
# fmt: on
):
"""
Runs prediction trials for a trained model with varying thresholds to maximize
Runs prediction trials for a trained model with varying tresholds to maximize
the specified metric. The search space for the threshold is traversed linearly
from 0 to 1 in `n_trials` steps. Results are displayed in a table on `stdout`
(the corresponding API call to `spacy.cli.find_threshold.find_threshold()`
@@ -81,7 +81,7 @@ def find_threshold(
silent: bool = True,
) -> Tuple[float, float, Dict[float, float]]:
"""
Runs prediction trials for models with varying thresholds to maximize the specified metric.
Runs prediction trials for models with varying tresholds to maximize the specified metric.
model (Union[str, Path]): Pipeline to evaluate. Can be a package or a path to a data directory.
data_path (Path): Path to file with DocBin with docs to use for threshold search.
pipe_name (str): Name of pipe to examine thresholds for.
+67
View File
@@ -5,7 +5,9 @@ from ..tokenizer_exceptions import BASE_EXCEPTIONS
_exc = {}
for orth in [
"Chr.",
"apr.",
"atm.",
"aug.",
"avgr.",
"árg.",
@@ -15,21 +17,53 @@ for orth in [
"blaðkv.",
"blm.",
"blaðm.",
"blaðstj.",
"blkv.",
"blm.",
"bls.",
"blstj.",
"blaðstj.",
"cand.",
"dagf.",
"des.",
"dkr.",
"dr.",
"e.Kr.",
"eint.",
"ex.",
"exam.",
"f.",
"f.Kr.",
"fa.",
"fam.",
"feb.",
"febr.",
"ff.",
"fl.",
"form.",
"frí.",
"fyrrv.",
"góðk.",
"h.m.",
"hósd.",
"innt.",
"jan.",
"kap.",
"kgl.",
"kl.",
"kr.",
"leyg.",
"m.a.",
"mðr.",
"m.o.",
"m.ø.",
"mia.",
"mik.",
"min.",
"mió.",
"mán.",
"mðr.",
"nov.",
"nr.",
"nto.",
"nov.",
@@ -43,12 +77,25 @@ for orth in [
"o.o.",
"o.s.fr.",
"o.tíl.",
"o.u.",
"o.ø.",
"okt.",
"omf.",
"ph.d.",
"phil.",
"pr.",
"pst.",
"ritstj.",
"s.",
"sb.",
"sbr.",
"sbrt.",
"sek.",
"sep.",
"sept.",
"serst.",
"smb.",
"smbr.",
"sms.",
"smst.",
"smb.",
@@ -58,14 +105,25 @@ for orth in [
"sept.",
"spf.",
"spsk.",
"stk.",
"sunnud.",
"t.",
"t.d.",
"t.e.",
"t.o.v.",
"t.s.",
"t.s.s.",
"tlf.",
"t.v.s",
"t.v.s.",
"tel.",
"tils.",
"tlf.",
"tsk.",
"t.o.v.",
"t.d.",
"tús.",
"týs.",
"uml.",
"ums.",
"uppl.",
@@ -75,13 +133,22 @@ for orth in [
"útl.",
"útr.",
"vanl.",
"upprfr.",
"v.",
"v.h.",
"v.m.",
"v.ø.o.",
"vanl.",
"viðm.",
"viðv.",
"vm.",
"v.m.",
"á.Kr.",
"árg.",
"ávís.",
"útg.",
"útl.",
"útr.",
]:
_exc[orth] = [{ORTH: orth}]
capitalized = orth.capitalize()
+2 -5
View File
@@ -1716,7 +1716,6 @@ class Language:
# is done, so that they can exit gracefully.
for q in texts_q:
q.put(_WORK_DONE_SENTINEL)
q.close()
# Otherwise, we are stopping because the error handler raised an
# exception. The sentinel will be last to go out of the queue.
@@ -2348,8 +2347,7 @@ def _apply_pipes(
# Stop working if we encounter the end-of-work sentinel.
if isinstance(texts_with_ctx, _WorkDoneSentinel):
sender.close()
receiver.close()
return
docs = (
ensure_doc(doc_like, context) for doc_like, context in texts_with_ctx
@@ -2373,8 +2371,7 @@ def _apply_pipes(
# Parent has closed the pipe prematurely. This happens when a
# worker encounters an error and the error handler is set to
# stop processing.
sender.close()
receiver.close()
return
class _Sender:
+1 -14
View File
@@ -185,11 +185,6 @@ def build_text_classifier_v2(
def init_ensemble_textcat(model, X, Y) -> Model:
# When tok2vec is lazily initialized, we need to initialize it before
# the rest of the chain to ensure that we can get its width.
tok2vec = model.get_ref("tok2vec")
tok2vec.initialize(X)
tok2vec_width = get_tok2vec_width(model)
model.get_ref("attention_layer").set_dim("nO", tok2vec_width)
model.get_ref("maxout_layer").set_dim("nO", tok2vec_width)
@@ -269,7 +264,6 @@ def _build_parametric_attention_with_residual_nonlinear(
parametric_attention.set_ref("tok2vec", tok2vec)
parametric_attention.set_ref("attention_layer", attention_layer)
parametric_attention.set_ref("key_transform", key_transform)
parametric_attention.set_ref("nonlinear_layer", nonlinear_layer)
parametric_attention.set_ref("norm_layer", norm_layer)
@@ -277,17 +271,10 @@ def _build_parametric_attention_with_residual_nonlinear(
def _init_parametric_attention_with_residual_nonlinear(model, X, Y) -> Model:
# When tok2vec is lazily initialized, we need to initialize it before
# the rest of the chain to ensure that we can get its width.
tok2vec = model.get_ref("tok2vec")
tok2vec.initialize(X)
tok2vec_width = get_tok2vec_width(model)
model.get_ref("attention_layer").set_dim("nO", tok2vec_width)
model.get_ref("key_transform").set_dim("nI", tok2vec_width)
model.get_ref("key_transform").set_dim("nO", tok2vec_width)
model.get_ref("nonlinear_layer").set_dim("nI", tok2vec_width)
model.get_ref("nonlinear_layer").set_dim("nO", tok2vec_width)
model.get_ref("nonlinear_layer").set_dim("nI", tok2vec_width)
model.get_ref("norm_layer").set_dim("nI", tok2vec_width)
model.get_ref("norm_layer").set_dim("nO", tok2vec_width)
init_chain(model, X, Y)
-37
View File
@@ -28,8 +28,6 @@ from spacy.tokens import Doc, DocBin
from spacy.training import Example
from spacy.training.initialize import init_nlp
# Ensure that the architecture gets added to the registry.
from ..tok2vec import build_lazy_init_tok2vec as _
from ..util import make_tempdir
TRAIN_DATA_SINGLE_LABEL = [
@@ -42,13 +40,6 @@ TRAIN_DATA_MULTI_LABEL = [
("I'm confused but happy", {"cats": {"ANGRY": 0.0, "CONFUSED": 1.0, "HAPPY": 1.0}}),
]
lazy_init_model_config = """
[model]
@architectures = "test.LazyInitTok2Vec.v1"
width = 96
"""
LAZY_INIT_TOK2VEC_MODEL = Config().from_str(lazy_init_model_config)["model"]
def make_get_examples_single_label(nlp):
train_examples = []
@@ -555,34 +546,6 @@ def test_error_with_multi_labels():
nlp.initialize(get_examples=lambda: train_examples)
# fmt: off
@pytest.mark.parametrize(
"name,textcat_config",
[
# ENSEMBLE V2
("textcat_multilabel", {"@architectures": "spacy.TextCatEnsemble.v2", "tok2vec": LAZY_INIT_TOK2VEC_MODEL, "linear_model": {"@architectures": "spacy.TextCatBOW.v3", "exclusive_classes": False, "ngram_size": 1, "no_output_layer": False}}),
("textcat", {"@architectures": "spacy.TextCatEnsemble.v2", "tok2vec": LAZY_INIT_TOK2VEC_MODEL, "linear_model": {"@architectures": "spacy.TextCatBOW.v3", "exclusive_classes": True, "ngram_size": 5, "no_output_layer": False}}),
# PARAMETRIC ATTENTION V1
("textcat", {"@architectures": "spacy.TextCatParametricAttention.v1", "tok2vec": LAZY_INIT_TOK2VEC_MODEL, "exclusive_classes": True}),
("textcat_multilabel", {"@architectures": "spacy.TextCatParametricAttention.v1", "tok2vec": LAZY_INIT_TOK2VEC_MODEL, "exclusive_classes": False}),
# REDUCE
("textcat", {"@architectures": "spacy.TextCatReduce.v1", "tok2vec": LAZY_INIT_TOK2VEC_MODEL, "exclusive_classes": True, "use_reduce_first": True, "use_reduce_last": True, "use_reduce_max": True, "use_reduce_mean": True}),
("textcat_multilabel", {"@architectures": "spacy.TextCatReduce.v1", "tok2vec": LAZY_INIT_TOK2VEC_MODEL, "exclusive_classes": False, "use_reduce_first": True, "use_reduce_last": True, "use_reduce_max": True, "use_reduce_mean": True}),
],
)
# fmt: on
def test_tok2vec_lazy_init(name, textcat_config):
# Check that we can properly initialize and use a textcat model using
# a lazily-initialized tok2vec.
nlp = English()
pipe_config = {"model": textcat_config}
textcat = nlp.add_pipe(name, config=pipe_config)
textcat.add_label("POSITIVE")
textcat.add_label("NEGATIVE")
nlp.initialize()
nlp.pipe(["This is a test."])
@pytest.mark.parametrize(
"name,get_examples, train_data",
[
+1 -1
View File
@@ -328,7 +328,7 @@ def test_language_pipe_error_handler(n_process):
nlp.set_error_handler(raise_error)
with pytest.raises(ValueError):
list(nlp.pipe(texts, n_process=n_process))
# set explicitly to ignoring
# set explicitely to ignoring
nlp.set_error_handler(ignore_error)
docs = list(nlp.pipe(texts, n_process=n_process))
assert len(docs) == 0
-36
View File
@@ -1,36 +0,0 @@
from typing import List
from thinc.api import Model
from thinc.types import Floats2d
from spacy.tokens import Doc
from spacy.util import registry
@registry.architectures("test.LazyInitTok2Vec.v1")
def build_lazy_init_tok2vec(*, width: int) -> Model[List[Doc], List[Floats2d]]:
"""tok2vec model of which the output size is only known after
initialization. This implementation does not output meaningful
embeddings, it is strictly for testing."""
return Model(
"lazy_init_tok2vec",
lazy_init_tok2vec_forward,
init=lazy_init_tok2vec_init,
dims={"nO": None},
attrs={"width": width},
)
def lazy_init_tok2vec_init(model: Model, X=None, Y=None):
width = model.attrs["width"]
model.set_dim("nO", width)
def lazy_init_tok2vec_forward(model: Model, X: List[Doc], is_train: bool):
width = model.get_dim("nO")
Y = [model.ops.alloc2f(len(doc), width) for doc in X]
def backprop(dY):
return []
return Y, backprop
+30 -30
View File
@@ -45,33 +45,33 @@ For attributes that represent string values, the internal integer ID is accessed
as `Token.attr`, e.g. `token.dep`, while the string value can be retrieved by
appending `_` as in `token.dep_`.
| Attribute | Description |
| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `DEP` | The token's dependency label. ~~str~~ |
| `ENT_ID` | The token's entity ID (`ent_id`). ~~str~~ |
| `ENT_IOB` | The IOB part of the token's entity tag. Uses custom integer values rather than the string store: unset is `0`, `I` is `1`, `O` is `2`, and `B` is `3`. ~~str~~ |
| `ENT_KB_ID` | The token's entity knowledge base ID. ~~str~~ |
| `ENT_TYPE` | The token's entity label. ~~str~~ |
| `IS_ALPHA` | Token text consists of alphabetic characters. ~~bool~~ |
| `IS_ASCII` | Token text consists of ASCII characters. ~~bool~~ |
| `IS_DIGIT` | Token text consists of digits. ~~bool~~ |
| `IS_LOWER` | Token text is in lowercase. ~~bool~~ |
| `IS_PUNCT` | Token is punctuation. ~~bool~~ |
| `IS_SPACE` | Token is whitespace. ~~bool~~ |
| `IS_STOP` | Token is a stop word. ~~bool~~ |
| `IS_TITLE` | Token text is in titlecase. ~~bool~~ |
| `IS_UPPER` | Token text is in uppercase. ~~bool~~ |
| `LEMMA` | The token's lemma. ~~str~~ |
| `LENGTH` | The length of the token text. ~~int~~ |
| `LIKE_EMAIL` | Token text resembles an email address. ~~bool~~ |
| `LIKE_NUM` | Token text resembles a number. ~~bool~~ |
| `LIKE_URL` | Token text resembles a URL. ~~bool~~ |
| `LOWER` | The lowercase form of the token text. ~~str~~ |
| `MORPH` | The token's morphological analysis. ~~MorphAnalysis~~ |
| `NORM` | The normalized form of the token text. ~~str~~ |
| `ORTH` | The exact verbatim text of a token. ~~str~~ |
| `POS` | The token's universal part of speech (UPOS). ~~str~~ |
| `SENT_START` | Token is start of sentence. ~~bool~~ |
| `SHAPE` | The token's shape. ~~str~~ |
| `SPACY` | Token has a trailing space. ~~bool~~ |
| `TAG` | The token's fine-grained part of speech. ~~str~~ |
| Attribute | Description |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `DEP` | The token's dependency label. ~~str~~ |
| `ENT_ID` | The token's entity ID (`ent_id`). ~~str~~ |
| `ENT_IOB` | The IOB part of the token's entity tag. Uses custom integer vaues rather than the string store: unset is `0`, `I` is `1`, `O` is `2`, and `B` is `3`. ~~str~~ |
| `ENT_KB_ID` | The token's entity knowledge base ID. ~~str~~ |
| `ENT_TYPE` | The token's entity label. ~~str~~ |
| `IS_ALPHA` | Token text consists of alphabetic characters. ~~bool~~ |
| `IS_ASCII` | Token text consists of ASCII characters. ~~bool~~ |
| `IS_DIGIT` | Token text consists of digits. ~~bool~~ |
| `IS_LOWER` | Token text is in lowercase. ~~bool~~ |
| `IS_PUNCT` | Token is punctuation. ~~bool~~ |
| `IS_SPACE` | Token is whitespace. ~~bool~~ |
| `IS_STOP` | Token is a stop word. ~~bool~~ |
| `IS_TITLE` | Token text is in titlecase. ~~bool~~ |
| `IS_UPPER` | Token text is in uppercase. ~~bool~~ |
| `LEMMA` | The token's lemma. ~~str~~ |
| `LENGTH` | The length of the token text. ~~int~~ |
| `LIKE_EMAIL` | Token text resembles an email address. ~~bool~~ |
| `LIKE_NUM` | Token text resembles a number. ~~bool~~ |
| `LIKE_URL` | Token text resembles a URL. ~~bool~~ |
| `LOWER` | The lowercase form of the token text. ~~str~~ |
| `MORPH` | The token's morphological analysis. ~~MorphAnalysis~~ |
| `NORM` | The normalized form of the token text. ~~str~~ |
| `ORTH` | The exact verbatim text of a token. ~~str~~ |
| `POS` | The token's universal part of speech (UPOS). ~~str~~ |
| `SENT_START` | Token is start of sentence. ~~bool~~ |
| `SHAPE` | The token's shape. ~~str~~ |
| `SPACY` | Token has a trailing space. ~~bool~~ |
| `TAG` | The token's fine-grained part of speech. ~~str~~ |
+2 -2
View File
@@ -567,7 +567,7 @@ New: 'ORG' (23860), 'PERSON' (21395), 'GPE' (21193), 'DATE' (18080), 'CARDINAL'
'LOC' (2113), 'TIME' (1616), 'WORK_OF_ART' (1229), 'QUANTITY' (1150), 'FAC'
(1134), 'EVENT' (974), 'PRODUCT' (935), 'LAW' (444), 'LANGUAGE' (338)
✔ Good amount of examples for all labels
✔ Examples without occurrences available for all labels
✔ Examples without occurences available for all labels
✔ No entities consisting of or starting/ending with whitespace
=========================== Part-of-speech Tagging ===========================
@@ -1320,7 +1320,7 @@ $ python -m spacy apply [model] [data-path] [output-file] [--code] [--text-key]
## find-threshold {id="find-threshold",version="3.5",tag="command"}
Runs prediction trials for a trained model with varying thresholds to maximize
Runs prediction trials for a trained model with varying tresholds to maximize
the specified metric. The search space for the threshold is traversed linearly
from 0 to 1 in `n_trials` steps. Results are displayed in a table on `stdout`
(the corresponding API call to `spacy.cli.find_threshold.find_threshold()`
+16 -16
View File
@@ -67,7 +67,7 @@ architectures and their arguments and hyperparameters.
| `generate_empty_kb` <Tag variant="new">3.5.1</Tag> | Function that generates an empty `KnowledgeBase` object. Defaults to [`spacy.EmptyKB.v2`](/api/architectures#EmptyKB), which generates an empty [`InMemoryLookupKB`](/api/inmemorylookupkb). ~~Callable[[Vocab, int], KnowledgeBase]~~ |
| `overwrite` <Tag variant="new">3.2</Tag> | Whether existing annotation is overwritten. Defaults to `True`. ~~bool~~ |
| `scorer` <Tag variant="new">3.2</Tag> | The scoring method. Defaults to [`Scorer.score_links`](/api/scorer#score_links). ~~Optional[Callable]~~ |
| `threshold` <Tag variant="new">3.4</Tag> | Confidence threshold for entity predictions. The default of `None` implies that all predictions are accepted, otherwise those with a score beneath the threshold are discarded. If there are no predictions with scores above the threshold, the linked entity is `NIL`. ~~Optional[float]~~ |
| `threshold` <Tag variant="new">3.4</Tag> | Confidence threshold for entity predictions. The default of `None` implies that all predictions are accepted, otherwise those with a score beneath the treshold are discarded. If there are no predictions with scores above the threshold, the linked entity is `NIL`. ~~Optional[float]~~ |
```python
%%GITHUB_SPACY/spacy/pipeline/entity_linker.py
@@ -100,21 +100,21 @@ custom knowledge base, you should either call
[`set_kb`](/api/entitylinker#set_kb) or provide a `kb_loader` in the
[`initialize`](/api/entitylinker#initialize) call.
| Name | Description |
| ---------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `vocab` | The shared vocabulary. ~~Vocab~~ |
| `model` | The [`Model`](https://thinc.ai/docs/api-model) powering the pipeline component. ~~Model~~ |
| `name` | String name of the component instance. Used to add entries to the `losses` during training. ~~str~~ |
| _keyword-only_ | |
| `entity_vector_length` | Size of encoding vectors in the KB. ~~int~~ |
| `get_candidates` | Function that generates plausible candidates for a given `Span` object. ~~Callable[[KnowledgeBase, Span], Iterable[Candidate]]~~ |
| `labels_discard` | NER labels that will automatically get a `"NIL"` prediction. ~~Iterable[str]~~ |
| `n_sents` | The number of neighbouring sentences to take into account. ~~int~~ |
| `incl_prior` | Whether or not to include prior probabilities from the KB in the model. ~~bool~~ |
| `incl_context` | Whether or not to include the local context in the model. ~~bool~~ |
| `overwrite` <Tag variant="new">3.2</Tag> | Whether existing annotation is overwritten. Defaults to `True`. ~~bool~~ |
| `scorer` <Tag variant="new">3.2</Tag> | The scoring method. Defaults to [`Scorer.score_links`](/api/scorer#score_links). ~~Optional[Callable]~~ |
| `threshold` <Tag variant="new">3.4</Tag> | Confidence threshold for entity predictions. The default of `None` implies that all predictions are accepted, otherwise those with a score beneath the threshold are discarded. If there are no predictions with scores above the threshold, the linked entity is `NIL`. ~~Optional[float]~~ |
| Name | Description |
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `vocab` | The shared vocabulary. ~~Vocab~~ |
| `model` | The [`Model`](https://thinc.ai/docs/api-model) powering the pipeline component. ~~Model~~ |
| `name` | String name of the component instance. Used to add entries to the `losses` during training. ~~str~~ |
| _keyword-only_ | |
| `entity_vector_length` | Size of encoding vectors in the KB. ~~int~~ |
| `get_candidates` | Function that generates plausible candidates for a given `Span` object. ~~Callable[[KnowledgeBase, Span], Iterable[Candidate]]~~ |
| `labels_discard` | NER labels that will automatically get a `"NIL"` prediction. ~~Iterable[str]~~ |
| `n_sents` | The number of neighbouring sentences to take into account. ~~int~~ |
| `incl_prior` | Whether or not to include prior probabilities from the KB in the model. ~~bool~~ |
| `incl_context` | Whether or not to include the local context in the model. ~~bool~~ |
| `overwrite` <Tag variant="new">3.2</Tag> | Whether existing annotation is overwritten. Defaults to `True`. ~~bool~~ |
| `scorer` <Tag variant="new">3.2</Tag> | The scoring method. Defaults to [`Scorer.score_links`](/api/scorer#score_links). ~~Optional[Callable]~~ |
| `threshold` <Tag variant="new">3.4</Tag> | Confidence threshold for entity predictions. The default of `None` implies that all predictions are accepted, otherwise those with a score beneath the treshold are discarded. If there are no predictions with scores above the threshold, the linked entity is `NIL`. ~~Optional[float]~~ |
## EntityLinker.\_\_call\_\_ {id="call",tag="method"}
+3 -3
View File
@@ -58,7 +58,7 @@ how the component should be configured. You can override its settings via the
| Setting | Description |
| ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `phrase_matcher_attr` | Optional attribute name match on for the internal [`PhraseMatcher`](/api/phrasematcher), e.g. `LOWER` to match on the lowercase token text. Defaults to `None`. ~~Optional[Union[int, str]]~~ |
| `matcher_fuzzy_compare` <Tag variant="new">3.5</Tag> | The fuzzy comparison method, passed on to the internal `Matcher`. Defaults to `spacy.matcher.levenshtein.levenshtein_compare`. ~~Callable~~ |
| `matcher_fuzzy_compare` <Tag variant="new">3.5</Tag> | The fuzzy comparison method, passed on to the internal `Matcher`. Defaults to `spacy.matcher.levenshtein.levenshtein_compare`. ~~Callable~~ |
| `validate` | Whether patterns should be validated (passed to the `Matcher` and `PhraseMatcher`). Defaults to `False`. ~~bool~~ |
| `overwrite_ents` | If existing entities are present, e.g. entities added by the model, overwrite them by matches if necessary. Defaults to `False`. ~~bool~~ |
| `ent_id_sep` | Separator used internally for entity IDs. Defaults to `"\|\|"`. ~~str~~ |
@@ -92,7 +92,7 @@ be a token pattern (list) or a phrase pattern (string). For example:
| `name` <Tag variant="new">3</Tag> | Instance name of the current pipeline component. Typically passed in automatically from the factory when the component is added. Used to disable the current entity ruler while creating phrase patterns with the nlp object. ~~str~~ |
| _keyword-only_ | |
| `phrase_matcher_attr` | Optional attribute name match on for the internal [`PhraseMatcher`](/api/phrasematcher), e.g. `LOWER` to match on the lowercase token text. Defaults to `None`. ~~Optional[Union[int, str]]~~ |
| `matcher_fuzzy_compare` <Tag variant="new">3.5</Tag> | The fuzzy comparison method, passed on to the internal `Matcher`. Defaults to `spacy.matcher.levenshtein.levenshtein_compare`. ~~Callable~~ |
| `matcher_fuzzy_compare` <Tag variant="new">3.5</Tag> | The fuzzy comparison method, passed on to the internal `Matcher`. Defaults to `spacy.matcher.levenshtein.levenshtein_compare`. ~~Callable~~ |
| `validate` | Whether patterns should be validated, passed to Matcher and PhraseMatcher as `validate`. Defaults to `False`. ~~bool~~ |
| `overwrite_ents` | If existing entities are present, e.g. entities added by the model, overwrite them by matches if necessary. Defaults to `False`. ~~bool~~ |
| `ent_id_sep` | Separator used internally for entity IDs. Defaults to `"\|\|"`. ~~str~~ |
@@ -173,7 +173,7 @@ happens automatically after the component has been added to the pipeline using
[`nlp.add_pipe`](/api/language#add_pipe). If the entity ruler was initialized
with `overwrite_ents=True`, existing entities will be replaced if they overlap
with the matches. When matches overlap in a Doc, the entity ruler prioritizes
longer patterns over shorter, and if equal the match occurring first in the Doc
longer patterns over shorter, and if equal the match occuring first in the Doc
is chosen.
> #### Example
-22
View File
@@ -890,28 +890,6 @@ when loading a config with
| `pipe_name` | Name of pipeline component to replace listeners for. ~~str~~ |
| `listeners` | The paths to the listeners, relative to the component config, e.g. `["model.tok2vec"]`. Typically, implementations will only connect to one tok2vec component, `model.tok2vec`, but in theory, custom models can use multiple listeners. The value here can either be an empty list to not replace any listeners, or a _complete_ list of the paths to all listener layers used by the model that should be replaced.~~Iterable[str]~~ |
## Language.memory_zone {id="memory_zone",tag="contextmanager",version="3.8"}
Begin a block where all resources allocated during the block will be freed at
the end of it. If a resources was created within the memory zone block,
accessing it outside the block is invalid. Behavior of this invalid access is
undefined. Memory zones should not be nested. The memory zone is helpful for
services that need to process large volumes of text with a defined memory budget.
> ```python
> ### Example
> counts = Counter()
> with nlp.memory_zone():
> for doc in nlp.pipe(texts):
> for token in doc:
> counts[token.text] += 1
> ```
| Name | Description |
| --- | --- |
| `mem` | Optional `cymem.Pool` object to own allocations (created if not provided). This argument is not required for ordinary usage. Defaults to `None`. ~~Optional[cymem.Pool]~~ |
| **RETURNS** | The memory pool that owns the allocations. This object is not required for ordinary usage. ~~Iterator[cymem.Pool]~~ |
## Language.meta {id="meta",tag="property"}
Meta data for the `Language` class, including name, version, data sources,
+1 -1
View File
@@ -1597,7 +1597,7 @@ The name of the model to be used has to be passed in via the `name` attribute.
| Argument | Description |
| -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `name` | The name of a model supported by LangChain for this API. ~~str~~ |
| `name` | The name of a mdodel supported by LangChain for this API. ~~str~~ |
| `config` | Configuration passed on to the LangChain model. Defaults to `{}`. ~~Dict[Any, Any]~~ |
| `query` | Function that executes the prompts. If `None`, defaults to `spacy.CallLangChain.v1`. ~~Optional[Callable[["langchain.llms.BaseLLM", Iterable[Any]], Iterable[Any]]]~~ |
+3 -4
View File
@@ -147,10 +147,9 @@ Whether a feature/value pair is in the analysis.
> assert "Feat1=Val1" in morph
> ```
| Name | Description |
| ------------ | --------------------------------------------------------------------- |
| `feature` | A feature/value pair. ~~str~~ |
| **RETURNS** | Whether the feature/value pair is contained in the analysis. ~~bool~~ |
| Name | Description |
| ----------- | --------------------------------------------- |
| **RETURNS** | A feature/value pair in the analysis. ~~str~~ |
### MorphAnalysis.\_\_iter\_\_ {id="morphanalysis-iter",tag="method"}
+1 -1
View File
@@ -288,7 +288,7 @@ it so no NP-level coordination, no prepositional phrases, and no relative
clauses.
If the `noun_chunk` [syntax iterator](/usage/linguistic-features#language-data)
has not been implemented for the given language, a `NotImplementedError` is
has not been implemeted for the given language, a `NotImplementedError` is
raised.
> #### Example
+1 -1
View File
@@ -416,7 +416,7 @@ by this class. Instances of this class are typically assigned to the
| `align` | Alignment from the `Doc`'s tokenization to the wordpieces. This is a ragged array, where `align.lengths[i]` indicates the number of wordpiece tokens that token `i` aligns against. The actual indices are provided at `align[i].dataXd`. ~~Ragged~~ |
| `width` | The width of the last hidden layer. ~~int~~ |
### TransformerData.empty {id="transformerdata-empty",tag="classmethod"}
### TransformerData.empty {id="transformerdata-emoty",tag="classmethod"}
Create an empty `TransformerData` container.
+1 -1
View File
@@ -832,7 +832,7 @@ retrieve and add to them.
After creation, the component needs to be
[initialized](/usage/training#initialization). This method can define the
relevant labels in two ways: explicitly by setting the `labels` argument in the
relevant labels in two ways: explicitely by setting the `labels` argument in the
[`initialize` block](/api/data-formats#config-initialize) of the config, or
implicately by deducing them from the `get_examples` callback that generates the
full **training data set**, or a representative sample.
+1 -1
View File
@@ -1899,7 +1899,7 @@ the two words.
"Shore": ("coast", 0.732257),
"Precautionary": ("caution", 0.490973),
"hopelessness": ("sadness", 0.742366),
"Continuous": ("continuous", 0.732549),
"Continous": ("continuous", 0.732549),
"Disemboweled": ("corpse", 0.499432),
"biostatistician": ("scientist", 0.339724),
"somewheres": ("somewheres", 0.402736),
-131
View File
@@ -1,131 +0,0 @@
---
title: Memory Management
teaser: Managing Memory for persistent services
version: 3.8
menu:
- ['Memory Zones', 'memoryzones']
- ['Clearing Doc attributes', 'doc-attrs']
---
spaCy maintains a few internal caches that improve speed,
but cause memory to increase slightly over time. If you're
running a batch process that you don't need to be long-lived,
the increase in memory usage generally isn't a problem.
However, if you're running spaCy inside a web service, you'll
often want spaCy's memory usage to stay consistent. Transformer
models can also run into memory problems sometimes, especially when
used on a GPU.
## Memory zones {id="memoryzones"}
You can tell spaCy to free data from its internal caches (especially the
[`Vocab`](/api/vocab)) using the [`Language.memory_zone`](/api/language#memory_zone) context manager. Enter
the contextmanager and process your text within it, and spaCy will
**reset its internal caches** (freeing up the associated memory) at the
end of the block. spaCy objects created inside the memory zone must
not be accessed once the memory zone is finished.
```python
### Using memory zones
from collections import Counter
def count_words(nlp, texts):
counts = Counter()
with nlp.memory_zone():
for doc in nlp.pipe(texts):
for token in doc:
counts[token.text] += 1
return counts
```
<Infobox title="Important note" variant="warning">
Exiting the memory-zone invalidates all `Doc`, `Token`, `Span` and `Lexeme`
objects that were created within it. If you access these objects
after the memory zone exits, you may encounter a segmentation fault
due to invalid memory access.
</Infobox>
spaCy needs the memory zone contextmanager because the processing pipeline
can't keep track of which [`Doc`](/api/doc) objects are referring to data in the shared
[`Vocab`](/api/vocab) cache. For instance, when spaCy encounters a new word, a new [`Lexeme`](/api/lexeme)
entry is stored in the `Vocab`, and the `Doc` object points to this shared
data. When the `Doc` goes out of scope, the `Vocab` has no way of knowing that
this `Lexeme` is no longer in use.
The memory zone solves this problem by
allowing you to tell the processing pipeline that all data created
between two points is no longer in use. It is up to the you to honor
this agreement. If you access objects that are supposed to no longer be in
use, you may encounter a segmentation fault due to invalid memory access.
A common use case for memory zones will be **within a web service**. The processing
pipeline can be loaded once, either as a context variable or a global, and each
request can be handled within a memory zone:
```python
### Memory zones with FastAPI {highlight="10,23"}
from fastapi import FastAPI, APIRouter, Depends, Request
import spacy
from spacy.language import Language
router = APIRouter()
def make_app():
app = FastAPI()
app.state.NLP = spacy.load("en_core_web_sm")
app.include_router(router)
return app
def get_nlp(request: Request) -> Language:
return request.app.state.NLP
@router.post("/parse")
def parse_texts(
*, text_batch: list[str], nlp: Language = Depends(get_nlp)
) -> list[dict]:
with nlp.memory_zone():
# Put the spaCy call within a separate function, so we can't
# leak the Doc objects outside the scope of the memory zone.
output = _process_text(nlp, text_batch)
return output
def _process_text(nlp: Language, texts: list[str]) -> list[dict]:
# Call spaCy, and transform the output into our own data
# structures. This function is called from inside a memory
# zone, so must not return the spaCy objects.
docs = list(nlp.pipe(texts))
return [
{
"tokens": [{"text": t.text} for t in doc],
"entities": [
{"start": e.start, "end": e.end, "label": e.label_} for e in doc.ents
],
}
for doc in docs
]
app = make_app()
```
## Clearing transformer tensors and other Doc attributes {id="doc-attrs"}
The [`Transformer`](/api/transformer) and [`Tok2Vec`](/api/tok2vec) components set intermediate values onto the `Doc`
object during parsing. This can cause GPU memory to be exhausted if many `Doc`
objects are kept in memory together.
To resolve this, you can add the [`doc_cleaner`](/api/pipeline-functions#doc_cleaner) component to your pipeline. By default
this will clean up the [`Doc._.trf_data`](/api/transformer#custom_attributes) extension attribute and the [`Doc.tensor`](/api/doc#attributes) attribute.
You can have it clean up other intermediate extension attributes you use in custom
pipeline components as well.
```python
### Adding the doc_cleaner
nlp.add_pipe("doc_cleaner", config={"attrs": {"tensor": None}})
```
+2 -6
View File
@@ -526,17 +526,13 @@ application's `requirements.txt`. If you're running your own internal PyPi
installation, you can upload the pipeline packages there. pip's
[requirements file format](https://pip.pypa.io/en/latest/reference/requirements-file-format/)
supports both package names to download via a PyPi server, as well as
[direct URLs](#pipeline-urls). For instance, you can specify the
`en_core_web_sm` model for spaCy 3.7.x as follows:
[direct URLs](#pipeline-urls).
```text {title="requirements.txt"}
spacy>=3.0.0,<4.0.0
en_core_web_sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.7.1/en_core_web_sm-3.7.1-py3-none-any.whl
en_core_web_sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.4.0/en_core_web_sm-3.4.0-py3-none-any.whl
```
See the [list of models](https://spacy.io/models) for model download links for
the current spaCy version.
All pipeline packages are versioned and specify their spaCy dependency. This
ensures cross-compatibility and lets you specify exact version requirements for
each pipeline. If you've [trained](/usage/training) your own pipeline, you can
+2 -1
View File
@@ -1719,7 +1719,8 @@ function that takes a `Doc`, modifies it and returns it.
code on GitHub, don't forget to tag it with
[`spacy`](https://github.com/topics/spacy?o=desc&s=stars) and
[`spacy-extension`](https://github.com/topics/spacy-extension?o=desc&s=stars)
to help people find it.
to help people find it. If you post it on Twitter, feel free to tag
[@spacy_io](https://twitter.com/spacy_io) so we can check it out.
### Wrapping other models and libraries {id="wrapping-models-libraries"}
+2 -2
View File
@@ -173,7 +173,7 @@ detected, a corresponding warning is displayed. If you'd like to disable the
dependency check, set `check_requirements: false` in your project's
`project.yml`.
### 4. Run a workflow {id="run-workflow"}
### 4. Run a workflow {id="run-workfow"}
> #### project.yml
>
@@ -286,7 +286,7 @@ pipelines.
| --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `title` | An optional project title used in `--help` message and [auto-generated docs](#custom-docs). |
| `description` | An optional project description used in [auto-generated docs](#custom-docs). |
| `vars` | A dictionary of variables that can be referenced in paths, URLs and scripts and overridden on the CLI, just like [`config.cfg` variables](/usage/training#config-interpolation). For example, `${vars.name}` will use the value of the variable `name`. Variables need to be defined in the section `vars`, but can be a nested dict, so you're able to reference `${vars.model.name}`. |
| `vars` | A dictionary of variables that can be referenced in paths, URLs and scripts and overriden on the CLI, just like [`config.cfg` variables](/usage/training#config-interpolation). For example, `${vars.name}` will use the value of the variable `name`. Variables need to be defined in the section `vars`, but can be a nested dict, so you're able to reference `${vars.model.name}`. |
| `env` | A dictionary of variables, mapped to the names of environment variables that will be read in when running the project. For example, `${env.name}` will use the value of the environment variable defined as `name`. |
| `directories` | An optional list of [directories](#project-files) that should be created in the project for assets, training outputs, metrics etc. spaCy will make sure that these directories always exist. |
| `assets` | A list of assets that can be fetched with the [`project assets`](/api/cli#project-assets) command. `url` defines a URL or local path, `dest` is the destination file relative to the project directory, and an optional `checksum` ensures that an error is raised if the file's checksum doesn't match. Instead of `url`, you can also provide a `git` block with the keys `repo`, `branch` and `path`, to download from a Git repo. |
+1 -1
View File
@@ -720,7 +720,7 @@ matches = matcher(doc)
# Serve visualization of sentences containing match with displaCy
# set manual=True to make displaCy render straight from a dictionary
# (if you're not running the code within a Jupyter environment, you can
# (if you're not running the code within a Jupyer environment, you can
# use displacy.serve instead)
displacy.render(matched_sents, style="ent", manual=True)
```
+4 -7
View File
@@ -306,9 +306,7 @@ installed in the same environment that's it.
### Loading probability tables into existing models
You can load a probability table from
[spacy-lookups-data](https://github.com/explosion/spacy-lookups-data) into an
existing spaCy model like `en_core_web_sm`.
You can load a probability table from [spacy-lookups-data](https://github.com/explosion/spacy-lookups-data) into an existing spaCy model like `en_core_web_sm`.
```python
# Requirements: pip install spacy-lookups-data
@@ -319,8 +317,7 @@ lookups = load_lookups("en", ["lexeme_prob"])
nlp.vocab.lookups.add_table("lexeme_prob", lookups.get_table("lexeme_prob"))
```
When training a model from scratch you can also specify probability tables in
the `config.cfg`.
When training a model from scratch you can also specify probability tables in the `config.cfg`.
```ini {title="config.cfg (excerpt)"}
[initialize.lookups]
@@ -349,8 +346,8 @@ them**!
To stick with the theme of
[this entry points blog post](https://amir.rachum.com/blog/2017/07/28/python-entry-points/),
consider the following custom spaCy
[pipeline component](/usage/processing-pipelines#custom-components) that prints
a snake when it's called:
[pipeline component](/usage/processing-pipelines#custom-coponents) that prints a
snake when it's called:
> #### Package directory structure
>
+3 -1
View File
@@ -554,7 +554,9 @@ By participating, you are expected to uphold this code.
### I've built something cool with spaCy how can I get the word out? {id="faq-project-with-spacy"}
First, congrats we'd love to check it out! If you think your project would be a good fit for the
First, congrats we'd love to check it out! When you share your project on
Twitter, don't forget to tag [@spacy_io](https://twitter.com/spacy_io) so we
don't miss it. If you think your project would be a good fit for the
[spaCy Universe](/universe), **feel free to submit it!** Tutorials are also
incredibly valuable to other users and a great way to get exposure. So we
strongly encourage **writing up your experiences**, or sharing your code and
+1 -1
View File
@@ -185,7 +185,7 @@ New: 'ORG' (23860), 'PERSON' (21395), 'GPE' (21193), 'DATE' (18080), 'CARDINAL'
'LOC' (2113), 'TIME' (1616), 'WORK_OF_ART' (1229), 'QUANTITY' (1150), 'FAC'
(1134), 'EVENT' (974), 'PRODUCT' (935), 'LAW' (444), 'LANGUAGE' (338)
✔ Good amount of examples for all labels
✔ Examples without occurrences available for all labels
✔ Examples without occurences available for all labels
✔ No entities consisting of or starting/ending with whitespace
=========================== Part-of-speech Tagging ===========================
+1 -1
View File
@@ -138,7 +138,7 @@ backwards compatibility, the tuple format remains available under
`TransformerData.tensors` and `FullTransformerBatch.tensors`. See more details
in the [transformer API docs](/api/architectures#TransformerModel).
`spacy-transformers` v1.1 also adds support for `transformer_config` settings
`spacy-transfomers` v1.1 also adds support for `transformer_config` settings
such as `output_attentions`. Additional output is stored under
`TransformerData.model_output`. More details are in the
[TransformerModel docs](/api/architectures#TransformerModel). The training speed
+75 -301
View File
@@ -5,96 +5,45 @@
{
"label": "Get started",
"items": [
{
"text": "Installation",
"url": "/usage"
},
{
"text": "Models & Languages",
"url": "/usage/models"
},
{
"text": "Facts & Figures",
"url": "/usage/facts-figures"
},
{
"text": "spaCy 101",
"url": "/usage/spacy-101"
},
{
"text": "New in v3.7",
"url": "/usage/v3-7"
},
{
"text": "New in v3.6",
"url": "/usage/v3-6"
},
{
"text": "New in v3.5",
"url": "/usage/v3-5"
}
{ "text": "Installation", "url": "/usage" },
{ "text": "Models & Languages", "url": "/usage/models" },
{ "text": "Facts & Figures", "url": "/usage/facts-figures" },
{ "text": "spaCy 101", "url": "/usage/spacy-101" },
{ "text": "New in v3.7", "url": "/usage/v3-7" },
{ "text": "New in v3.6", "url": "/usage/v3-6" },
{ "text": "New in v3.5", "url": "/usage/v3-5" }
]
},
{
"label": "Guides",
"items": [
{
"text": "Linguistic Features",
"url": "/usage/linguistic-features"
},
{
"text": "Rule-based Matching",
"url": "/usage/rule-based-matching"
},
{
"text": "Processing Pipelines",
"url": "/usage/processing-pipelines"
},
{ "text": "Linguistic Features", "url": "/usage/linguistic-features" },
{ "text": "Rule-based Matching", "url": "/usage/rule-based-matching" },
{ "text": "Processing Pipelines", "url": "/usage/processing-pipelines" },
{
"text": "Embeddings & Transformers",
"url": "/usage/embeddings-transformers"
},
{
"text": "Large Language Models",
"url": "/usage/large-language-models"
},
{
"text": "Training Models",
"url": "/usage/training"
"url": "/usage/large-language-models",
"tag": "new"
},
{ "text": "Training Models", "url": "/usage/training" },
{
"text": "Layers & Model Architectures",
"url": "/usage/layers-architectures"
},
{
"text": "spaCy Projects",
"url": "/usage/projects"
},
{
"text": "Saving & Loading",
"url": "/usage/saving-loading"
},
{
"text": "Memory Management",
"url": "/usage/memory-management"
},
{
"text": "Visualizers",
"url": "/usage/visualizers"
}
{ "text": "spaCy Projects", "url": "/usage/projects" },
{ "text": "Saving & Loading", "url": "/usage/saving-loading" },
{ "text": "Visualizers", "url": "/usage/visualizers" }
]
},
{
"label": "Resources",
"items": [
{
"text": "Project Templates",
"url": "https://github.com/explosion/projects"
},
{
"text": "v2.x Documentation",
"url": "https://v2.spacy.io"
},
{ "text": "Project Templates", "url": "https://github.com/explosion/projects" },
{ "text": "v2.x Documentation", "url": "https://v2.spacy.io" },
{
"text": "Custom Solutions",
"url": "https://explosion.ai/custom-solutions"
@@ -108,12 +57,7 @@
"items": [
{
"label": "Models",
"items": [
{
"text": "Overview",
"url": "/models"
}
]
"items": [{ "text": "Overview", "url": "/models" }]
},
{
"label": "Trained Pipelines",
@@ -127,261 +71,91 @@
{
"label": "Overview",
"items": [
{
"text": "Library Architecture",
"url": "/api"
},
{
"text": "Model Architectures",
"url": "/api/architectures"
},
{
"text": "Data Formats",
"url": "/api/data-formats"
},
{
"text": "Command Line",
"url": "/api/cli"
},
{
"text": "Functions",
"url": "/api/top-level"
}
{ "text": "Library Architecture", "url": "/api" },
{ "text": "Model Architectures", "url": "/api/architectures" },
{ "text": "Data Formats", "url": "/api/data-formats" },
{ "text": "Command Line", "url": "/api/cli" },
{ "text": "Functions", "url": "/api/top-level" }
]
},
{
"label": "Containers",
"items": [
{
"text": "Doc",
"url": "/api/doc"
},
{
"text": "DocBin",
"url": "/api/docbin"
},
{
"text": "Example",
"url": "/api/example"
},
{
"text": "Language",
"url": "/api/language"
},
{
"text": "Lexeme",
"url": "/api/lexeme"
},
{
"text": "Span",
"url": "/api/span"
},
{
"text": "SpanGroup",
"url": "/api/spangroup"
},
{
"text": "Token",
"url": "/api/token"
}
{ "text": "Doc", "url": "/api/doc" },
{ "text": "DocBin", "url": "/api/docbin" },
{ "text": "Example", "url": "/api/example" },
{ "text": "Language", "url": "/api/language" },
{ "text": "Lexeme", "url": "/api/lexeme" },
{ "text": "Span", "url": "/api/span" },
{ "text": "SpanGroup", "url": "/api/spangroup" },
{ "text": "Token", "url": "/api/token" }
]
},
{
"label": "Pipeline",
"items": [
{
"text": "AttributeRuler",
"url": "/api/attributeruler"
},
{
"text": "CoreferenceResolver",
"url": "/api/coref"
},
{
"text": "CuratedTransformer",
"url": "/api/curatedtransformer"
},
{
"text": "DependencyParser",
"url": "/api/dependencyparser"
},
{
"text": "EditTreeLemmatizer",
"url": "/api/edittreelemmatizer"
},
{
"text": "EntityLinker",
"url": "/api/entitylinker"
},
{
"text": "EntityRecognizer",
"url": "/api/entityrecognizer"
},
{
"text": "EntityRuler",
"url": "/api/entityruler"
},
{
"text": "Large Language Models",
"url": "/api/large-language-models"
},
{
"text": "Lemmatizer",
"url": "/api/lemmatizer"
},
{
"text": "Morphologizer",
"url": "/api/morphologizer"
},
{
"text": "SentenceRecognizer",
"url": "/api/sentencerecognizer"
},
{
"text": "Sentencizer",
"url": "/api/sentencizer"
},
{
"text": "SpanCategorizer",
"url": "/api/spancategorizer"
},
{
"text": "SpanFinder",
"url": "/api/spanfinder"
},
{
"text": "SpanResolver",
"url": "/api/span-resolver"
},
{
"text": "SpanRuler",
"url": "/api/spanruler"
},
{
"text": "Tagger",
"url": "/api/tagger"
},
{
"text": "TextCategorizer",
"url": "/api/textcategorizer"
},
{
"text": "Tok2Vec",
"url": "/api/tok2vec"
},
{
"text": "Tokenizer",
"url": "/api/tokenizer"
},
{
"text": "TrainablePipe",
"url": "/api/pipe"
},
{
"text": "Transformer",
"url": "/api/transformer"
},
{
"text": "Other Functions",
"url": "/api/pipeline-functions"
}
{ "text": "AttributeRuler", "url": "/api/attributeruler" },
{ "text": "CoreferenceResolver", "url": "/api/coref" },
{ "text": "CuratedTransformer", "url": "/api/curatedtransformer" },
{ "text": "DependencyParser", "url": "/api/dependencyparser" },
{ "text": "EditTreeLemmatizer", "url": "/api/edittreelemmatizer" },
{ "text": "EntityLinker", "url": "/api/entitylinker" },
{ "text": "EntityRecognizer", "url": "/api/entityrecognizer" },
{ "text": "EntityRuler", "url": "/api/entityruler" },
{ "text": "Large Language Models", "url": "/api/large-language-models" },
{ "text": "Lemmatizer", "url": "/api/lemmatizer" },
{ "text": "Morphologizer", "url": "/api/morphologizer" },
{ "text": "SentenceRecognizer", "url": "/api/sentencerecognizer" },
{ "text": "Sentencizer", "url": "/api/sentencizer" },
{ "text": "SpanCategorizer", "url": "/api/spancategorizer" },
{ "text": "SpanFinder", "url": "/api/spanfinder" },
{ "text": "SpanResolver", "url": "/api/span-resolver" },
{ "text": "SpanRuler", "url": "/api/spanruler" },
{ "text": "Tagger", "url": "/api/tagger" },
{ "text": "TextCategorizer", "url": "/api/textcategorizer" },
{ "text": "Tok2Vec", "url": "/api/tok2vec" },
{ "text": "Tokenizer", "url": "/api/tokenizer" },
{ "text": "TrainablePipe", "url": "/api/pipe" },
{ "text": "Transformer", "url": "/api/transformer" },
{ "text": "Other Functions", "url": "/api/pipeline-functions" }
]
},
{
"label": "Matchers",
"items": [
{
"text": "DependencyMatcher",
"url": "/api/dependencymatcher"
},
{
"text": "Matcher",
"url": "/api/matcher"
},
{
"text": "PhraseMatcher",
"url": "/api/phrasematcher"
}
{ "text": "DependencyMatcher", "url": "/api/dependencymatcher" },
{ "text": "Matcher", "url": "/api/matcher" },
{ "text": "PhraseMatcher", "url": "/api/phrasematcher" }
]
},
{
"label": "Other",
"items": [
{
"text": "Attributes",
"url": "/api/attributes"
},
{
"text": "BaseVectors",
"url": "/api/basevectors"
},
{
"text": "Corpus",
"url": "/api/corpus"
},
{
"text": "InMemoryLookupKB",
"url": "/api/inmemorylookupkb"
},
{
"text": "KnowledgeBase",
"url": "/api/kb"
},
{
"text": "Lookups",
"url": "/api/lookups"
},
{
"text": "MorphAnalysis",
"url": "/api/morphology#morphanalysis"
},
{
"text": "Morphology",
"url": "/api/morphology"
},
{
"text": "Scorer",
"url": "/api/scorer"
},
{
"text": "StringStore",
"url": "/api/stringstore"
},
{
"text": "Vectors",
"url": "/api/vectors"
},
{
"text": "Vocab",
"url": "/api/vocab"
}
{ "text": "Attributes", "url": "/api/attributes" },
{ "text": "BaseVectors", "url": "/api/basevectors" },
{ "text": "Corpus", "url": "/api/corpus" },
{ "text": "InMemoryLookupKB", "url": "/api/inmemorylookupkb" },
{ "text": "KnowledgeBase", "url": "/api/kb" },
{ "text": "Lookups", "url": "/api/lookups" },
{ "text": "MorphAnalysis", "url": "/api/morphology#morphanalysis" },
{ "text": "Morphology", "url": "/api/morphology" },
{ "text": "Scorer", "url": "/api/scorer" },
{ "text": "StringStore", "url": "/api/stringstore" },
{ "text": "Vectors", "url": "/api/vectors" },
{ "text": "Vocab", "url": "/api/vocab" }
]
},
{
"label": "Cython",
"items": [
{
"text": "Architecture",
"url": "/api/cython"
},
{
"text": "Classes",
"url": "/api/cython-classes"
},
{
"text": "Structs",
"url": "/api/cython-structs"
}
{ "text": "Architecture", "url": "/api/cython" },
{ "text": "Classes", "url": "/api/cython-classes" },
{ "text": "Structs", "url": "/api/cython-structs" }
]
},
{
"label": "Legacy",
"items": [
{
"text": "Legacy functions",
"url": "/api/legacy"
}
]
"items": [{ "text": "Legacy functions", "url": "/api/legacy" }]
}
]
}
+2 -2
View File
@@ -23,6 +23,7 @@
},
"docSearch": {
"appId": "Y1LB128RON",
"apiKey": "bb601a1daab73e2dc66faf2b79564807",
"indexName": "spacy"
},
"binderUrl": "explosion/spacy-io-binder",
@@ -75,9 +76,8 @@
{
"label": "Connect",
"items": [
{ "text": "Bluesky", "url": "https://bsky.app/profile/explosion-ai.bsky.social" },
{ "text": "Twitter", "url": "https://twitter.com/spacy_io" },
{ "text": "GitHub", "url": "https://github.com/explosion/spaCy" },
{ "text": "Live Stream", "url": "https://www.youtube.com/playlist?list=PLBmcuObd5An5_iAxNYLJa_xWmNzsYce8c" },
{ "text": "YouTube", "url": "https://youtube.com/c/ExplosionAI" },
{ "text": "Blog", "url": "https://explosion.ai/blog" }
]
+293 -1444
View File
File diff suppressed because it is too large Load Diff
-3
View File
@@ -32,9 +32,6 @@ const nextConfig = withPWA(
ignoreBuildErrors: true,
},
images: { unoptimized: true },
env: {
DOCSEARCH_API_KEY: process.env.DOCSEARCH_API_KEY
}
})
)
+2 -3
View File
@@ -1,4 +1,4 @@
import React from 'react'
import React, { useEffect, useState } from 'react'
import PropTypes from 'prop-types'
import { DocSearch } from '@docsearch/react'
import '@docsearch/css'
@@ -6,8 +6,7 @@ import '@docsearch/css'
import siteMetadata from '../../meta/site.json'
export default function Search({ placeholder = 'Search docs' }) {
const apiKey = process.env.DOCSEARCH_API_KEY
const { indexName, appId } = siteMetadata.docSearch
const { apiKey, indexName, appId } = siteMetadata.docSearch
return (
<DocSearch appId={appId} indexName={indexName} apiKey={apiKey} placeholder={placeholder} />
)
-2
View File
@@ -109,8 +109,6 @@
box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.25)
background: var(--color-dark)
margin: 1.5rem 0 0 2rem
position: sticky
left: 2rem
.header
width: 100%
-3
View File
@@ -87,9 +87,6 @@
margin-bottom: 0
height: 100%
a, a:hover
color: inherit
.banner-content-small
display: block
margin-bottom: 0 !important
+2 -2
View File
@@ -58,8 +58,8 @@ const AlertSpace = ({ nightly, legacy }) => {
}
const navAlert = (
<Link to="https://beta.ellf.ai" noLinkLayout>
💥 Beta test our new tool for <strong>agentic NLP development</strong>!
<Link to="https://form.typeform.com/to/WlflqP1b" noLinkLayout>
💥 Interested in <strong>Premium spaCy Models</strong>?
</Link>
)