Apply Prettier (#11996)

This commit is contained in:
Marcus Blättermann 2022-12-19 16:18:19 +01:00 committed by GitHub
parent e93952f284
commit de2e3747cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
73 changed files with 1212 additions and 680 deletions

View File

@ -2,9 +2,10 @@
# spaCy Universe # spaCy Universe
The [spaCy Universe](https://spacy.io/universe) collects the many great resources developed with or for spaCy. It The [spaCy Universe](https://spacy.io/universe) collects the many great
includes standalone packages, plugins, extensions, educational materials, resources developed with or for spaCy. It includes standalone packages, plugins,
operational utilities and bindings for other languages. extensions, educational materials, operational utilities and bindings for other
languages.
If you have a project that you want the spaCy community to make use of, you can If you have a project that you want the spaCy community to make use of, you can
suggest it by submitting a pull request to this repository. The Universe suggest it by submitting a pull request to this repository. The Universe
@ -18,26 +19,35 @@ discussion forum.
### Projects ### Projects
✅ Libraries and packages should be **open-source** (with a user-friendly license) and at least somewhat **documented** (e.g. a simple `README` with usage instructions). ✅ Libraries and packages should be **open-source** (with a user-friendly
license) and at least somewhat **documented** (e.g. a simple `README` with usage
instructions).
✅ We're happy to include work in progress and prereleases, but we'd like to keep the emphasis on projects that should be useful to the community **right away**. ✅ We're happy to include work in progress and prereleases, but we'd like to
keep the emphasis on projects that should be useful to the community **right
away**.
✅ Demos and visualizers should be available via a **public URL**. ✅ Demos and visualizers should be available via a **public URL**.
### Educational Materials ### Educational Materials
✅ Books should be **available for purchase or download** (not just pre-order). Ebooks and self-published books are fine, too, if they include enough substantial content. ✅ Books should be **available for purchase or download** (not just pre-order).
Ebooks and self-published books are fine, too, if they include enough
substantial content.
✅ The `"url"` of book entries should either point to the publisher's website or a reseller of your choice (ideally one that ships worldwide or as close as possible). ✅ The `"url"` of book entries should either point to the publisher's website or
a reseller of your choice (ideally one that ships worldwide or as close as
possible).
✅ If an online course is only available behind a paywall, it should at least have a **free excerpt** or chapter available, so users know what to expect. ✅ If an online course is only available behind a paywall, it should at least
have a **free excerpt** or chapter available, so users know what to expect.
## JSON format ## JSON format
To add a project, fork this repository, edit the [`universe.json`](meta/universe.json) To add a project, fork this repository, edit the
and add an object of the following format to the list of `"resources"`. Before [`universe.json`](meta/universe.json) and add an object of the following format
you submit your pull request, make sure to use a linter to verify that your to the list of `"resources"`. Before you submit your pull request, make sure to
markup is correct. use a linter to verify that your markup is correct.
```json ```json
{ {
@ -70,7 +80,7 @@ markup is correct.
``` ```
| Field | Type | Description | | Field | Type | Description |
| --- | --- | --- | | --------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------- |
| `id` | string | Unique ID of the project. | | `id` | string | Unique ID of the project. |
| `title` | string | Project title. If not set, the `id` will be used as the display title. | | `title` | string | Project title. If not set, the `id` will be used as the display title. |
| `slogan` | string | A short description of the project. Displayed in the overview and under the title. | | `slogan` | string | A short description of the project. Displayed in the overview and under the title. |
@ -89,6 +99,6 @@ markup is correct.
| `tags` | list | Still experimental and not used for filtering: one or more tags to assign to project. | | `tags` | list | Still experimental and not used for filtering: one or more tags to assign to project. |
To separate them from the projects, educational materials also specify To separate them from the projects, educational materials also specify
`"type": "education`. Books can also set a `"cover"` field containing a URL `"type": "education`. Books can also set a `"cover"` field containing a URL to a
to a cover image. If available, it's used in the overview and displayed on cover image. If available, it's used in the overview and displayed on the
the individual book page. individual book page.

View File

@ -390,7 +390,7 @@ in other components, see
| | | | | |
<Infobox title="Mixed precision support" variant="warning"> <Infobox title="Mixed precision support" variant="warning">
Mixed-precision support is currently an experimental feature. Mixed-precision support is currently an experimental feature.
</Infobox> </Infobox>
<Accordion title="Previous versions of spacy-transformers.TransformerModel" spaced> <Accordion title="Previous versions of spacy-transformers.TransformerModel" spaced>
@ -467,7 +467,7 @@ one component.
| **CREATES** | The model using the architecture. ~~Model[List[Doc], List[Floats2d]]~~ | | **CREATES** | The model using the architecture. ~~Model[List[Doc], List[Floats2d]]~~ |
<Infobox title="Mixed precision support" variant="warning"> <Infobox title="Mixed precision support" variant="warning">
Mixed-precision support is currently an experimental feature. Mixed-precision support is currently an experimental feature.
</Infobox> </Infobox>
<Accordion title="Previous versions of spacy-transformers.Tok2VecTransformer" spaced> <Accordion title="Previous versions of spacy-transformers.Tok2VecTransformer" spaced>

View File

@ -41,10 +41,9 @@ from string attribute names to internal attribute IDs is stored in
The corresponding [`Token` object attributes](/api/token#attributes) can be The corresponding [`Token` object attributes](/api/token#attributes) can be
accessed using the same names in lowercase, e.g. `token.orth` or `token.length`. accessed using the same names in lowercase, e.g. `token.orth` or `token.length`.
For attributes that represent string values, the internal integer ID is For attributes that represent string values, the internal integer ID is accessed
accessed as `Token.attr`, e.g. `token.dep`, while the string value can be as `Token.attr`, e.g. `token.dep`, while the string value can be retrieved by
retrieved by appending `_` as in `token.dep_`. appending `_` as in `token.dep_`.
| Attribute | Description | | Attribute | Description |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |

View File

@ -474,7 +474,7 @@ report span characteristics such as the average span length and the span (or
span boundary) distinctiveness. The distinctiveness measure shows how different span boundary) distinctiveness. The distinctiveness measure shows how different
the tokens are with respect to the rest of the corpus using the KL-divergence of the tokens are with respect to the rest of the corpus using the KL-divergence of
the token distributions. To learn more, you can check out Papay et al.'s work on the token distributions. To learn more, you can check out Papay et al.'s work on
[*Dissecting Span Identification Tasks with Performance Prediction* (EMNLP 2020)](https://aclanthology.org/2020.emnlp-main.396/). [_Dissecting Span Identification Tasks with Performance Prediction_ (EMNLP 2020)](https://aclanthology.org/2020.emnlp-main.396/).
</Infobox> </Infobox>
@ -1187,7 +1187,6 @@ be provided.
> $ python -m spacy find-threshold my_nlp data.spacy spancat threshold spans_sc_f > $ python -m spacy find-threshold my_nlp data.spacy spancat threshold spans_sc_f
> ``` > ```
| Name | Description | | Name | Description |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `model` | Pipeline to evaluate. Can be a package or a path to a data directory. ~~str (positional)~~ | | `model` | Pipeline to evaluate. Can be a package or a path to a data directory. ~~str (positional)~~ |

View File

@ -87,7 +87,6 @@ come directly from
| `A <++ B` | `B` is a right parent of `A`, i.e. `A` is a child of `B` and `A.i < B.i` _(not in Semgrex)_. | | `A <++ B` | `B` is a right parent of `A`, i.e. `A` is a child of `B` and `A.i < B.i` _(not in Semgrex)_. |
| `A <-- B` | `B` is a left parent of `A`, i.e. `A` is a child of `B` and `A.i > B.i` _(not in Semgrex)_. | | `A <-- B` | `B` is a left parent of `A`, i.e. `A` is a child of `B` and `A.i > B.i` _(not in Semgrex)_. |
## DependencyMatcher.\_\_init\_\_ {#init tag="method"} ## DependencyMatcher.\_\_init\_\_ {#init tag="method"}
Create a `DependencyMatcher`. Create a `DependencyMatcher`.

View File

@ -99,9 +99,9 @@ be a token pattern (list) or a phrase pattern (string). For example:
## EntityRuler.initialize {#initialize tag="method" new="3"} ## EntityRuler.initialize {#initialize tag="method" new="3"}
Initialize the component with data and used before training to load in rules Initialize the component with data and used before training to load in rules
from a [pattern file](/usage/rule-based-matching/#entityruler-files). This method from a [pattern file](/usage/rule-based-matching/#entityruler-files). This
is typically called by [`Language.initialize`](/api/language#initialize) and method is typically called by [`Language.initialize`](/api/language#initialize)
lets you customize arguments it receives via the and lets you customize arguments it receives via the
[`[initialize.components]`](/api/data-formats#config-initialize) block in the [`[initialize.components]`](/api/data-formats#config-initialize) block in the
config. config.
@ -210,10 +210,10 @@ of dicts) or a phrase pattern (string). For more details, see the usage guide on
| ---------- | ---------------------------------------------------------------- | | ---------- | ---------------------------------------------------------------- |
| `patterns` | The patterns to add. ~~List[Dict[str, Union[str, List[dict]]]]~~ | | `patterns` | The patterns to add. ~~List[Dict[str, Union[str, List[dict]]]]~~ |
## EntityRuler.remove {#remove tag="method" new="3.2.1"} ## EntityRuler.remove {#remove tag="method" new="3.2.1"}
Remove a pattern by its ID from the entity ruler. A `ValueError` is raised if the ID does not exist. Remove a pattern by its ID from the entity ruler. A `ValueError` is raised if
the ID does not exist.
> #### Example > #### Example
> >
@ -225,7 +225,7 @@ Remove a pattern by its ID from the entity ruler. A `ValueError` is raised if th
> ``` > ```
| Name | Description | | Name | Description |
| ---------- | ---------------------------------------------------------------- | | ---- | ----------------------------------- |
| `id` | The ID of the pattern rule. ~~str~~ | | `id` | The ID of the pattern rule. ~~str~~ |
## EntityRuler.to_disk {#to_disk tag="method"} ## EntityRuler.to_disk {#to_disk tag="method"}

View File

@ -288,9 +288,9 @@ Calculate alignment tables between two tokenizations.
### Alignment attributes {#alignment-attributes"} ### Alignment attributes {#alignment-attributes"}
Alignment attributes are managed using `AlignmentArray`, which is a Alignment attributes are managed using `AlignmentArray`, which is a simplified
simplified version of Thinc's [Ragged](https://thinc.ai/docs/api-types#ragged) version of Thinc's [Ragged](https://thinc.ai/docs/api-types#ragged) type that
type that only supports the `data` and `length` attributes. only supports the `data` and `length` attributes.
| Name | Description | | Name | Description |
| ----- | ------------------------------------------------------------------------------------- | | ----- | ------------------------------------------------------------------------------------- |

View File

@ -3,6 +3,6 @@ title: Library Architecture
next: /api/architectures next: /api/architectures
--- ---
import Architecture101 from 'usage/101/\_architecture.mdx' import Architecture101 from 'usage/101/_architecture.mdx'
<Architecture101 /> <Architecture101 />

View File

@ -106,7 +106,7 @@ to you.
## KnowledgeBase.get_alias_candidates {#get_alias_candidates tag="method"} ## KnowledgeBase.get_alias_candidates {#get_alias_candidates tag="method"}
<Infobox variant="warning"> <Infobox variant="warning">
This method is _not_ available from spaCy 3.5 onwards. This method is _not_ available from spaCy 3.5 onwards.
</Infobox> </Infobox>
From spaCy 3.5 on `KnowledgeBase` is an abstract class (with From spaCy 3.5 on `KnowledgeBase` is an abstract class (with

View File

@ -106,8 +106,8 @@ representation.
## Attributes {#attributes} ## Attributes {#attributes}
| Name | Description | | Name | Description |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------ | | ------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------- |
| `FEATURE_SEP` | The [FEATS](https://universaldependencies.org/format.html#morphological-annotation) feature separator. Default is `|`. ~~str~~ | | `FEATURE_SEP` | The [FEATS](https://universaldependencies.org/format.html#morphological-annotation) feature separator. Default is ` | `. ~~str~~ |
| `FIELD_SEP` | The [FEATS](https://universaldependencies.org/format.html#morphological-annotation) field separator. Default is `=`. ~~str~~ | | `FIELD_SEP` | The [FEATS](https://universaldependencies.org/format.html#morphological-annotation) field separator. Default is `=`. ~~str~~ |
| `VALUE_SEP` | The [FEATS](https://universaldependencies.org/format.html#morphological-annotation) value separator. Default is `,`. ~~str~~ | | `VALUE_SEP` | The [FEATS](https://universaldependencies.org/format.html#morphological-annotation) value separator. Default is `,`. ~~str~~ |

View File

@ -38,7 +38,7 @@ how the component should be configured. You can override its settings via the
> ``` > ```
| Setting | Description | | Setting | Description |
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------ |
| `punct_chars` | Optional custom list of punctuation characters that mark sentence ends. See below for defaults if not set. Defaults to `None`. ~~Optional[List[str]]~~ | `None` | | `punct_chars` | Optional custom list of punctuation characters that mark sentence ends. See below for defaults if not set. Defaults to `None`. ~~Optional[List[str]]~~ | `None` |
| `overwrite` <Tag variant="new">3.2</Tag> | Whether existing annotation is overwritten. Defaults to `False`. ~~bool~~ | | `overwrite` <Tag variant="new">3.2</Tag> | Whether existing annotation is overwritten. Defaults to `False`. ~~bool~~ |
| `scorer` <Tag variant="new">3.2</Tag> | The scoring method. Defaults to [`Scorer.score_spans`](/api/scorer#score_spans) for the attribute `"sents"` ~~Optional[Callable]~~ | | `scorer` <Tag variant="new">3.2</Tag> | The scoring method. Defaults to [`Scorer.score_spans`](/api/scorer#score_spans) for the attribute `"sents"` ~~Optional[Callable]~~ |

View File

@ -1,58 +1,155 @@
<svg xmlns="http://www.w3.org/2000/svg" xlink="http://www.w3.org/1999/xlink" xml:lang="en" id="c3124cc3e661444cb9d4175a5b7c09d1-0" class="displacy" width="925" height="399.5" direction="ltr" style="max-width: none; height: 399.5px; color: #000000; background: #ffffff; font-family: Arial; direction: ltr"> <svg
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5"> xmlns="http://www.w3.org/2000/svg"
xlink="http://www.w3.org/1999/xlink"
xml:lang="en"
id="c3124cc3e661444cb9d4175a5b7c09d1-0"
class="displacy"
width="925"
height="399.5"
direction="ltr"
style="
max-width: none;
height: 399.5px;
color: #000000;
background: #ffffff;
font-family: Arial;
direction: ltr;
"
>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5">
<tspan class="displacy-word" fill="currentColor" x="50">Smith</tspan> <tspan class="displacy-word" fill="currentColor" x="50">Smith</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="50"></tspan> <tspan class="displacy-tag" dy="2em" fill="currentColor" x="50"></tspan>
</text> </text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5"> <text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5">
<tspan class="displacy-word" fill="currentColor" x="225">founded</tspan> <tspan class="displacy-word" fill="currentColor" x="225">founded</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="225"></tspan> <tspan class="displacy-tag" dy="2em" fill="currentColor" x="225"></tspan>
</text> </text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5"> <text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5">
<tspan class="displacy-word" fill="currentColor" x="400">a</tspan> <tspan class="displacy-word" fill="currentColor" x="400">a</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="400"></tspan> <tspan class="displacy-tag" dy="2em" fill="currentColor" x="400"></tspan>
</text> </text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5"> <text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5">
<tspan class="displacy-word" fill="currentColor" x="575">healthcare</tspan> <tspan class="displacy-word" fill="currentColor" x="575">healthcare</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="575"></tspan> <tspan class="displacy-tag" dy="2em" fill="currentColor" x="575"></tspan>
</text> </text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5"> <text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5">
<tspan class="displacy-word" fill="currentColor" x="750">company</tspan> <tspan class="displacy-word" fill="currentColor" x="750">company</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="750"></tspan> <tspan class="displacy-tag" dy="2em" fill="currentColor" x="750"></tspan>
</text>
<g class="displacy-arrow">
<path class="displacy-arc" id="arrow-c3124cc3e661444cb9d4175a5b7c09d1-0-0" stroke-width="2px" d="M70,264.5 C70,177.0 215.0,177.0 215.0,264.5" fill="none" stroke="currentColor"></path>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textPath xlink:href="#arrow-c3124cc3e661444cb9d4175a5b7c09d1-0-0" class="displacy-label" startOffset="50%" side="left" fill="currentColor" text-anchor="middle">nsubj</textPath>
</text> </text>
<path class="displacy-arrowhead" d="M70,266.5 L62,254.5 78,254.5" fill="currentColor"></path>
</g>
<g class="displacy-arrow"> <g class="displacy-arrow">
<path class="displacy-arc" id="arrow-c3124cc3e661444cb9d4175a5b7c09d1-0-1" stroke-width="2px" d="M420,264.5 C420,89.5 745.0,89.5 745.0,264.5" fill="none" stroke="currentColor"></path> <path
class="displacy-arc"
id="arrow-c3124cc3e661444cb9d4175a5b7c09d1-0-0"
stroke-width="2px"
d="M70,264.5 C70,177.0 215.0,177.0 215.0,264.5"
fill="none"
stroke="currentColor"
></path>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px"> <text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textPath xlink:href="#arrow-c3124cc3e661444cb9d4175a5b7c09d1-0-1" class="displacy-label" startOffset="50%" side="left" fill="currentColor" text-anchor="middle">det</textPath> <textPath
xlink:href="#arrow-c3124cc3e661444cb9d4175a5b7c09d1-0-0"
class="displacy-label"
startOffset="50%"
side="left"
fill="currentColor"
text-anchor="middle"
>
nsubj
</textPath>
</text> </text>
<path class="displacy-arrowhead" d="M420,266.5 L412,254.5 428,254.5" fill="currentColor"></path> <path
</g> class="displacy-arrowhead"
d="M70,266.5 L62,254.5 78,254.5"
fill="currentColor"
></path>
</g>
<g class="displacy-arrow"> <g class="displacy-arrow">
<path class="displacy-arc" id="arrow-c3124cc3e661444cb9d4175a5b7c09d1-0-2" stroke-width="2px" d="M595,264.5 C595,177.0 740.0,177.0 740.0,264.5" fill="none" stroke="currentColor"></path> <path
class="displacy-arc"
id="arrow-c3124cc3e661444cb9d4175a5b7c09d1-0-1"
stroke-width="2px"
d="M420,264.5 C420,89.5 745.0,89.5 745.0,264.5"
fill="none"
stroke="currentColor"
></path>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px"> <text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textPath xlink:href="#arrow-c3124cc3e661444cb9d4175a5b7c09d1-0-2" class="displacy-label" startOffset="50%" side="left" fill="currentColor" text-anchor="middle">compound</textPath> <textPath
xlink:href="#arrow-c3124cc3e661444cb9d4175a5b7c09d1-0-1"
class="displacy-label"
startOffset="50%"
side="left"
fill="currentColor"
text-anchor="middle"
>
det
</textPath>
</text> </text>
<path class="displacy-arrowhead" d="M595,266.5 L587,254.5 603,254.5" fill="currentColor"></path> <path
</g> class="displacy-arrowhead"
d="M420,266.5 L412,254.5 428,254.5"
fill="currentColor"
></path>
</g>
<g class="displacy-arrow"> <g class="displacy-arrow">
<path class="displacy-arc" id="arrow-c3124cc3e661444cb9d4175a5b7c09d1-0-3" stroke-width="2px" d="M245,264.5 C245,2.0 750.0,2.0 750.0,264.5" fill="none" stroke="currentColor"></path> <path
class="displacy-arc"
id="arrow-c3124cc3e661444cb9d4175a5b7c09d1-0-2"
stroke-width="2px"
d="M595,264.5 C595,177.0 740.0,177.0 740.0,264.5"
fill="none"
stroke="currentColor"
></path>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px"> <text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textPath xlink:href="#arrow-c3124cc3e661444cb9d4175a5b7c09d1-0-3" class="displacy-label" startOffset="50%" side="left" fill="currentColor" text-anchor="middle">dobj</textPath> <textPath
xlink:href="#arrow-c3124cc3e661444cb9d4175a5b7c09d1-0-2"
class="displacy-label"
startOffset="50%"
side="left"
fill="currentColor"
text-anchor="middle"
>
compound
</textPath>
</text> </text>
<path class="displacy-arrowhead" d="M750.0,266.5 L758.0,254.5 742.0,254.5" fill="currentColor"></path> <path
</g> class="displacy-arrowhead"
d="M595,266.5 L587,254.5 603,254.5"
fill="currentColor"
></path>
</g>
<g class="displacy-arrow">
<path
class="displacy-arc"
id="arrow-c3124cc3e661444cb9d4175a5b7c09d1-0-3"
stroke-width="2px"
d="M245,264.5 C245,2.0 750.0,2.0 750.0,264.5"
fill="none"
stroke="currentColor"
></path>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textPath
xlink:href="#arrow-c3124cc3e661444cb9d4175a5b7c09d1-0-3"
class="displacy-label"
startOffset="50%"
side="left"
fill="currentColor"
text-anchor="middle"
>
dobj
</textPath>
</text>
<path
class="displacy-arrowhead"
d="M750.0,266.5 L758.0,254.5 742.0,254.5"
fill="currentColor"
></path>
</g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@ -1,31 +1,78 @@
<div <div
class="entities" class="entities"
style="line-height: 2.5; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 18px" style="
line-height: 2.5;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif,
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
font-size: 18px;
"
>But >But
<mark <mark
class="entity" class="entity"
style="background: linear-gradient(90deg, #AA9CFC, #FC9CE7); padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em" style="
background: linear-gradient(90deg, #aa9cfc, #fc9ce7);
padding: 0.45em 0.6em;
margin: 0 0.25em;
line-height: 1;
border-radius: 0.35em;
"
>Google >Google
<span <span
style="font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; text-transform: uppercase; vertical-align: middle; margin-left: 0.5rem" style="
font-size: 0.8em;
font-weight: bold;
line-height: 1;
border-radius: 0.35em;
text-transform: uppercase;
vertical-align: middle;
margin-left: 0.5rem;
"
>ORG</span >ORG</span
></mark ></mark
>is starting from behind. The company made a late push into hardware, and >is starting from behind. The company made a late push into hardware, and
<mark <mark
class="entity" class="entity"
style="background: linear-gradient(90deg, #AA9CFC, #FC9CE7); padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em" style="
background: linear-gradient(90deg, #aa9cfc, #fc9ce7);
padding: 0.45em 0.6em;
margin: 0 0.25em;
line-height: 1;
border-radius: 0.35em;
"
>Apple >Apple
<span <span
style="font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; text-transform: uppercase; vertical-align: middle; margin-left: 0.5rem" style="
font-size: 0.8em;
font-weight: bold;
line-height: 1;
border-radius: 0.35em;
text-transform: uppercase;
vertical-align: middle;
margin-left: 0.5rem;
"
>ORG</span >ORG</span
></mark ></mark
>s Siri, available on iPhones, and >s Siri, available on iPhones, and
<mark <mark
class="entity" class="entity"
style="background: linear-gradient(90deg, #AA9CFC, #FC9CE7); padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em" style="
background: linear-gradient(90deg, #aa9cfc, #fc9ce7);
padding: 0.45em 0.6em;
margin: 0 0.25em;
line-height: 1;
border-radius: 0.35em;
"
>Amazon >Amazon
<span <span
style="font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; text-transform: uppercase; vertical-align: middle; margin-left: 0.5rem" style="
font-size: 0.8em;
font-weight: bold;
line-height: 1;
border-radius: 0.35em;
text-transform: uppercase;
vertical-align: middle;
margin-left: 0.5rem;
"
>ORG</span >ORG</span
></mark ></mark
>s Alexa software, which runs on its Echo and Dot devices, have clear leads in consumer >s Alexa software, which runs on its Echo and Dot devices, have clear leads in consumer

View File

@ -1,24 +1,57 @@
<div <div
class="entities" class="entities"
style="line-height: 2.5; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px" style="
line-height: 2.5;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif,
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
font-size: 16px;
"
> >
🌱🌿 🌱🌿
<mark <mark
class="entity" class="entity"
style="background: #3dff74; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em" style="
background: #3dff74;
padding: 0.45em 0.6em;
margin: 0 0.25em;
line-height: 1;
border-radius: 0.35em;
"
>🐍 >🐍
<span <span
style="font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; text-transform: uppercase; vertical-align: middle; margin-left: 0.5rem" style="
font-size: 0.8em;
font-weight: bold;
line-height: 1;
border-radius: 0.35em;
text-transform: uppercase;
vertical-align: middle;
margin-left: 0.5rem;
"
>SNEK</span >SNEK</span
></mark ></mark
> >
____ 🌳🌲 ____ ____ 🌳🌲 ____
<mark <mark
class="entity" class="entity"
style="background: #cfc5ff; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em" style="
background: #cfc5ff;
padding: 0.45em 0.6em;
margin: 0 0.25em;
line-height: 1;
border-radius: 0.35em;
"
>👨‍🌾 >👨‍🌾
<span <span
style="font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; text-transform: uppercase; vertical-align: middle; margin-left: 0.5rem" style="
font-size: 0.8em;
font-weight: bold;
line-height: 1;
border-radius: 0.35em;
text-transform: uppercase;
vertical-align: middle;
margin-left: 0.5rem;
"
>HUMAN</span >HUMAN</span
></mark ></mark
> >

View File

@ -1,36 +1,83 @@
<div <div
class="entities" class="entities"
style="line-height: 2.5; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px" style="
line-height: 2.5;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif,
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
font-size: 16px;
"
> >
<mark <mark
class="entity" class="entity"
style="background: #7aecec; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em" style="
background: #7aecec;
padding: 0.45em 0.6em;
margin: 0 0.25em;
line-height: 1;
border-radius: 0.35em;
"
> >
Apple Apple
<span <span
style="font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; text-transform: uppercase; vertical-align: middle; margin-left: 0.5rem" style="
font-size: 0.8em;
font-weight: bold;
line-height: 1;
border-radius: 0.35em;
text-transform: uppercase;
vertical-align: middle;
margin-left: 0.5rem;
"
>ORG</span >ORG</span
> >
</mark> </mark>
is looking at buying is looking at buying
<mark <mark
class="entity" class="entity"
style="background: #feca74; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em" style="
background: #feca74;
padding: 0.45em 0.6em;
margin: 0 0.25em;
line-height: 1;
border-radius: 0.35em;
"
> >
U.K. U.K.
<span <span
style="font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; text-transform: uppercase; vertical-align: middle; margin-left: 0.5rem" style="
font-size: 0.8em;
font-weight: bold;
line-height: 1;
border-radius: 0.35em;
text-transform: uppercase;
vertical-align: middle;
margin-left: 0.5rem;
"
>GPE</span >GPE</span
> >
</mark> </mark>
startup for startup for
<mark <mark
class="entity" class="entity"
style="background: #e4e7d2; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em" style="
background: #e4e7d2;
padding: 0.45em 0.6em;
margin: 0 0.25em;
line-height: 1;
border-radius: 0.35em;
"
> >
$1 billion $1 billion
<span <span
style="font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; text-transform: uppercase; vertical-align: middle; margin-left: 0.5rem" style="
font-size: 0.8em;
font-weight: bold;
line-height: 1;
border-radius: 0.35em;
text-transform: uppercase;
vertical-align: middle;
margin-left: 0.5rem;
"
>MONEY</span >MONEY</span
> >
</mark> </mark>

View File

@ -1,37 +1,84 @@
<div <div
class="entities" class="entities"
style="line-height: 2.5; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 18px" style="
line-height: 2.5;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif,
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
font-size: 18px;
"
> >
When When
<mark <mark
class="entity" class="entity"
style="background: #aa9cfc; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em" style="
background: #aa9cfc;
padding: 0.45em 0.6em;
margin: 0 0.25em;
line-height: 1;
border-radius: 0.35em;
"
> >
Sebastian Thrun Sebastian Thrun
<span <span
style="font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; text-transform: uppercase; vertical-align: middle; margin-left: 0.5rem" style="
font-size: 0.8em;
font-weight: bold;
line-height: 1;
border-radius: 0.35em;
text-transform: uppercase;
vertical-align: middle;
margin-left: 0.5rem;
"
>PERSON</span >PERSON</span
> >
</mark> </mark>
started working on self-driving cars at started working on self-driving cars at
<mark <mark
class="entity" class="entity"
style="background: #7aecec; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em" style="
background: #7aecec;
padding: 0.45em 0.6em;
margin: 0 0.25em;
line-height: 1;
border-radius: 0.35em;
"
> >
Google Google
<span <span
style="font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; text-transform: uppercase; vertical-align: middle; margin-left: 0.5rem" style="
font-size: 0.8em;
font-weight: bold;
line-height: 1;
border-radius: 0.35em;
text-transform: uppercase;
vertical-align: middle;
margin-left: 0.5rem;
"
>ORG</span >ORG</span
> >
</mark> </mark>
in in
<mark <mark
class="entity" class="entity"
style="background: #bfe1d9; padding: 0.45em 0.6em; margin: 0 0.25em; line-height: 1; border-radius: 0.35em" style="
background: #bfe1d9;
padding: 0.45em 0.6em;
margin: 0 0.25em;
line-height: 1;
border-radius: 0.35em;
"
> >
2007 2007
<span <span
style="font-size: 0.8em; font-weight: bold; line-height: 1; border-radius: 0.35em; text-transform: uppercase; vertical-align: middle; margin-left: 0.5rem" style="
font-size: 0.8em;
font-weight: bold;
line-height: 1;
border-radius: 0.35em;
text-transform: uppercase;
vertical-align: middle;
margin-left: 0.5rem;
"
>DATE</span >DATE</span
> >
</mark> </mark>

View File

@ -5,7 +5,13 @@
class="displacy" class="displacy"
width="1975" width="1975"
height="399.5" height="399.5"
style="max-width: none; height: 399.5px; color: #000000; background: #ffffff; font-family: Arial" style="
max-width: none;
height: 399.5px;
color: #000000;
background: #ffffff;
font-family: Arial;
"
> >
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5"> <text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5">
<tspan class="displacy-word" fill="currentColor" x="50">Apple</tspan> <tspan class="displacy-word" fill="currentColor" x="50">Apple</tspan>

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -1,84 +1,212 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="0" class="displacy" width="1275" height="399.5" style="max-width: none; height: 399.5px; color: #000000; background: #ffffff; font-family: Arial"> <svg
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5"> xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
id="0"
class="displacy"
width="1275"
height="399.5"
style="
max-width: none;
height: 399.5px;
color: #000000;
background: #ffffff;
font-family: Arial;
"
>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5">
<tspan class="displacy-word" fill="currentColor" x="50">Autonomous</tspan> <tspan class="displacy-word" fill="currentColor" x="50">Autonomous</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="50">ADJ</tspan> <tspan class="displacy-tag" dy="2em" fill="currentColor" x="50">ADJ</tspan>
</text> </text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5"> <text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5">
<tspan class="displacy-word" fill="currentColor" x="225">cars</tspan> <tspan class="displacy-word" fill="currentColor" x="225">cars</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="225">NOUN</tspan> <tspan class="displacy-tag" dy="2em" fill="currentColor" x="225">NOUN</tspan>
</text> </text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5"> <text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5">
<tspan class="displacy-word" fill="currentColor" x="400">shift</tspan> <tspan class="displacy-word" fill="currentColor" x="400">shift</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="400">VERB</tspan> <tspan class="displacy-tag" dy="2em" fill="currentColor" x="400">VERB</tspan>
</text> </text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5"> <text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5">
<tspan class="displacy-word" fill="currentColor" x="575">insurance</tspan> <tspan class="displacy-word" fill="currentColor" x="575">insurance</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="575">NOUN</tspan> <tspan class="displacy-tag" dy="2em" fill="currentColor" x="575">NOUN</tspan>
</text> </text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5"> <text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5">
<tspan class="displacy-word" fill="currentColor" x="750">liability</tspan> <tspan class="displacy-word" fill="currentColor" x="750">liability</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="750">NOUN</tspan> <tspan class="displacy-tag" dy="2em" fill="currentColor" x="750">NOUN</tspan>
</text> </text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5"> <text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5">
<tspan class="displacy-word" fill="currentColor" x="925">toward</tspan> <tspan class="displacy-word" fill="currentColor" x="925">toward</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="925">ADP</tspan> <tspan class="displacy-tag" dy="2em" fill="currentColor" x="925">ADP</tspan>
</text> </text>
<text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5"> <text class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5">
<tspan class="displacy-word" fill="currentColor" x="1100">manufacturers</tspan> <tspan class="displacy-word" fill="currentColor" x="1100">manufacturers</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="1100">NOUN</tspan> <tspan class="displacy-tag" dy="2em" fill="currentColor" x="1100">NOUN</tspan>
</text>
<g class="displacy-arrow">
<path class="displacy-arc" id="arrow-0-0" stroke-width="2px" d="M70,264.5 C70,177.0 215.0,177.0 215.0,264.5" fill="none" stroke="currentColor"></path>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textpath xlink:href="#arrow-0-0" class="displacy-label" startOffset="50%" fill="currentColor" text-anchor="middle">amod</textpath>
</text> </text>
<path class="displacy-arrowhead" d="M70,266.5 L62,254.5 78,254.5" fill="currentColor"></path>
</g>
<g class="displacy-arrow"> <g class="displacy-arrow">
<path class="displacy-arc" id="arrow-0-1" stroke-width="2px" d="M245,264.5 C245,177.0 390.0,177.0 390.0,264.5" fill="none" stroke="currentColor"></path> <path
class="displacy-arc"
id="arrow-0-0"
stroke-width="2px"
d="M70,264.5 C70,177.0 215.0,177.0 215.0,264.5"
fill="none"
stroke="currentColor"
></path>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px"> <text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textpath xlink:href="#arrow-0-1" class="displacy-label" startOffset="50%" fill="currentColor" text-anchor="middle">nsubj</textpath> <textpath
xlink:href="#arrow-0-0"
class="displacy-label"
startOffset="50%"
fill="currentColor"
text-anchor="middle"
>
amod
</textpath>
</text> </text>
<path class="displacy-arrowhead" d="M245,266.5 L237,254.5 253,254.5" fill="currentColor"></path> <path
</g> class="displacy-arrowhead"
d="M70,266.5 L62,254.5 78,254.5"
fill="currentColor"
></path>
</g>
<g class="displacy-arrow"> <g class="displacy-arrow">
<path class="displacy-arc" id="arrow-0-2" stroke-width="2px" d="M595,264.5 C595,177.0 740.0,177.0 740.0,264.5" fill="none" stroke="currentColor"></path> <path
class="displacy-arc"
id="arrow-0-1"
stroke-width="2px"
d="M245,264.5 C245,177.0 390.0,177.0 390.0,264.5"
fill="none"
stroke="currentColor"
></path>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px"> <text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textpath xlink:href="#arrow-0-2" class="displacy-label" startOffset="50%" fill="currentColor" text-anchor="middle">compound</textpath> <textpath
xlink:href="#arrow-0-1"
class="displacy-label"
startOffset="50%"
fill="currentColor"
text-anchor="middle"
>
nsubj
</textpath>
</text> </text>
<path class="displacy-arrowhead" d="M595,266.5 L587,254.5 603,254.5" fill="currentColor"></path> <path
</g> class="displacy-arrowhead"
d="M245,266.5 L237,254.5 253,254.5"
fill="currentColor"
></path>
</g>
<g class="displacy-arrow"> <g class="displacy-arrow">
<path class="displacy-arc" id="arrow-0-3" stroke-width="2px" d="M420,264.5 C420,89.5 745.0,89.5 745.0,264.5" fill="none" stroke="currentColor"></path> <path
class="displacy-arc"
id="arrow-0-2"
stroke-width="2px"
d="M595,264.5 C595,177.0 740.0,177.0 740.0,264.5"
fill="none"
stroke="currentColor"
></path>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px"> <text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textpath xlink:href="#arrow-0-3" class="displacy-label" startOffset="50%" fill="currentColor" text-anchor="middle">dobj</textpath> <textpath
xlink:href="#arrow-0-2"
class="displacy-label"
startOffset="50%"
fill="currentColor"
text-anchor="middle"
>
compound
</textpath>
</text> </text>
<path class="displacy-arrowhead" d="M745.0,266.5 L753.0,254.5 737.0,254.5" fill="currentColor"></path> <path
</g> class="displacy-arrowhead"
d="M595,266.5 L587,254.5 603,254.5"
fill="currentColor"
></path>
</g>
<g class="displacy-arrow"> <g class="displacy-arrow">
<path class="displacy-arc" id="arrow-0-4" stroke-width="2px" d="M420,264.5 C420,2.0 925.0,2.0 925.0,264.5" fill="none" stroke="currentColor"></path> <path
class="displacy-arc"
id="arrow-0-3"
stroke-width="2px"
d="M420,264.5 C420,89.5 745.0,89.5 745.0,264.5"
fill="none"
stroke="currentColor"
></path>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px"> <text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textpath xlink:href="#arrow-0-4" class="displacy-label" startOffset="50%" fill="currentColor" text-anchor="middle">prep</textpath> <textpath
xlink:href="#arrow-0-3"
class="displacy-label"
startOffset="50%"
fill="currentColor"
text-anchor="middle"
>
dobj
</textpath>
</text> </text>
<path class="displacy-arrowhead" d="M925.0,266.5 L933.0,254.5 917.0,254.5" fill="currentColor"></path> <path
</g> class="displacy-arrowhead"
d="M745.0,266.5 L753.0,254.5 737.0,254.5"
fill="currentColor"
></path>
</g>
<g class="displacy-arrow"> <g class="displacy-arrow">
<path class="displacy-arc" id="arrow-0-5" stroke-width="2px" d="M945,264.5 C945,177.0 1090.0,177.0 1090.0,264.5" fill="none" stroke="currentColor"></path> <path
class="displacy-arc"
id="arrow-0-4"
stroke-width="2px"
d="M420,264.5 C420,2.0 925.0,2.0 925.0,264.5"
fill="none"
stroke="currentColor"
></path>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px"> <text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textpath xlink:href="#arrow-0-5" class="displacy-label" startOffset="50%" fill="currentColor" text-anchor="middle">pobj</textpath> <textpath
xlink:href="#arrow-0-4"
class="displacy-label"
startOffset="50%"
fill="currentColor"
text-anchor="middle"
>
prep
</textpath>
</text> </text>
<path class="displacy-arrowhead" d="M1090.0,266.5 L1098.0,254.5 1082.0,254.5" fill="currentColor"></path> <path
</g> class="displacy-arrowhead"
d="M925.0,266.5 L933.0,254.5 917.0,254.5"
fill="currentColor"
></path>
</g>
<g class="displacy-arrow">
<path
class="displacy-arc"
id="arrow-0-5"
stroke-width="2px"
d="M945,264.5 C945,177.0 1090.0,177.0 1090.0,264.5"
fill="none"
stroke="currentColor"
></path>
<text dy="1.25em" style="font-size: 0.8em; letter-spacing: 1px">
<textpath
xlink:href="#arrow-0-5"
class="displacy-label"
startOffset="50%"
fill="currentColor"
text-anchor="middle"
>
pobj
</textpath>
</text>
<path
class="displacy-arrowhead"
d="M1090.0,266.5 L1098.0,254.5 1082.0,254.5"
fill="currentColor"
></path>
</g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@ -1,30 +1,83 @@
<div class="spans" <div
style="line-height: 2.5; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 18px; direction: ltr"> class="spans"
style="
line-height: 2.5;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif,
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
font-size: 18px;
direction: ltr;
"
>
Welcome to the Welcome to the
<span style="font-weight: bold; display: inline-block; position: relative;"> <span style="font-weight: bold; display: inline-block; position: relative">
Bank Bank
<span <span
style="background: #ddd; top: 40px; height: 4px; left: -1px; width: calc(100% + 2px); position: absolute;"> style="
background: #ddd;
top: 40px;
height: 4px;
left: -1px;
width: calc(100% + 2px);
position: absolute;
"
>
</span> </span>
<span <span
style="background: #ddd; top: 40px; height: 4px; border-top-left-radius: 3px; border-bottom-left-radius: 3px; left: -1px; width: calc(100% + 2px); position: absolute;"> style="
background: #ddd;
top: 40px;
height: 4px;
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
left: -1px;
width: calc(100% + 2px);
position: absolute;
"
>
<span <span
style="background: #ddd; color: #000; top: -0.5em; padding: 2px 3px; position: absolute; font-size: 0.6em; font-weight: bold; line-height: 1; border-radius: 3px"> style="
background: #ddd;
color: #000;
top: -0.5em;
padding: 2px 3px;
position: absolute;
font-size: 0.6em;
font-weight: bold;
line-height: 1;
border-radius: 3px;
"
>
BANK BANK
</span> </span>
</span> </span>
</span> </span>
<span style="font-weight: bold; display: inline-block; position: relative;"> <span style="font-weight: bold; display: inline-block; position: relative">
of of
<span <span
style="background: #ddd; top: 40px; height: 4px; left: -1px; width: calc(100% + 2px); position: absolute;"> style="
background: #ddd;
top: 40px;
height: 4px;
left: -1px;
width: calc(100% + 2px);
position: absolute;
"
>
</span> </span>
</span> </span>
<span style="font-weight: bold; display: inline-block; position: relative;"> <span style="font-weight: bold; display: inline-block; position: relative">
China China
<span <span
style="background: #ddd; top: 40px; height: 4px; left: -1px; width: calc(100% + 2px); position: absolute;"> style="
background: #ddd;
top: 40px;
height: 4px;
left: -1px;
width: calc(100% + 2px);
position: absolute;
"
>
</span> </span>
</span> </span>
. .

View File

@ -1,38 +1,120 @@
<div class="spans" <div
style="line-height: 2.5; direction: ltr; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 18px"> class="spans"
style="
line-height: 2.5;
direction: ltr;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif,
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
font-size: 18px;
"
>
Welcome to the Welcome to the
<span style="font-weight: bold; display: inline-block; position: relative;"> <span style="font-weight: bold; display: inline-block; position: relative">
Bank Bank
<span <span
style="background: #7aecec; top: 40px; height: 4px; left: -1px; width: calc(100% + 2px); position: absolute;"> style="
background: #7aecec;
top: 40px;
height: 4px;
left: -1px;
width: calc(100% + 2px);
position: absolute;
"
>
</span> </span>
<span <span
style="background: #7aecec; top: 40px; height: 4px; border-top-left-radius: 3px; border-bottom-left-radius: 3px; left: -1px; width: calc(100% + 2px); position: absolute;"> style="
background: #7aecec;
top: 40px;
height: 4px;
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
left: -1px;
width: calc(100% + 2px);
position: absolute;
"
>
<span <span
style="background: #7aecec; color: #000; top: -0.5em; padding: 2px 3px; position: absolute; font-size: 0.6em; font-weight: bold; line-height: 1; border-radius: 3px"> style="
background: #7aecec;
color: #000;
top: -0.5em;
padding: 2px 3px;
position: absolute;
font-size: 0.6em;
font-weight: bold;
line-height: 1;
border-radius: 3px;
"
>
ORG ORG
</span> </span>
</span> </span>
</span> </span>
<span style="font-weight: bold; display: inline-block; position: relative;"> <span style="font-weight: bold; display: inline-block; position: relative">
of of
<span <span
style="background: #7aecec; top: 40px; height: 4px; left: -1px; width: calc(100% + 2px); position: absolute;"> style="
background: #7aecec;
top: 40px;
height: 4px;
left: -1px;
width: calc(100% + 2px);
position: absolute;
"
>
</span> </span>
</span> </span>
<span style="font-weight: bold; display: inline-block; position: relative;"> <span style="font-weight: bold; display: inline-block; position: relative">
China China
<span <span
style="background: #7aecec; top: 40px; height: 4px; left: -1px; width: calc(100% + 2px); position: absolute;"> style="
background: #7aecec;
top: 40px;
height: 4px;
left: -1px;
width: calc(100% + 2px);
position: absolute;
"
>
</span> </span>
<span <span
style="background: #feca74; top: 57px; height: 4px; left: -1px; width: calc(100% + 2px); position: absolute;"> style="
background: #feca74;
top: 57px;
height: 4px;
left: -1px;
width: calc(100% + 2px);
position: absolute;
"
>
</span> </span>
<span <span
style="background: #feca74; top: 57px; height: 4px; border-top-left-radius: 3px; border-bottom-left-radius: 3px; left: -1px; width: calc(100% + 2px); position: absolute;"> style="
background: #feca74;
top: 57px;
height: 4px;
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
left: -1px;
width: calc(100% + 2px);
position: absolute;
"
>
<span <span
style="background: #feca74; color: #000; top: -0.5em; padding: 2px 3px; position: absolute; font-size: 0.6em; font-weight: bold; line-height: 1; border-radius: 3px"> style="
background: #feca74;
color: #000;
top: -0.5em;
padding: 2px 3px;
position: absolute;
font-size: 0.6em;
font-weight: bold;
line-height: 1;
border-radius: 3px;
"
>
GPE GPE
</span> </span>
</span> </span>

View File

@ -189,8 +189,8 @@ than the rule-based `sentencizer`.
#### Switch from trainable lemmatizer to default lemmatizer #### Switch from trainable lemmatizer to default lemmatizer
Since v3.3, a number of pipelines use a trainable lemmatizer. You can check whether Since v3.3, a number of pipelines use a trainable lemmatizer. You can check
the lemmatizer is trainable: whether the lemmatizer is trainable:
```python ```python
nlp = spacy.load("de_core_web_sm") nlp = spacy.load("de_core_web_sm")

View File

@ -65,8 +65,16 @@ import { Colors, Patterns } from 'widgets/styleguide'
## Typography {#typography} ## Typography {#typography}
import { H1, H2, H3, H4, H5, Label, InlineList, Comment } from import {
'components/typography' H1,
H2,
H3,
H4,
H5,
Label,
InlineList,
Comment,
} from 'components/typography'
> #### Markdown > #### Markdown
> >
@ -101,12 +109,12 @@ in the sidebar menu.
</Infobox> </Infobox>
<div> <div>
<H1>Headline 1</H1> <H1>Headline 1</H1>
<H2>Headline 2</H2> <H2>Headline 2</H2>
<H3>Headline 3</H3> <H3>Headline 3</H3>
<H4>Headline 4</H4> <H4>Headline 4</H4>
<H5>Headline 5</H5> <H5>Headline 5</H5>
<Label>Label</Label> <Label>Label</Label>
</div> </div>
--- ---
@ -182,8 +190,9 @@ installed.
<InlineList> <InlineList>
<Tag>method</Tag> <Tag variant="new">4</Tag> <Tag variant="model">tagger, <Tag>method</Tag> <Tag variant="new">4</Tag> <Tag variant="model">
parser</Tag> tagger, parser
</Tag>
</InlineList> </InlineList>
@ -200,13 +209,25 @@ Link buttons come in two variants, `primary` and `secondary` and two sizes, with
an optional `large` size modifier. Since they're mostly used as enhanced links, an optional `large` size modifier. Since they're mostly used as enhanced links,
the buttons are implemented as styled links instead of native button elements. the buttons are implemented as styled links instead of native button elements.
<InlineList><Button to="#" variant="primary">Primary small</Button> <InlineList>
<Button to="#" variant="secondary">Secondary small</Button></InlineList> <Button to="#" variant="primary">
Primary small
</Button>
<Button to="#" variant="secondary">
Secondary small
</Button>
</InlineList>
<br /> <br />
<InlineList><Button to="#" variant="primary" large>Primary large</Button> <InlineList>
<Button to="#" variant="secondary" large>Secondary large</Button></InlineList> <Button to="#" variant="primary" large>
Primary large
</Button>
<Button to="#" variant="secondary" large>
Secondary large
</Button>
</InlineList>
## Components ## Components

View File

@ -1,9 +1,9 @@
A named entity is a "real-world object" that's assigned a name for example, a A named entity is a "real-world object" that's assigned a name for example, a
person, a country, a product or a book title. spaCy can **recognize various person, a country, a product or a book title. spaCy can **recognize various
types of named entities in a document, by asking the model for a types of named entities in a document, by asking the model for a prediction**.
prediction**. Because models are statistical and strongly depend on the Because models are statistical and strongly depend on the examples they were
examples they were trained on, this doesn't always work _perfectly_ and might trained on, this doesn't always work _perfectly_ and might need some tuning
need some tuning later, depending on your use case. later, depending on your use case.
Named entities are available as the `ents` property of a `Doc`: Named entities are available as the `ents` property of a `Doc`:
@ -32,7 +32,11 @@ for ent in doc.ents:
Using spaCy's built-in [displaCy visualizer](/usage/visualizers), here's what Using spaCy's built-in [displaCy visualizer](/usage/visualizers), here's what
our example sentence and its named entities look like: our example sentence and its named entities look like:
import DisplaCyEntHtml from 'images/displacy-ent1.html'; import { Iframe } from import DisplaCyEntHtml from 'images/displacy-ent1.html'
'components/embed' import { Iframe } from 'components/embed'
<Iframe title="displaCy visualization of entities" html={DisplaCyEntHtml} height={100} /> <Iframe
title="displaCy visualization of entities"
html={DisplaCyEntHtml}
height={100}
/>

View File

@ -57,7 +57,11 @@ for token in doc:
Using spaCy's built-in [displaCy visualizer](/usage/visualizers), here's what Using spaCy's built-in [displaCy visualizer](/usage/visualizers), here's what
our example sentence and its dependencies look like: our example sentence and its dependencies look like:
import DisplaCyLongHtml from 'images/displacy-long.html'; import { Iframe } from import DisplaCyLongHtml from 'images/displacy-long.html'
'components/embed' import { Iframe } from 'components/embed'
<Iframe title="displaCy visualization of dependencies and entities" html={DisplaCyLongHtml} height={450} /> <Iframe
title="displaCy visualization of dependencies and entities"
html={DisplaCyLongHtml}
height={450}
/>

View File

@ -10,9 +10,9 @@ any other information.
Training is an iterative process in which the model's predictions are compared Training is an iterative process in which the model's predictions are compared
against the reference annotations in order to estimate the **gradient of the against the reference annotations in order to estimate the **gradient of the
loss**. The gradient of the loss is then used to calculate the gradient of the loss**. The gradient of the loss is then used to calculate the gradient of the
weights through [backpropagation](https://thinc.ai/docs/backprop101). The gradients weights through [backpropagation](https://thinc.ai/docs/backprop101). The
indicate how the weight values should be changed so that the model's predictions gradients indicate how the weight values should be changed so that the model's
become more similar to the reference labels over time. predictions become more similar to the reference labels over time.
> - **Training data:** Examples and their annotations. > - **Training data:** Examples and their annotations.
> - **Text:** The input text the model should predict a label for. > - **Text:** The input text the model should predict a label for.

View File

@ -1,4 +1,5 @@
import { Help } from 'components/typography'; import Link from 'components/link' import { Help } from 'components/typography'
import Link from 'components/link'
<figure> <figure>

View File

@ -218,8 +218,8 @@ $ pip install torch==1.11.0+cu113 torchvision==0.12.0+cu113 torchaudio==0.11.0+c
Next, install spaCy with the extras for your CUDA version and transformers. The Next, install spaCy with the extras for your CUDA version and transformers. The
CUDA extra (e.g., `cuda102`, `cuda113`) installs the correct version of CUDA extra (e.g., `cuda102`, `cuda113`) installs the correct version of
[`cupy`](https://docs.cupy.dev/en/stable/install.html#installing-cupy), which [`cupy`](https://docs.cupy.dev/en/stable/install.html#installing-cupy), which is
is just like `numpy`, but for GPU. You may also need to set the `CUDA_PATH` just like `numpy`, but for GPU. You may also need to set the `CUDA_PATH`
environment variable if your CUDA runtime is installed in a non-standard environment variable if your CUDA runtime is installed in a non-standard
location. Putting it all together, if you had installed CUDA 11.3 in location. Putting it all together, if you had installed CUDA 11.3 in
`/opt/nvidia/cuda`, you would run: `/opt/nvidia/cuda`, you would run:
@ -531,8 +531,7 @@ Word vectors in spaCy are "static" in the sense that they are not learned
parameters of the statistical models, and spaCy itself does not feature any parameters of the statistical models, and spaCy itself does not feature any
algorithms for learning word vector tables. You can train a word vectors table algorithms for learning word vector tables. You can train a word vectors table
using tools such as [floret](https://github.com/explosion/floret), using tools such as [floret](https://github.com/explosion/floret),
[Gensim](https://radimrehurek.com/gensim/), [Gensim](https://radimrehurek.com/gensim/), [FastText](https://fasttext.cc/) or
[FastText](https://fasttext.cc/) or
[GloVe](https://nlp.stanford.edu/projects/glove/), or download existing [GloVe](https://nlp.stanford.edu/projects/glove/), or download existing
pretrained vectors. The [`init vectors`](/api/cli#init-vectors) command lets you pretrained vectors. The [`init vectors`](/api/cli#init-vectors) command lets you
convert vectors for use with spaCy and will give you a directory you can load or convert vectors for use with spaCy and will give you a directory you can load or

View File

@ -69,7 +69,7 @@ pipeline, which is less accurate but much cheaper to run.
> gold-standard segmentation and tokenization, from a pretty specific type of > gold-standard segmentation and tokenization, from a pretty specific type of
> text (articles from a single newspaper, 1984-1989). > text (articles from a single newspaper, 1984-1989).
import Benchmarks from 'usage/\_benchmarks-models.mdx' import Benchmarks from 'usage/_benchmarks-models.mdx'
<Benchmarks /> <Benchmarks />

View File

@ -181,7 +181,9 @@ $ pip install --no-build-isolation --editable .[lookups,cuda102]
How to install compilers and related build tools: How to install compilers and related build tools:
<a id="source-ubuntu"></a><a id="source-osx"></a><a id="source-windows"></a> <a id="source-ubuntu"></a>
<a id="source-osx"></a>
<a id="source-windows"></a>
- **Ubuntu:** Install system-level dependencies via `apt-get`: - **Ubuntu:** Install system-level dependencies via `apt-get`:
`sudo apt-get install build-essential python-dev git` `sudo apt-get install build-essential python-dev git`
@ -235,10 +237,10 @@ package to see what the oldest recommended versions of `numpy` are.
Some additional options may be useful for spaCy developers who are editing the Some additional options may be useful for spaCy developers who are editing the
source code and recompiling frequently. source code and recompiling frequently.
- Install in editable mode. Changes to `.py` files will be reflected as soon - Install in editable mode. Changes to `.py` files will be reflected as soon as
as the files are saved, but edits to Cython files (`.pxd`, `.pyx`) will the files are saved, but edits to Cython files (`.pxd`, `.pyx`) will require
require the `pip install` command below to be run again. Before installing in the `pip install` command below to be run again. Before installing in editable
editable mode, be sure you have removed any previous installs with mode, be sure you have removed any previous installs with
`pip uninstall spacy`, which you may need to run multiple times to remove all `pip uninstall spacy`, which you may need to run multiple times to remove all
traces of earlier installs. traces of earlier installs.
@ -247,8 +249,8 @@ source code and recompiling frequently.
$ pip install --no-build-isolation --editable . $ pip install --no-build-isolation --editable .
``` ```
- Build in parallel. Starting in v3.4.0, you can specify the number of - Build in parallel. Starting in v3.4.0, you can specify the number of build
build jobs with the environment variable `SPACY_NUM_BUILD_JOBS`: jobs with the environment variable `SPACY_NUM_BUILD_JOBS`:
```bash ```bash
$ pip install -r requirements.txt $ pip install -r requirements.txt

View File

@ -537,13 +537,13 @@ two major steps required:
pass through the `nlp` pipeline. pass through the `nlp` pipeline.
<Project id="tutorials/rel_component"> <Project id="tutorials/rel_component">
Run this example use-case by using our project template. It includes all the Run this example use-case by using our project template. It includes all the
code to create the ML model and the pipeline component from scratch. code to create the ML model and the pipeline component from scratch. It also
It also contains two config files to train the model: contains two config files to train the model: one to run on CPU with a Tok2Vec
one to run on CPU with a Tok2Vec layer, and one for the GPU using a transformer. layer, and one for the GPU using a transformer. The project applies the
The project applies the relation extraction component to identify biomolecular relation extraction component to identify biomolecular interactions in a
interactions in a sample dataset, but you can easily swap in your own dataset sample dataset, but you can easily swap in your own dataset for your
for your experiments in any other domain. experiments in any other domain.
</Project> </Project>
<YouTube id="8HL-Ap5_Axo"></YouTube> <YouTube id="8HL-Ap5_Axo"></YouTube>
@ -1043,11 +1043,10 @@ def make_relation_extractor(nlp, name, model):
``` ```
<Project id="tutorials/rel_component"> <Project id="tutorials/rel_component">
Run this example use-case by using our project template. It includes all the Run this example use-case by using our project template. It includes all the
code to create the ML model and the pipeline component from scratch. code to create the ML model and the pipeline component from scratch. It
It contains two config files to train the model: contains two config files to train the model: one to run on CPU with a Tok2Vec
one to run on CPU with a Tok2Vec layer, and one for the GPU using a transformer. layer, and one for the GPU using a transformer. The project applies the
The project applies the relation extraction component to identify biomolecular relation extraction component to identify biomolecular interactions, but you
interactions, but you can easily swap in your own dataset for your experiments can easily swap in your own dataset for your experiments in any other domain.
in any other domain.
</Project> </Project>

View File

@ -28,7 +28,7 @@ annotations.
## Part-of-speech tagging {#pos-tagging model="tagger, parser"} ## Part-of-speech tagging {#pos-tagging model="tagger, parser"}
import PosDeps101 from 'usage/101/\_pos-deps.mdx' import PosDeps101 from 'usage/101/_pos-deps.mdx'
<PosDeps101 /> <PosDeps101 />
@ -300,7 +300,11 @@ for token in doc:
import DisplaCyLong2Html from 'images/displacy-long2.html' import DisplaCyLong2Html from 'images/displacy-long2.html'
<Iframe title="displaCy visualization of dependencies and entities 2" html={DisplaCyLong2Html} height={450} /> <Iframe
title="displaCy visualization of dependencies and entities 2"
html={DisplaCyLong2Html}
height={450}
/>
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
@ -536,7 +540,7 @@ with new examples.
### Named Entity Recognition 101 {#named-entities-101} ### Named Entity Recognition 101 {#named-entities-101}
import NER101 from 'usage/101/\_named-entities.mdx' import NER101 from 'usage/101/_named-entities.mdx'
<NER101 /> <NER101 />
@ -730,7 +734,11 @@ displacy.serve(doc, style="ent")
import DisplacyEntHtml from 'images/displacy-ent2.html' import DisplacyEntHtml from 'images/displacy-ent2.html'
<Iframe title="displaCy visualizer for entities" html={DisplacyEntHtml} height={180} /> <Iframe
title="displaCy visualizer for entities"
html={DisplacyEntHtml}
height={180}
/>
## Entity Linking {#entity-linking} ## Entity Linking {#entity-linking}
@ -785,7 +793,7 @@ during tokenization. This is kind of a core principle of spaCy's `Doc` object:
</Infobox> </Infobox>
import Tokenization101 from 'usage/101/\_tokenization.mdx' import Tokenization101 from 'usage/101/_tokenization.mdx'
<Tokenization101 /> <Tokenization101 />
@ -1868,7 +1876,7 @@ initialized before training. See the
## Word vectors and semantic similarity {#vectors-similarity} ## Word vectors and semantic similarity {#vectors-similarity}
import Vectors101 from 'usage/101/\_vectors-similarity.mdx' import Vectors101 from 'usage/101/_vectors-similarity.mdx'
<Vectors101 /> <Vectors101 />
@ -1998,7 +2006,7 @@ for word, vector in vector_data.items():
## Language Data {#language-data} ## Language Data {#language-data}
import LanguageData101 from 'usage/101/\_language-data.mdx' import LanguageData101 from 'usage/101/_language-data.mdx'
<LanguageData101 /> <LanguageData101 />

View File

@ -25,7 +25,11 @@ located anywhere on your file system.
import QuickstartModels from 'widgets/quickstart-models.js' import QuickstartModels from 'widgets/quickstart-models.js'
<QuickstartModels title="Quickstart" id="quickstart" description="Install a default trained pipeline package, get the code to load it from within spaCy and an example to test it. For more options, see the section on available packages below." /> <QuickstartModels
title="Quickstart"
id="quickstart"
description="Install a default trained pipeline package, get the code to load it from within spaCy and an example to test it. For more options, see the section on available packages below."
/>
### Usage note ### Usage note

View File

@ -12,7 +12,7 @@ menu:
- ['Plugins & Wrappers', 'plugins'] - ['Plugins & Wrappers', 'plugins']
--- ---
import Pipelines101 from 'usage/101/\_pipelines.mdx' import Pipelines101 from 'usage/101/_pipelines.mdx'
<Pipelines101 /> <Pipelines101 />
@ -364,7 +364,8 @@ nlp.enable_pipe("tagger")
In addition to `disable`, `spacy.load()` also accepts `enable`. If `enable` is In addition to `disable`, `spacy.load()` also accepts `enable`. If `enable` is
set, all components except for those in `enable` are disabled. If `enable` and set, all components except for those in `enable` are disabled. If `enable` and
`disable` conflict (i.e. the same component is included in both), an error is raised. `disable` conflict (i.e. the same component is included in both), an error is
raised.
```python ```python
# Load the complete pipeline, but disable all components except for tok2vec and tagger # Load the complete pipeline, but disable all components except for tok2vec and tagger

View File

@ -43,13 +43,31 @@ and experiments, iterate on demos and prototypes and ship your models into
production. production.
<Grid narrow cols={3}> <Grid narrow cols={3}>
<Integration title="DVC" logo="dvc" url="#dvc">Manage and version your data</Integration> <Integration title="DVC" logo="dvc" url="#dvc">
<Integration title="Prodigy" logo="prodigy" url="#prodigy">Create labelled training data</Integration> Manage and version your data
<Integration title="Streamlit" logo="streamlit" url="#streamlit">Visualize and demo your pipelines</Integration> </Integration>
<Integration title="FastAPI" logo="fastapi" url="#fastapi">Serve your models and host APIs</Integration> <Integration title="Prodigy" logo="prodigy" url="#prodigy">
<Integration title="Ray" logo="ray" url="#ray">Distributed and parallel training</Integration> Create labelled training data
<Integration title="Weights &amp; Biases" logo="wandb" url="#wandb">Track your experiments and results</Integration> </Integration>
<Integration title="Hugging Face Hub" logo="huggingface_hub" url="#huggingface_hub">Upload your pipelines to the Hugging Face Hub</Integration> <Integration title="Streamlit" logo="streamlit" url="#streamlit">
Visualize and demo your pipelines
</Integration>
<Integration title="FastAPI" logo="fastapi" url="#fastapi">
Serve your models and host APIs
</Integration>
<Integration title="Ray" logo="ray" url="#ray">
Distributed and parallel training
</Integration>
<Integration title="Weights &amp; Biases" logo="wandb" url="#wandb">
Track your experiments and results
</Integration>
<Integration
title="Hugging Face Hub"
logo="huggingface_hub"
url="#huggingface_hub"
>
Upload your pipelines to the Hugging Face Hub
</Integration>
</Grid> </Grid>
### 1. Clone a project template {#clone} ### 1. Clone a project template {#clone}

View File

@ -1107,7 +1107,11 @@ relations and tokens we want to match:
import DisplaCyDepFoundedHtml from 'images/displacy-dep-founded.html' import DisplaCyDepFoundedHtml from 'images/displacy-dep-founded.html'
<Iframe title="displaCy visualization of dependencies" html={DisplaCyDepFoundedHtml} height={450} /> <Iframe
title="displaCy visualization of dependencies"
html={DisplaCyDepFoundedHtml}
height={450}
/>
The relations we're interested in are: The relations we're interested in are:

View File

@ -10,7 +10,7 @@ menu:
## Basics {#basics hidden="true"} ## Basics {#basics hidden="true"}
import Serialization101 from 'usage/101/\_serialization.mdx' import Serialization101 from 'usage/101/_serialization.mdx'
<Serialization101 /> <Serialization101 />
@ -582,7 +582,11 @@ displayed in `#3dff74`.
import DisplaCyEntSnekHtml from 'images/displacy-ent-snek.html' import DisplaCyEntSnekHtml from 'images/displacy-ent-snek.html'
<Iframe title="displaCy visualization of entities" html={DisplaCyEntSnekHtml} height={100} /> <Iframe
title="displaCy visualization of entities"
html={DisplaCyEntSnekHtml}
height={100}
/>
## Saving, loading and distributing trained pipelines {#models} ## Saving, loading and distributing trained pipelines {#models}

View File

@ -37,7 +37,11 @@ understanding systems, using both rule-based and machine learning approaches. It
includes 55 exercises featuring interactive coding practice, multiple-choice includes 55 exercises featuring interactive coding practice, multiple-choice
questions and slide decks. questions and slide decks.
<p><Button to="https://course.spacy.io" variant="primary">Start the course</Button></p> <p>
<Button to="https://course.spacy.io" variant="primary">
Start the course
</Button>
</p>
</Infobox> </Infobox>
@ -191,7 +195,7 @@ text with spaCy.
### Tokenization {#annotations-token} ### Tokenization {#annotations-token}
import Tokenization101 from 'usage/101/\_tokenization.mdx' import Tokenization101 from 'usage/101/_tokenization.mdx'
<Tokenization101 /> <Tokenization101 />
@ -207,7 +211,7 @@ language-specific data**, see the usage guides on
### Part-of-speech tags and dependencies {#annotations-pos-deps model="parser"} ### Part-of-speech tags and dependencies {#annotations-pos-deps model="parser"}
import PosDeps101 from 'usage/101/\_pos-deps.mdx' import PosDeps101 from 'usage/101/_pos-deps.mdx'
<PosDeps101 /> <PosDeps101 />
@ -222,7 +226,7 @@ how to **navigate and use the parse tree** effectively, see the usage guides on
### Named Entities {#annotations-ner model="ner"} ### Named Entities {#annotations-ner model="ner"}
import NER101 from 'usage/101/\_named-entities.mdx' import NER101 from 'usage/101/_named-entities.mdx'
<NER101 /> <NER101 />
@ -238,7 +242,7 @@ of a model, see the usage guides on
### Word vectors and similarity {#vectors-similarity model="vectors"} ### Word vectors and similarity {#vectors-similarity model="vectors"}
import Vectors101 from 'usage/101/\_vectors-similarity.mdx' import Vectors101 from 'usage/101/_vectors-similarity.mdx'
<Vectors101 /> <Vectors101 />
@ -252,7 +256,7 @@ To learn more about word vectors, how to **customize them** and how to load
## Pipelines {#pipelines} ## Pipelines {#pipelines}
import Pipelines101 from 'usage/101/\_pipelines.mdx' import Pipelines101 from 'usage/101/_pipelines.mdx'
<Pipelines101 /> <Pipelines101 />
@ -266,7 +270,7 @@ guide on [language processing pipelines](/usage/processing-pipelines).
## Architecture {#architecture} ## Architecture {#architecture}
import Architecture101 from 'usage/101/\_architecture.mdx' import Architecture101 from 'usage/101/_architecture.mdx'
<Architecture101 /> <Architecture101 />
@ -384,7 +388,7 @@ it.
## Serialization {#serialization} ## Serialization {#serialization}
import Serialization101 from 'usage/101/\_serialization.mdx' import Serialization101 from 'usage/101/_serialization.mdx'
<Serialization101 /> <Serialization101 />
@ -397,7 +401,7 @@ guide on [saving and loading](/usage/saving-loading#models).
## Training {#training} ## Training {#training}
import Training101 from 'usage/101/\_training.mdx' import Training101 from 'usage/101/_training.mdx'
<Training101 /> <Training101 />
@ -476,7 +480,7 @@ for trainable components.
## Language data {#language-data} ## Language data {#language-data}
import LanguageData101 from 'usage/101/\_language-data.mdx' import LanguageData101 from 'usage/101/_language-data.mdx'
<LanguageData101 /> <LanguageData101 />
@ -513,10 +517,11 @@ via the following platforms:
questions** and everything related to problems with your specific code. The questions** and everything related to problems with your specific code. The
Stack Overflow community is much larger than ours, so if your problem can be Stack Overflow community is much larger than ours, so if your problem can be
solved by others, you'll receive help much quicker. solved by others, you'll receive help much quicker.
- [GitHub discussions](https://github.com/explosion/spaCy/discussions): **General - [GitHub discussions](https://github.com/explosion/spaCy/discussions):
discussion**, **project ideas** and **usage questions**. Meet other community **General discussion**, **project ideas** and **usage questions**. Meet other
members to get help with a specific code implementation, discuss ideas for new community members to get help with a specific code implementation, discuss
projects/plugins, support more languages, and share best practices. ideas for new projects/plugins, support more languages, and share best
practices.
- [GitHub issue tracker](https://github.com/explosion/spaCy/issues): **Bug - [GitHub issue tracker](https://github.com/explosion/spaCy/issues): **Bug
reports** and **improvement suggestions**, i.e. everything that's likely reports** and **improvement suggestions**, i.e. everything that's likely
spaCy's fault. This also includes problems with the trained pipelines beyond spaCy's fault. This also includes problems with the trained pipelines beyond
@ -588,7 +593,8 @@ project is using spaCy, you can grab one of our **spaCy badges** here:
[![Built with spaCy](https://img.shields.io/badge/built%20with-spaCy-09a3d5.svg)](https://spacy.io) [![Built with spaCy](https://img.shields.io/badge/built%20with-spaCy-09a3d5.svg)](https://spacy.io)
``` ```
<img src={`https://img.shields.io/badge/made%20with%20❤%20and-spaCy-09a3d5.svg`} <img
src={`https://img.shields.io/badge/made%20with%20❤%20and-spaCy-09a3d5.svg`}
/> />
```markdown ```markdown

View File

@ -17,7 +17,7 @@ menu:
## Introduction to training {#basics hidden="true"} ## Introduction to training {#basics hidden="true"}
import Training101 from 'usage/101/\_training.mdx' import Training101 from 'usage/101/_training.mdx'
<Training101 /> <Training101 />

View File

@ -180,9 +180,9 @@ entirely **in Markdown**, without having to compromise on easy-to-use custom UI
components. We're hoping that the Markdown source will make it even easier to components. We're hoping that the Markdown source will make it even easier to
contribute to the documentation. For more details, check out the contribute to the documentation. For more details, check out the
[styleguide](/styleguide) and [styleguide](/styleguide) and
[source](https://github.com/explosion/spacy/tree/v2.x/website). While [source](https://github.com/explosion/spacy/tree/v2.x/website). While converting
converting the pages to Markdown, we've also fixed a bunch of typos, improved the pages to Markdown, we've also fixed a bunch of typos, improved the existing
the existing pages and added some new content: pages and added some new content:
- **Usage Guide:** [Rule-based Matching](/usage/rule-based-matching)<br/>How to - **Usage Guide:** [Rule-based Matching](/usage/rule-based-matching)<br/>How to
use the `Matcher`, `PhraseMatcher` and the new `EntityRuler`, and write use the `Matcher`, `PhraseMatcher` and the new `EntityRuler`, and write

View File

@ -79,7 +79,11 @@ displacy.serve(doc, style="span", options={"spans_key": "custom"})
import DisplacySpanHtml from 'images/displacy-span.html' import DisplacySpanHtml from 'images/displacy-span.html'
<Iframe title="displaCy visualizer for overlapping spans" html={DisplacySpanHtml} height={180} /> <Iframe
title="displaCy visualizer for overlapping spans"
html={DisplacySpanHtml}
height={180}
/>
## Additional features and improvements ## Additional features and improvements

View File

@ -64,7 +64,7 @@ All CNN pipelines have been extended with whitespace augmentation.
The English CNN pipelines have new word vectors: The English CNN pipelines have new word vectors:
| Package | Model Version | TAG | Parser LAS | NER F | | Package | Model Version | TAG | Parser LAS | NER F |
| ----------------------------------------------- | ------------- | ---: | ---------: | ----: | | --------------------------------------------- | ------------- | ---: | ---------: | ----: |
| [`en_core_web_md`](/models/en#en_core_web_md) | v3.3.0 | 97.3 | 90.1 | 84.6 | | [`en_core_web_md`](/models/en#en_core_web_md) | v3.3.0 | 97.3 | 90.1 | 84.6 |
| [`en_core_web_md`](/models/en#en_core_web_md) | v3.4.0 | 97.2 | 90.3 | 85.5 | | [`en_core_web_md`](/models/en#en_core_web_md) | v3.4.0 | 97.2 | 90.3 | 85.5 |
| [`en_core_web_lg`](/models/en#en_core_web_lg) | v3.3.0 | 97.4 | 90.1 | 85.3 | | [`en_core_web_lg`](/models/en#en_core_web_lg) | v3.3.0 | 97.4 | 90.1 | 85.3 |

View File

@ -88,7 +88,7 @@ giving you access to thousands of pretrained models for your pipelines.
![Pipeline components listening to shared embedding component](../images/tok2vec-listener.svg) ![Pipeline components listening to shared embedding component](../images/tok2vec-listener.svg)
import Benchmarks from 'usage/\_benchmarks-models.mdx' import Benchmarks from 'usage/_benchmarks-models.mdx'
<Benchmarks /> <Benchmarks />

View File

@ -118,12 +118,16 @@ displacy.serve(doc, style="ent")
import DisplacyEntHtml from 'images/displacy-ent2.html' import DisplacyEntHtml from 'images/displacy-ent2.html'
<Iframe title="displaCy visualizer for entities" html={DisplacyEntHtml} height={180} /> <Iframe
title="displaCy visualizer for entities"
html={DisplacyEntHtml}
height={180}
/>
The entity visualizer lets you customize the following `options`: The entity visualizer lets you customize the following `options`:
| Argument | Description | | Argument | Description |
| -------- | ------------------------------------------------------------------------------------------------------------- | | -------- | ------------------------------------------------------------------------------------------------------------- | ------ |
| `ents` | Entity types to highlight (`None` for all types). Defaults to `None`. ~~Optional[List[str]]~~ | `None` | | `ents` | Entity types to highlight (`None` for all types). Defaults to `None`. ~~Optional[List[str]]~~ | `None` |
| `colors` | Color overrides. Entity types should be mapped to color names or values. Defaults to `{}`. ~~Dict[str, str]~~ | | `colors` | Color overrides. Entity types should be mapped to color names or values. Defaults to `{}`. ~~Dict[str, str]~~ |
@ -145,7 +149,11 @@ use the `colors` setting to add your own colors for them.
import DisplacyEntCustomHtml from 'images/displacy-ent-custom.html' import DisplacyEntCustomHtml from 'images/displacy-ent-custom.html'
<Iframe title="displaCy visualizer for entities (custom styling)" html={DisplacyEntCustomHtml} height={225} /> <Iframe
title="displaCy visualizer for entities (custom styling)"
html={DisplacyEntCustomHtml}
height={225}
/>
The above example uses a little trick: Since the background color values are The above example uses a little trick: Since the background color values are
added as the `background` style attribute, you can use any added as the `background` style attribute, you can use any
@ -193,8 +201,11 @@ displacy.serve(doc, style="span")
import DisplacySpanHtml from 'images/displacy-span.html' import DisplacySpanHtml from 'images/displacy-span.html'
<Iframe title="displaCy visualizer for overlapping spans" html={DisplacySpanHtml} height={180} /> <Iframe
title="displaCy visualizer for overlapping spans"
html={DisplacySpanHtml}
height={180}
/>
The span visualizer lets you customize the following `options`: The span visualizer lets you customize the following `options`:
@ -205,8 +216,8 @@ The span visualizer lets you customize the following `options`:
| `kb_url_template` | Optional template to construct the KB url for the entity to link to. Expects a python f-string format with single field to fill in ~~Optional[str]~~ | | `kb_url_template` | Optional template to construct the KB url for the entity to link to. Expects a python f-string format with single field to fill in ~~Optional[str]~~ |
| `colors` | Color overrides. Entity types should be mapped to color names or values. ~~Dict[str, str]~~ | | `colors` | Color overrides. Entity types should be mapped to color names or values. ~~Dict[str, str]~~ |
Because spans can be stored across different keys in `doc.spans`, you need to specify Because spans can be stored across different keys in `doc.spans`, you need to
which one displaCy should use with `spans_key` (`sc` is the default). specify which one displaCy should use with `spans_key` (`sc` is the default).
> #### Options example > #### Options example
> >
@ -214,12 +225,15 @@ which one displaCy should use with `spans_key` (`sc` is the default).
> doc.spans["custom"] = [Span(doc, 3, 6, "BANK")] > doc.spans["custom"] = [Span(doc, 3, 6, "BANK")]
> options = {"spans_key": "custom"} > options = {"spans_key": "custom"}
> displacy.serve(doc, style="span", options=options) > displacy.serve(doc, style="span", options=options)
> ```
import DisplacySpanCustomHtml from 'images/displacy-span-custom.html' import DisplacySpanCustomHtml from 'images/displacy-span-custom.html'
<Iframe title="displaCy visualizer for spans (custom spans_key)" html={DisplacySpanCustomHtml} height={225} /> <Iframe
title="displaCy visualizer for spans (custom spans_key)"
html={DisplacySpanCustomHtml}
height={225}
/>
## Using displaCy in Jupyter notebooks {#jupyter} ## Using displaCy in Jupyter notebooks {#jupyter}
@ -343,11 +357,11 @@ want to visualize output from other libraries, like [NLTK](http://www.nltk.org)
or or
[SyntaxNet](https://github.com/tensorflow/models/tree/master/research/syntaxnet). [SyntaxNet](https://github.com/tensorflow/models/tree/master/research/syntaxnet).
If you set `manual=True` on either `render()` or `serve()`, you can pass in data If you set `manual=True` on either `render()` or `serve()`, you can pass in data
in displaCy's format as a dictionary (instead of `Doc` objects). There are helper in displaCy's format as a dictionary (instead of `Doc` objects). There are
functions for converting `Doc` objects to displaCy's format for use with `manual=True`: helper functions for converting `Doc` objects to displaCy's format for use with
[`displacy.parse_deps`](/api/top-level#displacy.parse_deps), `manual=True`: [`displacy.parse_deps`](/api/top-level#displacy.parse_deps),
[`displacy.parse_ents`](/api/top-level#displacy.parse_ents), [`displacy.parse_ents`](/api/top-level#displacy.parse_ents), and
and [`displacy.parse_spans`](/api/top-level#displacy.parse_spans). [`displacy.parse_spans`](/api/top-level#displacy.parse_spans).
> #### Example with parse function > #### Example with parse function
> >
@ -366,7 +380,6 @@ and [`displacy.parse_spans`](/api/top-level#displacy.parse_spans).
> html = displacy.render(ex, style="ent", manual=True) > html = displacy.render(ex, style="ent", manual=True)
> ``` > ```
```python ```python
### DEP input ### DEP input
{ {

View File

@ -101,19 +101,19 @@ exports.createPages = ({ graphql, actions }) => {
} }
} }
` `
).then(result => { ).then((result) => {
if (result.errors) { if (result.errors) {
console.log(result.errors) console.log(result.errors)
reject(result.errors) reject(result.errors)
} }
const sectionData = result.data.site.siteMetadata.sections const sectionData = result.data.site.siteMetadata.sections
const sections = Object.assign({}, ...sectionData.map(s => ({ [s.id]: s }))) const sections = Object.assign({}, ...sectionData.map((s) => ({ [s.id]: s })))
/* Regular pages */ /* Regular pages */
const pages = result.data.allFile.edges const pages = result.data.allFile.edges
pages.forEach(page => { pages.forEach((page) => {
const { name } = path.parse(page.node.absolutePath) const { name } = path.parse(page.node.absolutePath)
if (!name.startsWith('_')) { if (!name.startsWith('_')) {
const mdx = page.node.childMdx || {} const mdx = page.node.childMdx || {}
@ -184,7 +184,7 @@ exports.createPages = ({ graphql, actions }) => {
}) })
const universe = result.data.site.siteMetadata.universe.resources const universe = result.data.site.siteMetadata.universe.resources
universe.forEach(page => { universe.forEach((page) => {
const slug = `/universe/project/${page.id}` const slug = `/universe/project/${page.id}`
createPage({ createPage({
@ -203,8 +203,11 @@ exports.createPages = ({ graphql, actions }) => {
}) })
const universeCategories = result.data.site.siteMetadata.universe.categories const universeCategories = result.data.site.siteMetadata.universe.categories
const categories = [].concat.apply([], universeCategories.map(cat => cat.items)) const categories = [].concat.apply(
categories.forEach(page => { [],
universeCategories.map((cat) => cat.items)
)
categories.forEach((page) => {
const slug = `/universe/category/${page.id}` const slug = `/universe/category/${page.id}`
createPage({ createPage({

View File

@ -36,12 +36,7 @@
"name": "Catalan", "name": "Catalan",
"example": "Això és una frase.", "example": "Això és una frase.",
"has_examples": true, "has_examples": true,
"models": [ "models": ["ca_core_news_sm", "ca_core_news_md", "ca_core_news_lg", "ca_core_news_trf"]
"ca_core_news_sm",
"ca_core_news_md",
"ca_core_news_lg",
"ca_core_news_trf"
]
}, },
{ {
"code": "cs", "code": "cs",
@ -53,22 +48,12 @@
"name": "Danish", "name": "Danish",
"example": "Dette er en sætning.", "example": "Dette er en sætning.",
"has_examples": true, "has_examples": true,
"models": [ "models": ["da_core_news_sm", "da_core_news_md", "da_core_news_lg", "da_core_news_trf"]
"da_core_news_sm",
"da_core_news_md",
"da_core_news_lg",
"da_core_news_trf"
]
}, },
{ {
"code": "de", "code": "de",
"name": "German", "name": "German",
"models": [ "models": ["de_core_news_sm", "de_core_news_md", "de_core_news_lg", "de_dep_news_trf"],
"de_core_news_sm",
"de_core_news_md",
"de_core_news_lg",
"de_dep_news_trf"
],
"example": "Dies ist ein Satz.", "example": "Dies ist ein Satz.",
"has_examples": true "has_examples": true
}, },
@ -80,35 +65,21 @@
{ {
"code": "el", "code": "el",
"name": "Greek", "name": "Greek",
"models": [ "models": ["el_core_news_sm", "el_core_news_md", "el_core_news_lg"],
"el_core_news_sm",
"el_core_news_md",
"el_core_news_lg"
],
"example": "Αυτή είναι μια πρόταση.", "example": "Αυτή είναι μια πρόταση.",
"has_examples": true "has_examples": true
}, },
{ {
"code": "en", "code": "en",
"name": "English", "name": "English",
"models": [ "models": ["en_core_web_sm", "en_core_web_md", "en_core_web_lg", "en_core_web_trf"],
"en_core_web_sm",
"en_core_web_md",
"en_core_web_lg",
"en_core_web_trf"
],
"example": "This is a sentence.", "example": "This is a sentence.",
"has_examples": true "has_examples": true
}, },
{ {
"code": "es", "code": "es",
"name": "Spanish", "name": "Spanish",
"models": [ "models": ["es_core_news_sm", "es_core_news_md", "es_core_news_lg", "es_dep_news_trf"],
"es_core_news_sm",
"es_core_news_md",
"es_core_news_lg",
"es_dep_news_trf"
],
"example": "Esto es una frase.", "example": "Esto es una frase.",
"has_examples": true "has_examples": true
}, },
@ -130,21 +101,12 @@
"code": "fi", "code": "fi",
"name": "Finnish", "name": "Finnish",
"has_examples": true, "has_examples": true,
"models": [ "models": ["fi_core_news_sm", "fi_core_news_md", "fi_core_news_lg"]
"fi_core_news_sm",
"fi_core_news_md",
"fi_core_news_lg"
]
}, },
{ {
"code": "fr", "code": "fr",
"name": "French", "name": "French",
"models": [ "models": ["fr_core_news_sm", "fr_core_news_md", "fr_core_news_lg", "fr_dep_news_trf"],
"fr_core_news_sm",
"fr_core_news_md",
"fr_core_news_lg",
"fr_dep_news_trf"
],
"example": "C'est une phrase.", "example": "C'est une phrase.",
"has_examples": true "has_examples": true
}, },
@ -178,11 +140,7 @@
"code": "hr", "code": "hr",
"name": "Croatian", "name": "Croatian",
"has_examples": true, "has_examples": true,
"models": [ "models": ["hr_core_news_sm", "hr_core_news_md", "hr_core_news_lg"]
"hr_core_news_sm",
"hr_core_news_md",
"hr_core_news_lg"
]
}, },
{ {
"code": "hsb", "code": "hsb",
@ -213,23 +171,14 @@
{ {
"code": "it", "code": "it",
"name": "Italian", "name": "Italian",
"models": [ "models": ["it_core_news_sm", "it_core_news_md", "it_core_news_lg"],
"it_core_news_sm",
"it_core_news_md",
"it_core_news_lg"
],
"example": "Questa è una frase.", "example": "Questa è una frase.",
"has_examples": true "has_examples": true
}, },
{ {
"code": "ja", "code": "ja",
"name": "Japanese", "name": "Japanese",
"models": [ "models": ["ja_core_news_sm", "ja_core_news_md", "ja_core_news_lg", "ja_core_news_trf"],
"ja_core_news_sm",
"ja_core_news_md",
"ja_core_news_lg",
"ja_core_news_trf"
],
"dependencies": [ "dependencies": [
{ {
"name": "SudachiPy", "name": "SudachiPy",
@ -263,11 +212,7 @@
], ],
"example": "이것은 문장입니다.", "example": "이것은 문장입니다.",
"has_examples": true, "has_examples": true,
"models": [ "models": ["ko_core_news_sm", "ko_core_news_md", "ko_core_news_lg"]
"ko_core_news_sm",
"ko_core_news_md",
"ko_core_news_lg"
]
}, },
{ {
"code": "ky", "code": "ky",
@ -299,11 +244,7 @@
"code": "lt", "code": "lt",
"name": "Lithuanian", "name": "Lithuanian",
"has_examples": true, "has_examples": true,
"models": [ "models": ["lt_core_news_sm", "lt_core_news_md", "lt_core_news_lg"]
"lt_core_news_sm",
"lt_core_news_md",
"lt_core_news_lg"
]
}, },
{ {
"code": "lv", "code": "lv",
@ -312,11 +253,7 @@
{ {
"code": "mk", "code": "mk",
"name": "Macedonian", "name": "Macedonian",
"models": [ "models": ["mk_core_news_sm", "mk_core_news_md", "mk_core_news_lg"]
"mk_core_news_sm",
"mk_core_news_md",
"mk_core_news_lg"
]
}, },
{ {
"code": "ml", "code": "ml",
@ -332,11 +269,7 @@
"name": "Norwegian Bokmål", "name": "Norwegian Bokmål",
"example": "Dette er en setning.", "example": "Dette er en setning.",
"has_examples": true, "has_examples": true,
"models": [ "models": ["nb_core_news_sm", "nb_core_news_md", "nb_core_news_lg"]
"nb_core_news_sm",
"nb_core_news_md",
"nb_core_news_lg"
]
}, },
{ {
"code": "ne", "code": "ne",
@ -346,11 +279,7 @@
{ {
"code": "nl", "code": "nl",
"name": "Dutch", "name": "Dutch",
"models": [ "models": ["nl_core_news_sm", "nl_core_news_md", "nl_core_news_lg"],
"nl_core_news_sm",
"nl_core_news_md",
"nl_core_news_lg"
],
"example": "Dit is een zin.", "example": "Dit is een zin.",
"has_examples": true "has_examples": true
}, },
@ -359,20 +288,12 @@
"name": "Polish", "name": "Polish",
"example": "To jest zdanie.", "example": "To jest zdanie.",
"has_examples": true, "has_examples": true,
"models": [ "models": ["pl_core_news_sm", "pl_core_news_md", "pl_core_news_lg"]
"pl_core_news_sm",
"pl_core_news_md",
"pl_core_news_lg"
]
}, },
{ {
"code": "pt", "code": "pt",
"name": "Portuguese", "name": "Portuguese",
"models": [ "models": ["pt_core_news_sm", "pt_core_news_md", "pt_core_news_lg"],
"pt_core_news_sm",
"pt_core_news_md",
"pt_core_news_lg"
],
"example": "Esta é uma frase.", "example": "Esta é uma frase.",
"has_examples": true "has_examples": true
}, },
@ -381,11 +302,7 @@
"name": "Romanian", "name": "Romanian",
"example": "Aceasta este o propoziție.", "example": "Aceasta este o propoziție.",
"has_examples": true, "has_examples": true,
"models": [ "models": ["ro_core_news_sm", "ro_core_news_md", "ro_core_news_lg"]
"ro_core_news_sm",
"ro_core_news_md",
"ro_core_news_lg"
]
}, },
{ {
"code": "ru", "code": "ru",
@ -397,11 +314,7 @@
"url": "https://github.com/no-plagiarism/pymorphy3" "url": "https://github.com/no-plagiarism/pymorphy3"
} }
], ],
"models": [ "models": ["ru_core_news_sm", "ru_core_news_md", "ru_core_news_lg"]
"ru_core_news_sm",
"ru_core_news_md",
"ru_core_news_lg"
]
}, },
{ {
"code": "sa", "code": "sa",
@ -438,11 +351,7 @@
"code": "sv", "code": "sv",
"name": "Swedish", "name": "Swedish",
"has_examples": true, "has_examples": true,
"models": [ "models": ["sv_core_news_sm", "sv_core_news_md", "sv_core_news_lg"]
"sv_core_news_sm",
"sv_core_news_md",
"sv_core_news_lg"
]
}, },
{ {
"code": "ta", "code": "ta",
@ -496,12 +405,7 @@
"code": "uk", "code": "uk",
"name": "Ukrainian", "name": "Ukrainian",
"has_examples": true, "has_examples": true,
"models": [ "models": ["uk_core_news_sm", "uk_core_news_md", "uk_core_news_lg", "uk_core_news_trf"],
"uk_core_news_sm",
"uk_core_news_md",
"uk_core_news_lg",
"uk_core_news_trf"
],
"dependencies": [ "dependencies": [
{ {
"name": "pymorphy3", "name": "pymorphy3",
@ -532,10 +436,7 @@
{ {
"code": "xx", "code": "xx",
"name": "Multi-language", "name": "Multi-language",
"models": [ "models": ["xx_ent_wiki_sm", "xx_sent_ud_sm"],
"xx_ent_wiki_sm",
"xx_sent_ud_sm"
],
"example": "This is a sentence about Facebook." "example": "This is a sentence about Facebook."
}, },
{ {
@ -546,12 +447,7 @@
{ {
"code": "zh", "code": "zh",
"name": "Chinese", "name": "Chinese",
"models": [ "models": ["zh_core_web_sm", "zh_core_web_md", "zh_core_web_lg", "zh_core_web_trf"],
"zh_core_web_sm",
"zh_core_web_md",
"zh_core_web_lg",
"zh_core_web_trf"
],
"dependencies": [ "dependencies": [
{ {
"name": "Jieba", "name": "Jieba",

View File

@ -60,12 +60,8 @@
"github": "Ce11an", "github": "Ce11an",
"website": "https://www.linkedin.com/in/cellan-hall/" "website": "https://www.linkedin.com/in/cellan-hall/"
}, },
"category": [ "category": ["extension"],
"extension" "tags": ["text-processing"]
],
"tags": [
"text-processing"
]
}, },
{ {
"id": "Zshot", "id": "Zshot",
@ -195,9 +191,7 @@
"description": "Aim-spaCy helps to easily collect, store and explore training logs for spaCy, including: hyper-parameters, metrics and displaCy visualizations", "description": "Aim-spaCy helps to easily collect, store and explore training logs for spaCy, including: hyper-parameters, metrics and displaCy visualizations",
"github": "aimhubio/aim-spacy", "github": "aimhubio/aim-spacy",
"pip": "aim-spacy", "pip": "aim-spacy",
"code_example": [ "code_example": ["https://github.com/aimhubio/aim-spacy/tree/master/examples"],
"https://github.com/aimhubio/aim-spacy/tree/master/examples"
],
"code_language": "python", "code_language": "python",
"url": "https://aimstack.io/spacy", "url": "https://aimstack.io/spacy",
"thumb": "https://user-images.githubusercontent.com/13848158/172912427-ee9327ea-3cd8-47fa-8427-6c0d36cd831f.png", "thumb": "https://user-images.githubusercontent.com/13848158/172912427-ee9327ea-3cd8-47fa-8427-6c0d36cd831f.png",
@ -266,7 +260,7 @@
"code_language": "python", "code_language": "python",
"author": "Peter Baumgartner", "author": "Peter Baumgartner",
"author_links": { "author_links": {
"twitter" : "pmbaumgartner", "twitter": "pmbaumgartner",
"github": "pmbaumgartner", "github": "pmbaumgartner",
"website": "https://www.peterbaumgartner.com/" "website": "https://www.peterbaumgartner.com/"
}, },
@ -286,7 +280,7 @@
"code_language": "python", "code_language": "python",
"author": "Explosion", "author": "Explosion",
"author_links": { "author_links": {
"twitter" : "explosion_ai", "twitter": "explosion_ai",
"github": "explosion", "github": "explosion",
"website": "https://explosion.ai/" "website": "https://explosion.ai/"
}, },
@ -748,7 +742,7 @@
"code_language": "python", "code_language": "python",
"author": "Keith Rozario", "author": "Keith Rozario",
"author_links": { "author_links": {
"twitter" : "keithrozario", "twitter": "keithrozario",
"github": "keithrozario", "github": "keithrozario",
"website": "https://www.keithrozario.com" "website": "https://www.keithrozario.com"
}, },
@ -2664,10 +2658,7 @@
"github": "davidberenstein1957", "github": "davidberenstein1957",
"website": "https://www.linkedin.com/in/david-berenstein-1bab11105/" "website": "https://www.linkedin.com/in/david-berenstein-1bab11105/"
}, },
"category": [ "category": ["pipeline", "standalone"],
"pipeline",
"standalone"
],
"tags": [ "tags": [
"classification", "classification",
"zero-shot", "zero-shot",
@ -2720,14 +2711,8 @@
"github": "davidberenstein1957", "github": "davidberenstein1957",
"website": "https://www.linkedin.com/in/david-berenstein-1bab11105/" "website": "https://www.linkedin.com/in/david-berenstein-1bab11105/"
}, },
"category": [ "category": ["pipeline"],
"pipeline" "tags": ["ner", "few-shot", "gensim"],
],
"tags": [
"ner",
"few-shot",
"gensim"
],
"spacy_version": 3 "spacy_version": 3
}, },
{ {
@ -2778,16 +2763,8 @@
"github": "davidberenstein1957", "github": "davidberenstein1957",
"website": "https://www.linkedin.com/in/david-berenstein-1bab11105/" "website": "https://www.linkedin.com/in/david-berenstein-1bab11105/"
}, },
"category": [ "category": ["pipeline", "standalone"],
"pipeline", "tags": ["coreference", "multi-lingual", "cross-lingual", "allennlp"],
"standalone"
],
"tags": [
"coreference",
"multi-lingual",
"cross-lingual",
"allennlp"
],
"spacy_version": 3 "spacy_version": 3
}, },
{ {
@ -2952,7 +2929,7 @@
"description": "Collection of NLP visualizations for NER and syntax tree markup. Similar to [displaCy](https://explosion.ai/demos/displacy) and [displaCy ENT](https://explosion.ai/demos/displacy-ent).", "description": "Collection of NLP visualizations for NER and syntax tree markup. Similar to [displaCy](https://explosion.ai/demos/displacy) and [displaCy ENT](https://explosion.ai/demos/displacy-ent).",
"github": "natasha/ipymarkup", "github": "natasha/ipymarkup",
"image": "https://github.com/natasha/ipymarkup/blob/master/table.png?raw=true", "image": "https://github.com/natasha/ipymarkup/blob/master/table.png?raw=true",
"pip":"pip install ipymarkup", "pip": "pip install ipymarkup",
"code_example": [ "code_example": [
"from ipymarkup import show_span_ascii_markup, show_dep_ascii_markup", "from ipymarkup import show_span_ascii_markup, show_dep_ascii_markup",
"", "",
@ -3715,7 +3692,15 @@
"website": "https://brucewlee.github.io/" "website": "https://brucewlee.github.io/"
}, },
"category": ["research", "scientific"], "category": ["research", "scientific"],
"tags": ["Readability", "Simplification", "Feature Extraction", "Syntax", "Discourse", "Semantics", "Lexical"] "tags": [
"Readability",
"Simplification",
"Feature Extraction",
"Syntax",
"Discourse",
"Semantics",
"Lexical"
]
}, },
{ {
"id": "hmrb", "id": "hmrb",
@ -4063,7 +4048,6 @@
"github": "yasufumy" "github": "yasufumy"
} }
} }
], ],
"categories": [ "categories": [

View File

@ -34,7 +34,7 @@ export default function Accordion({ title, id, expanded = false, spaced = false,
to={`#${id}`} to={`#${id}`}
className={classes.anchor} className={classes.anchor}
hidden hidden
onClick={event => event.stopPropagation()} onClick={(event) => event.stopPropagation()}
> >
&para; &para;
</Link> </Link>

View File

@ -16,13 +16,13 @@ import classes from '../styles/code.module.sass'
const WRAP_THRESHOLD = 30 const WRAP_THRESHOLD = 30
const CLI_GROUPS = ['init', 'debug', 'project', 'ray', 'huggingface-hub'] const CLI_GROUPS = ['init', 'debug', 'project', 'ray', 'huggingface-hub']
export default props => ( export default (props) => (
<Pre> <Pre>
<Code {...props} /> <Code {...props} />
</Pre> </Pre>
) )
export const Pre = props => { export const Pre = (props) => {
return <pre className={classes.pre}>{props.children}</pre> return <pre className={classes.pre}>{props.children}</pre>
} }
@ -100,7 +100,7 @@ function replacePrompt(line, prompt, isFirst = false) {
} }
function parseArgs(raw) { function parseArgs(raw) {
let args = raw.split(' ').filter(arg => arg) let args = raw.split(' ').filter((arg) => arg)
const result = {} const result = {}
while (args.length) { while (args.length) {
let opt = args.shift() let opt = args.shift()
@ -167,7 +167,7 @@ function formatCode(html, lang, prompt) {
const lines = html const lines = html
.trim() .trim()
.split('\n') .split('\n')
.map(line => .map((line) =>
line line
.split(' | ') .split(' | ')
.map((l, i) => convertLine(l, i)) .map((l, i) => convertLine(l, i))
@ -233,17 +233,8 @@ export class Code extends React.Component {
} }
render() { render() {
const { const { lang, title, executable, github, prompt, wrap, highlight, className, children } =
lang, this.props
title,
executable,
github,
prompt,
wrap,
highlight,
className,
children,
} = this.props
const codeClassNames = classNames(classes.code, className, `language-${lang}`, { const codeClassNames = classNames(classes.code, className, `language-${lang}`, {
[classes.wrap]: !!highlight || !!wrap || lang === 'cli', [classes.wrap]: !!highlight || !!wrap || lang === 'cli',
[classes.cli]: lang === 'cli', [classes.cli]: lang === 'cli',
@ -263,7 +254,7 @@ export class Code extends React.Component {
} }
const codeText = Array.isArray(children) ? children.join('') : children || '' const codeText = Array.isArray(children) ? children.join('') : children || ''
const highlightRange = highlight ? rangeParser.parse(highlight).filter(n => n > 0) : [] const highlightRange = highlight ? rangeParser.parse(highlight).filter((n) => n > 0) : []
const rawHtml = ['none', 'cli'].includes(lang) const rawHtml = ['none', 'cli'].includes(lang)
? codeText ? codeText
: highlightCode(lang, codeText, highlightRange) : highlightCode(lang, codeText, highlightRange)
@ -280,7 +271,7 @@ export class Code extends React.Component {
const JuniperWrapper = ({ Juniper, title, lang, children }) => ( const JuniperWrapper = ({ Juniper, title, lang, children }) => (
<StaticQuery <StaticQuery
query={query} query={query}
render={data => { render={(data) => {
const { binderUrl, binderBranch, binderVersion } = data.site.siteMetadata const { binderUrl, binderBranch, binderVersion } = data.site.siteMetadata
const juniperTitle = title || 'Editable Code' const juniperTitle = title || 'Editable Code'
return ( return (

View File

@ -13,7 +13,7 @@ export default function Footer({ wide = false }) {
return ( return (
<StaticQuery <StaticQuery
query={query} query={query}
render={data => { render={(data) => {
const { companyUrl, company, footer, newsletter } = data.site.siteMetadata const { companyUrl, company, footer, newsletter } = data.site.siteMetadata
return ( return (
<footer className={classes.root}> <footer className={classes.root}>

View File

@ -27,11 +27,11 @@ const GitHubCode = ({ url, lang, errorMsg = defaultErrorMsg, className }) => {
if (!initialized) { if (!initialized) {
setCode(null) setCode(null)
fetch(rawUrl) fetch(rawUrl)
.then(res => res.text().then(text => ({ text, ok: res.ok }))) .then((res) => res.text().then((text) => ({ text, ok: res.ok })))
.then(({ text, ok }) => { .then(({ text, ok }) => {
setCode(ok ? text : errorMsg) setCode(ok ? text : errorMsg)
}) })
.catch(err => { .catch((err) => {
setCode(errorMsg) setCode(errorMsg)
console.error(err) console.error(err)
}) })

View File

@ -14,7 +14,7 @@ export default class Juniper extends React.Component {
state = { kernel: null, renderers: null, fromStorage: null } state = { kernel: null, renderers: null, fromStorage: null }
componentDidMount() { componentDidMount() {
const renderers = standardRendererFactories.filter(factory => const renderers = standardRendererFactories.filter((factory) =>
factory.mimeTypes.includes('text/latex') ? window.MathJax : true factory.mimeTypes.includes('text/latex') ? window.MathJax : true
) )
@ -52,7 +52,7 @@ export default class Juniper extends React.Component {
this.log(() => console.info('building', { binderUrl })) this.log(() => console.info('building', { binderUrl }))
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const es = new EventSource(binderUrl) const es = new EventSource(binderUrl)
es.onerror = err => { es.onerror = (err) => {
es.close() es.close()
this.log(() => console.error('failed')) this.log(() => console.error('failed'))
reject(new Error(err)) reject(new Error(err))
@ -92,7 +92,7 @@ export default class Juniper extends React.Component {
window.localStorage.setItem(this.props.storageKey, json) window.localStorage.setItem(this.props.storageKey, json)
} }
const serverSettings = ServerConnection.makeSettings(settings) const serverSettings = ServerConnection.makeSettings(settings)
return Kernel.startNew({ type: this.props.kernelType, serverSettings }).then(kernel => { return Kernel.startNew({ type: this.props.kernelType, serverSettings }).then((kernel) => {
this.log(() => console.info('ready')) this.log(() => console.info('ready'))
return kernel return kernel
}) })
@ -116,7 +116,7 @@ export default class Juniper extends React.Component {
} }
if (this.props.useBinder) { if (this.props.useBinder) {
return this.requestBinder(this.props.repo, this.props.branch, this.props.url).then( return this.requestBinder(this.props.repo, this.props.branch, this.props.url).then(
settings => this.requestKernel(settings) (settings) => this.requestKernel(settings)
) )
} }
return this.requestKernel(this.props.serverSettings) return this.requestKernel(this.props.serverSettings)
@ -173,12 +173,8 @@ export default class Juniper extends React.Component {
name: 'stdout', name: 'stdout',
text: `${action} Docker container on ${url}...`, text: `${action} Docker container on ${url}...`,
}) })
new Promise((resolve, reject) => new Promise((resolve, reject) => this.getKernel().then(resolve).catch(reject))
this.getKernel() .then((kernel) => {
.then(resolve)
.catch(reject)
)
.then(kernel => {
this.setState({ kernel }) this.setState({ kernel })
this.renderResponse(outputArea, code) this.renderResponse(outputArea, code)
}) })
@ -203,7 +199,7 @@ export default class Juniper extends React.Component {
<div className={this.props.classNames.cell}> <div className={this.props.classNames.cell}>
<div <div
className={this.props.classNames.input} className={this.props.classNames.input}
ref={x => { ref={(x) => {
this.inputRef = x this.inputRef = x
}} }}
/> />
@ -211,7 +207,7 @@ export default class Juniper extends React.Component {
{this.props.msgButton} {this.props.msgButton}
</button> </button>
<div <div
ref={x => { ref={(x) => {
this.outputRef = x this.outputRef = x
}} }}
className={this.props.classNames.output} className={this.props.classNames.output}

View File

@ -7,7 +7,8 @@ import Icon from './icon'
import classes from '../styles/link.module.sass' import classes from '../styles/link.module.sass'
import { isString, isImage } from './util' import { isString, isImage } from './util'
const internalRegex = /(http(s?)):\/\/(prodi.gy|spacy.io|irl.spacy.io|explosion.ai|course.spacy.io)/gi const internalRegex =
/(http(s?)):\/\/(prodi.gy|spacy.io|irl.spacy.io|explosion.ai|course.spacy.io)/gi
const Whitespace = ({ children }) => ( const Whitespace = ({ children }) => (
// Ensure that links are always wrapped in spaces // Ensure that links are always wrapped in spaces

View File

@ -4,8 +4,8 @@ import classNames from 'classnames'
import classes from '../styles/list.module.sass' import classes from '../styles/list.module.sass'
import { replaceEmoji } from './icon' import { replaceEmoji } from './icon'
export const Ol = props => <ol className={classes.ol} {...props} /> export const Ol = (props) => <ol className={classes.ol} {...props} />
export const Ul = props => <ul className={classes.ul} {...props} /> export const Ul = (props) => <ul className={classes.ul} {...props} />
export const Li = ({ children, emoji, ...props }) => { export const Li = ({ children, emoji, ...props }) => {
const { hasIcon, content } = replaceEmoji(children) const { hasIcon, content } = replaceEmoji(children)
const liClassNames = classNames(classes.li, { const liClassNames = classNames(classes.li, {

View File

@ -11,7 +11,7 @@ import classes from '../styles/quickstart.module.sass'
function getNewChecked(optionId, checkedForId, multiple) { function getNewChecked(optionId, checkedForId, multiple) {
if (!multiple) return [optionId] if (!multiple) return [optionId]
if (checkedForId.includes(optionId)) return checkedForId.filter(opt => opt !== optionId) if (checkedForId.includes(optionId)) return checkedForId.filter((opt) => opt !== optionId)
return [...checkedForId, optionId] return [...checkedForId, optionId]
} }
@ -42,12 +42,12 @@ const Quickstart = ({
const [copySuccess, setCopySuccess] = useState(false) const [copySuccess, setCopySuccess] = useState(false)
const [otherState, setOtherState] = useState({}) const [otherState, setOtherState] = useState({})
const setOther = (id, value) => setOtherState({ ...otherState, [id]: value }) const setOther = (id, value) => setOtherState({ ...otherState, [id]: value })
const getRawContent = ref => { const getRawContent = (ref) => {
if (rawContent !== null) return rawContent if (rawContent !== null) return rawContent
if (ref.current && ref.current.childNodes) { if (ref.current && ref.current.childNodes) {
// Select all currently visible nodes (spans and text nodes) // Select all currently visible nodes (spans and text nodes)
const result = [...ref.current.childNodes].filter(el => el.offsetParent !== null) const result = [...ref.current.childNodes].filter((el) => el.offsetParent !== null)
return result.map(el => el.textContent).join('\n') return result.map((el) => el.textContent).join('\n')
} }
return '' return ''
} }
@ -60,7 +60,7 @@ const Quickstart = ({
const getCss = (id, checkedOptions) => { const getCss = (id, checkedOptions) => {
const checkedForId = checkedOptions[id] || [] const checkedForId = checkedOptions[id] || []
const exclude = checkedForId const exclude = checkedForId
.map(value => `:not([data-quickstart-${id}="${value}"])`) .map((value) => `:not([data-quickstart-${id}="${value}"])`)
.join('') .join('')
return `[data-quickstart-results]>[data-quickstart-${id}]${exclude} {display: none}` return `[data-quickstart-results]>[data-quickstart-${id}]${exclude} {display: none}`
} }
@ -71,7 +71,7 @@ const Quickstart = ({
const initialChecked = Object.assign( const initialChecked = Object.assign(
{}, {},
...data.map(({ id, options = [] }) => ({ ...data.map(({ id, options = [] }) => ({
[id]: options.filter(option => option.checked).map(({ id }) => id), [id]: options.filter((option) => option.checked).map(({ id }) => id),
})) }))
) )
const initialStyles = Object.assign( const initialStyles = Object.assign(
@ -127,7 +127,7 @@ const Quickstart = ({
)} )}
</div> </div>
<div className={classes.fields}> <div className={classes.fields}>
{options.map(option => { {options.map((option) => {
const optionType = multiple ? 'checkbox' : 'radio' const optionType = multiple ? 'checkbox' : 'radio'
const checkedForId = checked[id] || [] const checkedForId = checked[id] || []
return ( return (
@ -298,7 +298,7 @@ const QS = ({ children, prompt = 'bash', divider = false, comment = false, ...pr
}) })
const attrs = Object.assign( const attrs = Object.assign(
{}, {},
...Object.keys(props).map(key => ({ ...Object.keys(props).map((key) => ({
[`data-quickstart-${key}`]: props[key], [`data-quickstart-${key}`]: props[key],
})) }))
) )

View File

@ -41,7 +41,7 @@ export default function SEO({
return ( return (
<StaticQuery <StaticQuery
query={query} query={query}
render={data => { render={(data) => {
const siteMetadata = data.site.siteMetadata const siteMetadata = data.site.siteMetadata
const metaDescription = description || siteMetadata.description const metaDescription = description || siteMetadata.description
const pageTitle = getPageTitle( const pageTitle = getPageTitle(

View File

@ -87,7 +87,7 @@ export default function Sidebar({ items = [], pageMenu = [], slug }) {
</Link> </Link>
{active && !!currentMenu.length && ( {active && !!currentMenu.length && (
<ul className={classes.crumbs}> <ul className={classes.crumbs}>
{currentMenu.map(crumb => { {currentMenu.map((crumb) => {
const currentActive = activeSection || currentMenu[0].id const currentActive = activeSection || currentMenu[0].id
const crumbClassNames = classNames(classes.crumb, { const crumbClassNames = classNames(classes.crumb, {
[classes.crumbActive]: currentActive === crumb.id, [classes.crumbActive]: currentActive === crumb.id,

View File

@ -36,7 +36,7 @@ export default function Title({
children, children,
...props ...props
}) { }) {
const hasApiDetails = Object.values(apiDetails || {}).some(v => v) const hasApiDetails = Object.values(apiDetails || {}).some((v) => v)
const metaIconProps = { className: classes.metaIcon, width: 18 } const metaIconProps = { className: classes.metaIcon, width: 18 }
return ( return (
<header className={classes.root}> <header className={classes.root}>

View File

@ -105,7 +105,7 @@ const Headline = ({
const headingClassNames = classNames(classes.heading, className, { const headingClassNames = classNames(classes.heading, className, {
[classes.clear]: hasAction, [classes.clear]: hasAction,
}) })
const tags = tag ? tag.split(',').map(t => t.trim()) : [] const tags = tag ? tag.split(',').map((t) => t.trim()) : []
return ( return (
<Component id={id} name={name} className={headingClassNames}> <Component id={id} name={name} className={headingClassNames}>
<Permalink id={permalink ? id : null}>{children} </Permalink> <Permalink id={permalink ? id : null}>{children} </Permalink>

View File

@ -85,9 +85,7 @@ export function htmlToReact(html) {
* @returns {Node} - The converted React elements. * @returns {Node} - The converted React elements.
*/ */
export function markdownToReact(markdown, remarkReactComponents = {}) { export function markdownToReact(markdown, remarkReactComponents = {}) {
return remark() return remark().use(remark2react, { remarkReactComponents }).processSync(markdown).contents
.use(remark2react, { remarkReactComponents })
.processSync(markdown).contents
} }
/** /**
@ -113,7 +111,7 @@ export function join(arr, delimiter = ', ') {
* @return {Object} - The converted object. * @return {Object} - The converted object.
*/ */
export function arrayToObj(arr, key) { export function arrayToObj(arr, key) {
return Object.assign({}, ...arr.map(item => ({ [item[key]]: item }))) return Object.assign({}, ...arr.map((item) => ({ [item[key]]: item })))
} }
/** /**

View File

@ -19,7 +19,7 @@ function remarkCodeBlocks(userOptions = {}) {
const options = Object.assign({}, defaultOptions, userOptions) const options = Object.assign({}, defaultOptions, userOptions)
function transformer(tree) { function transformer(tree) {
visit(tree, 'code', node => { visit(tree, 'code', (node) => {
if (node.value) { if (node.value) {
const langName = node.lang || 'none' const langName = node.lang || 'none'
const lang = options.languageAliases[langName] || langName const lang = options.languageAliases[langName] || langName

View File

@ -17,7 +17,7 @@ const defaultOptions = {
function remarkCustomAttrs(userOptions = {}) { function remarkCustomAttrs(userOptions = {}) {
const options = Object.assign({}, defaultOptions, userOptions) const options = Object.assign({}, defaultOptions, userOptions)
function transformer(tree) { function transformer(tree) {
visit(tree, null, node => { visit(tree, null, (node) => {
if (options.elements.includes(node.type)) { if (options.elements.includes(node.type)) {
if ( if (
node.children && node.children &&
@ -25,10 +25,13 @@ function remarkCustomAttrs(userOptions = {}) {
node.children[0].type === 'text' && node.children[0].type === 'text' &&
node.children[0].value node.children[0].value
) { ) {
if (node.children.length > 1 && node.children.every(el => el.type === 'text')) { if (
node.children.length > 1 &&
node.children.every((el) => el.type === 'text')
) {
// If headlines contain escaped characters, e.g. // If headlines contain escaped characters, e.g.
// Doc.\_\_init\_\_, it will be split into several nodes // Doc.\_\_init\_\_, it will be split into several nodes
const mergedText = node.children.map(el => el.value).join('') const mergedText = node.children.map((el) => el.value).join('')
node.children[0].value = mergedText node.children[0].value = mergedText
node.children = [node.children[0]] node.children = [node.children[0]]
} }

View File

@ -28,7 +28,7 @@ function remarkWrapSection(userOptions = {}) {
const headingsMap = [] const headingsMap = []
const newTree = [] const newTree = []
visit(tree, 'import', node => { visit(tree, 'import', (node) => {
// For compatibility with MDX / gatsby-mdx, make sure import nodes // For compatibility with MDX / gatsby-mdx, make sure import nodes
// are not moved further down into children (which means they're not // are not moved further down into children (which means they're not
// recognized and interpreted anymore). Add them to the very start // recognized and interpreted anymore). Add them to the very start
@ -52,7 +52,7 @@ function remarkWrapSection(userOptions = {}) {
index === headingsMap.length ? tree.children.length : headingsMap[index].index index === headingsMap.length ? tree.children.length : headingsMap[index].index
const children = tree.children const children = tree.children
.slice(sectionStartIndex, sectionEndIndex) .slice(sectionStartIndex, sectionEndIndex)
.filter(node => node.type !== 'import') .filter((node) => node.type !== 'import')
if (children.length) { if (children.length) {
const headingId = index === 0 ? 0 : headingsMap[index - 1].id const headingId = index === 0 ? 0 : headingsMap[index - 1].id

View File

@ -36,18 +36,18 @@ const Docs = ({ pageContext, children }) => (
const isModels = section === 'models' const isModels = section === 'models'
const sidebar = pageContext.sidebar const sidebar = pageContext.sidebar
? { items: pageContext.sidebar } ? { items: pageContext.sidebar }
: sidebars.find(bar => bar.section === section) : sidebars.find((bar) => bar.section === section)
let pageMenu = menu ? menu.map(([text, id]) => ({ text, id })) : [] let pageMenu = menu ? menu.map(([text, id]) => ({ text, id })) : []
if (isModels) { if (isModels) {
sidebar.items[1].items = languages sidebar.items[1].items = languages
.filter(({ models }) => models && models.length) .filter(({ models }) => models && models.length)
.sort((a, b) => a.name.localeCompare(b.name)) .sort((a, b) => a.name.localeCompare(b.name))
.map(lang => ({ .map((lang) => ({
text: lang.name, text: lang.name,
url: `/models/${lang.code}`, url: `/models/${lang.code}`,
isActive: id === lang.code, isActive: id === lang.code,
menu: lang.models.map(model => ({ menu: lang.models.map((model) => ({
text: model, text: model,
id: model, id: model,
})), })),

View File

@ -221,7 +221,7 @@ class Layout extends React.Component {
export default withMDXScope(Layout) export default withMDXScope(Layout)
export const pageQuery = graphql` export const pageQuery = graphql`
query($slug: String!) { query ($slug: String!) {
site { site {
siteMetadata { siteMetadata {
nightly nightly

View File

@ -12,7 +12,7 @@ const WrappedComponent = React.memo(({ scope = {}, components = {}, children, ..
if (!children) return null if (!children) return null
const fullScope = { React, MDXTag, ...scope } const fullScope = { React, MDXTag, ...scope }
const keys = Object.keys(fullScope) const keys = Object.keys(fullScope)
const values = keys.map(key => fullScope[key]) const values = keys.map((key) => fullScope[key])
const fn = new Function('_fn', ...keys, `${children}`) // eslint-disable-line no-new-func const fn = new Function('_fn', ...keys, `${children}`) // eslint-disable-line no-new-func
const End = fn({}, ...values) const End = fn({}, ...values)
return React.createElement(End, { components, ...props }) return React.createElement(End, { components, ...props })

View File

@ -70,8 +70,7 @@ const MODEL_META = {
pipeline: 'Active processing pipeline components in order', pipeline: 'Active processing pipeline components in order',
components: 'All processing pipeline components (including disabled components)', components: 'All processing pipeline components (including disabled components)',
sources: 'Sources of training data', sources: 'Sources of training data',
vecs: vecs: 'Word vectors included in the package. Packages that only support context vectors compute similarity via the tensors shared with the pipeline.',
'Word vectors included in the package. Packages that only support context vectors compute similarity via the tensors shared with the pipeline.',
benchmark_parser: 'Syntax accuracy', benchmark_parser: 'Syntax accuracy',
benchmark_ner: 'NER accuracy', benchmark_ner: 'NER accuracy',
benchmark_speed: 'Speed', benchmark_speed: 'Speed',
@ -113,7 +112,7 @@ function getLatestVersion(modelId, compatibility, prereleases) {
function formatVectors(data) { function formatVectors(data) {
if (!data) return 'n/a' if (!data) return 'n/a'
if (Object.values(data).every(n => n === 0)) return 'context vectors only' if (Object.values(data).every((n) => n === 0)) return 'context vectors only'
const { keys, vectors, width } = data const { keys, vectors, width } = data
if (keys >= 0) { if (keys >= 0) {
return `${abbrNum(keys)} keys, ${abbrNum(vectors)} unique vectors (${width} dimensions)` return `${abbrNum(keys)} keys, ${abbrNum(vectors)} unique vectors (${width} dimensions)`
@ -123,10 +122,10 @@ function formatVectors(data) {
} }
function formatAccuracy(data, lang) { function formatAccuracy(data, lang) {
const exclude = (lang !== "ja") ? ['speed'] : ['speed', 'morph_acc'] const exclude = lang !== 'ja' ? ['speed'] : ['speed', 'morph_acc']
if (!data) return [] if (!data) return []
return Object.keys(data) return Object.keys(data)
.map(label => { .map((label) => {
const value = data[label] const value = data[label]
return isNaN(value) || exclude.includes(label) return isNaN(value) || exclude.includes(label)
? null ? null
@ -136,14 +135,18 @@ function formatAccuracy(data, lang) {
help: MODEL_META[label], help: MODEL_META[label],
} }
}) })
.filter(item => item) .filter((item) => item)
} }
function formatDownloadLink(lang, name, version) { function formatDownloadLink(lang, name, version) {
const fullName = `${lang}_${name}-${version}` const fullName = `${lang}_${name}-${version}`
const filename = `${fullName}-py3-none-any.whl` const filename = `${fullName}-py3-none-any.whl`
const url = `https://github.com/explosion/spacy-models/releases/download/${fullName}/${filename}` const url = `https://github.com/explosion/spacy-models/releases/download/${fullName}/${filename}`
return <Link to={url} hideIcon>{filename}</Link> return (
<Link to={url} hideIcon>
{filename}
</Link>
)
} }
function formatModelMeta(data) { function formatModelMeta(data) {
@ -167,7 +170,7 @@ function formatModelMeta(data) {
} }
function formatSources(data = []) { function formatSources(data = []) {
const sources = data.map(s => (isString(s) ? { name: s } : s)) const sources = data.map((s) => (isString(s) ? { name: s } : s))
return sources.map(({ name, url, author }, i) => ( return sources.map(({ name, url, author }, i) => (
<Fragment key={i}> <Fragment key={i}>
{i > 0 && <br />} {i > 0 && <br />}
@ -179,7 +182,7 @@ function formatSources(data = []) {
function linkComponents(components = []) { function linkComponents(components = []) {
return join( return join(
components.map(c => ( components.map((c) => (
<Fragment key={c}> <Fragment key={c}>
<OptionalLink to={COMPONENT_LINKS[c]} hideIcon> <OptionalLink to={COMPONENT_LINKS[c]} hideIcon>
<InlineCode>{c}</InlineCode> <InlineCode>{c}</InlineCode>
@ -210,23 +213,23 @@ const Model = ({
const [isError, setIsError] = useState(true) const [isError, setIsError] = useState(true)
const [meta, setMeta] = useState({}) const [meta, setMeta] = useState({})
const { type, genre, size } = getModelComponents(name) const { type, genre, size } = getModelComponents(name)
const display_type = type === 'core' && (size === 'sm' || size === 'trf') ? 'core_no_vectors' : type const display_type =
const version = useMemo(() => getLatestVersion(name, compatibility, prereleases), [ type === 'core' && (size === 'sm' || size === 'trf') ? 'core_no_vectors' : type
name, const version = useMemo(
compatibility, () => getLatestVersion(name, compatibility, prereleases),
prereleases, [name, compatibility, prereleases]
]) )
useEffect(() => { useEffect(() => {
window.dispatchEvent(new Event('resize')) // scroll position for progress window.dispatchEvent(new Event('resize')) // scroll position for progress
if (!initialized && version) { if (!initialized && version) {
setIsError(false) setIsError(false)
fetch(`${baseUrl}/meta/${name}-${version}.json`) fetch(`${baseUrl}/meta/${name}-${version}.json`)
.then(res => res.json()) .then((res) => res.json())
.then(json => { .then((json) => {
setMeta(formatModelMeta(json)) setMeta(formatModelMeta(json))
}) })
.catch(err => { .catch((err) => {
setIsError(true) setIsError(true)
console.error(err) console.error(err)
}) })
@ -360,7 +363,7 @@ const Model = ({
</p> </p>
<Table fixed> <Table fixed>
<tbody> <tbody>
{Object.keys(labels).map(pipe => { {Object.keys(labels).map((pipe) => {
const labelNames = labels[pipe] || [] const labelNames = labels[pipe] || []
const help = LABEL_SCHEME_META[pipe] const help = LABEL_SCHEME_META[pipe]
return ( return (
@ -402,9 +405,9 @@ const Models = ({ pageContext, repo, children }) => {
window.dispatchEvent(new Event('resize')) // scroll position for progress window.dispatchEvent(new Event('resize')) // scroll position for progress
if (!initialized) { if (!initialized) {
fetch(`${baseUrl}/compatibility.json`) fetch(`${baseUrl}/compatibility.json`)
.then(res => res.json()) .then((res) => res.json())
.then(({ spacy }) => setCompatibility(spacy)) .then(({ spacy }) => setCompatibility(spacy))
.catch(err => console.error(err)) .catch((err) => console.error(err))
setInitialized(true) setInitialized(true)
} }
}, [initialized, baseUrl]) }, [initialized, baseUrl])
@ -415,7 +418,7 @@ const Models = ({ pageContext, repo, children }) => {
<StaticQuery <StaticQuery
query={query} query={query}
render={({ site }) => render={({ site }) =>
models.map(modelName => ( models.map((modelName) => (
<Model <Model
key={modelName} key={modelName}
name={modelName} name={modelName}

View File

@ -28,7 +28,7 @@ function getSlug(data) {
function filterResources(resources, data) { function filterResources(resources, data) {
const sorted = resources.sort((a, b) => a.id.localeCompare(b.id)) const sorted = resources.sort((a, b) => a.id.localeCompare(b.id))
if (!data || !data.isCategory) return sorted if (!data || !data.isCategory) return sorted
return sorted.filter(res => (res.category || []).includes(data.id)) return sorted.filter((res) => (res.category || []).includes(data.id))
} }
const UniverseContent = ({ content = [], categories, theme, pageContext, mdxComponents }) => { const UniverseContent = ({ content = [], categories, theme, pageContext, mdxComponents }) => {
@ -142,7 +142,13 @@ const UniverseContent = ({ content = [], categories, theme, pageContext, mdxComp
The Universe database is open-source and collected in a simple JSON file. The Universe database is open-source and collected in a simple JSON file.
For more details on the formats and available fields, see the documentation. For more details on the formats and available fields, see the documentation.
Looking for inspiration your own spaCy plugin or extension? Check out the Looking for inspiration your own spaCy plugin or extension? Check out the
<Link to={"https://github.com/explosion/spaCy/discussions/categories/new-features-project-ideas/"} hideIcon ws> <Link
to={
'https://github.com/explosion/spaCy/discussions/categories/new-features-project-ideas/'
}
hideIcon
ws
>
project idea project idea
</Link> </Link>
section in Discussions. section in Discussions.
@ -316,7 +322,7 @@ const Project = ({ data, components }) => (
{data.category && ( {data.category && (
<p style={{ marginBottom: 0 }}> <p style={{ marginBottom: 0 }}>
<Label>Categories</Label> <Label>Categories</Label>
{data.category.map(cat => ( {data.category.map((cat) => (
<Link to={`/universe/category/${cat}`} key={cat} ws> <Link to={`/universe/category/${cat}`} key={cat} ws>
<InlineCode>{cat}</InlineCode> <InlineCode>{cat}</InlineCode>
</Link> </Link>
@ -330,7 +336,7 @@ const Project = ({ data, components }) => (
const Universe = ({ pageContext, location, mdxComponents }) => ( const Universe = ({ pageContext, location, mdxComponents }) => (
<StaticQuery <StaticQuery
query={query} query={query}
render={data => { render={(data) => {
const { universe, nightly, legacy } = data.site.siteMetadata const { universe, nightly, legacy } = data.site.siteMetadata
const theme = nightly ? 'nightly' : legacy ? 'legacy' : pageContext.theme const theme = nightly ? 'nightly' : legacy ? 'legacy' : pageContext.theme
return ( return (

View File

@ -10,8 +10,8 @@ import { repo } from '../components/util'
function formatReleases(json) { function formatReleases(json) {
return Object.values(json) return Object.values(json)
.filter(release => release.name) .filter((release) => release.name)
.map(release => ({ .map((release) => ({
title: title:
release.name.split(': ').length === 2 ? release.name.split(': ')[1] : release.name, release.name.split(': ').length === 2 ? release.name.split(': ')[1] : release.name,
url: release.html_url, url: release.html_url,
@ -34,14 +34,14 @@ const Changelog = () => {
setIsError(false) setIsError(false)
setIsLoading(true) setIsLoading(true)
fetch(`https://api.github.com/repos/${repo}/releases`) fetch(`https://api.github.com/repos/${repo}/releases`)
.then(res => res.json()) .then((res) => res.json())
.then(json => { .then((json) => {
const releases = formatReleases(json) const releases = formatReleases(json)
setReleases(releases.filter(release => !release.pre)) setReleases(releases.filter((release) => !release.pre))
setPrereleases(releases.filter(release => release.pre)) setPrereleases(releases.filter((release) => release.pre))
setIsLoading(false) setIsLoading(false)
}) })
.catch(err => { .catch((err) => {
setIsLoading(false) setIsLoading(false)
setIsError(true) setIsError(true)
console.error(err) console.error(err)

View File

@ -55,10 +55,10 @@ const Languages = () => (
</Tr> </Tr>
</thead> </thead>
<tbody> <tbody>
{withModels.map(model => ( {withModels.map((model) => (
<Language {...model} key={model.code} /> <Language {...model} key={model.code} />
))} ))}
{withoutModels.map(model => ( {withoutModels.map((model) => (
<Language {...model} key={model.code} /> <Language {...model} key={model.code} />
))} ))}
</tbody> </tbody>

View File

@ -13,10 +13,10 @@ const DEFAULT_CUDA = 'cuda-autodetect'
const CUDA = { const CUDA = {
'8.0': 'cuda80', '8.0': 'cuda80',
'9.0': 'cuda90', '9.0': 'cuda90',
'9.1': 'cuda91', 9.1: 'cuda91',
'9.2': 'cuda92', 9.2: 'cuda92',
'10.0': 'cuda100', '10.0': 'cuda100',
'10.1': 'cuda101', 10.1: 'cuda101',
'10.2, 11.0+': 'cuda-autodetect', '10.2, 11.0+': 'cuda-autodetect',
} }
const LANG_EXTRAS = ['ja'] // only for languages with models const LANG_EXTRAS = ['ja'] // only for languages with models
@ -30,26 +30,26 @@ const QuickstartInstall = ({ id, title }) => {
const [selectedModels, setModels] = useState(DEFAULT_MODELS) const [selectedModels, setModels] = useState(DEFAULT_MODELS)
const [efficiency, setEfficiency] = useState(DEFAULT_OPT === 'efficiency') const [efficiency, setEfficiency] = useState(DEFAULT_OPT === 'efficiency')
const setters = { const setters = {
hardware: v => (Array.isArray(v) ? setHardware(v[0]) : setCuda(v)), hardware: (v) => (Array.isArray(v) ? setHardware(v[0]) : setCuda(v)),
config: v => setTrain(v.includes('train')), config: (v) => setTrain(v.includes('train')),
models: setModels, models: setModels,
optimize: v => setEfficiency(v.includes('efficiency')), optimize: (v) => setEfficiency(v.includes('efficiency')),
platform: v => setPlatform(v[0]), platform: (v) => setPlatform(v[0]),
os: v => setOs(v[0]), os: (v) => setOs(v[0]),
} }
const showDropdown = { const showDropdown = {
hardware: () => hardware === 'gpu', hardware: () => hardware === 'gpu',
} }
const modelExtras = train ? selectedModels.filter(m => LANG_EXTRAS.includes(m)) : [] const modelExtras = train ? selectedModels.filter((m) => LANG_EXTRAS.includes(m)) : []
const apple = os === 'mac' && platform === 'arm' const apple = os === 'mac' && platform === 'arm'
const pipExtras = [ const pipExtras = [
(hardware === 'gpu' && (platform !== 'arm' || os === 'linux')) && cuda, hardware === 'gpu' && (platform !== 'arm' || os === 'linux') && cuda,
train && 'transformers', train && 'transformers',
train && 'lookups', train && 'lookups',
apple && 'apple', apple && 'apple',
...modelExtras, ...modelExtras,
] ]
.filter(e => e) .filter((e) => e)
.join(',') .join(',')
return ( return (
<StaticQuery <StaticQuery
@ -85,7 +85,7 @@ const QuickstartInstall = ({ id, title }) => {
{ id: 'pip', title: 'pip', checked: true }, { id: 'pip', title: 'pip', checked: true },
!nightly ? { id: 'conda', title: 'conda' } : null, !nightly ? { id: 'conda', title: 'conda' } : null,
{ id: 'source', title: 'from source' }, { id: 'source', title: 'from source' },
].filter(o => o), ].filter((o) => o),
}, },
{ {
id: 'hardware', id: 'hardware',
@ -94,7 +94,7 @@ const QuickstartInstall = ({ id, title }) => {
{ id: 'cpu', title: 'CPU', checked: DEFAULT_HARDWARE === 'cpu' }, { id: 'cpu', title: 'CPU', checked: DEFAULT_HARDWARE === 'cpu' },
{ id: 'gpu', title: 'GPU', checked: DEFAULT_HARDWARE == 'gpu' }, { id: 'gpu', title: 'GPU', checked: DEFAULT_HARDWARE == 'gpu' },
], ],
dropdown: Object.keys(CUDA).map(id => ({ dropdown: Object.keys(CUDA).map((id) => ({
id: CUDA[id], id: CUDA[id],
title: `CUDA ${id}`, title: `CUDA ${id}`,
})), })),
@ -113,8 +113,7 @@ const QuickstartInstall = ({ id, title }) => {
{ {
id: 'train', id: 'train',
title: 'train models', title: 'train models',
help: help: 'Check this if you plan to train your own models with spaCy to install extra dependencies and data resources',
'Check this if you plan to train your own models with spaCy to install extra dependencies and data resources',
}, },
], ],
}, },
@ -160,7 +159,10 @@ const QuickstartInstall = ({ id, title }) => {
showDropdown={showDropdown} showDropdown={showDropdown}
> >
<QS os="mac" hardware="gpu" platform="arm"> <QS os="mac" hardware="gpu" platform="arm">
# Note M1 GPU support is experimental, see <a href="https://github.com/explosion/thinc/issues/792">Thinc issue #792</a> # Note M1 GPU support is experimental, see{' '}
<a href="https://github.com/explosion/thinc/issues/792">
Thinc issue #792
</a>
</QS> </QS>
<QS package="pip" config="venv"> <QS package="pip" config="venv">
python -m venv .env python -m venv .env
@ -220,7 +222,8 @@ const QuickstartInstall = ({ id, title }) => {
<QS package="source">cd spaCy</QS> <QS package="source">cd spaCy</QS>
<QS package="source">pip install -r requirements.txt</QS> <QS package="source">pip install -r requirements.txt</QS>
<QS package="source"> <QS package="source">
pip install --no-build-isolation --editable {train || hardware == 'gpu' ? `'.[${pipExtras}]'` : '.'} pip install --no-build-isolation --editable{' '}
{train || hardware == 'gpu' ? `'.[${pipExtras}]'` : '.'}
</QS> </QS>
<QS config="train" package="conda" comment prompt={false}> <QS config="train" package="conda" comment prompt={false}>
# packages only available via pip # packages only available via pip

View File

@ -60,7 +60,7 @@ const QuickstartInstall = ({ id, title, description, children }) => {
const [efficiency, setEfficiency] = useState(DEFAULT_OPT === 'efficiency') const [efficiency, setEfficiency] = useState(DEFAULT_OPT === 'efficiency')
const setters = { const setters = {
lang: setLang, lang: setLang,
optimize: v => setEfficiency(v.includes('efficiency')), optimize: (v) => setEfficiency(v.includes('efficiency')),
} }
return ( return (
<StaticQuery <StaticQuery

View File

@ -10,7 +10,15 @@ const DEFAULT_LANG = 'en'
const DEFAULT_HARDWARE = 'cpu' const DEFAULT_HARDWARE = 'cpu'
const DEFAULT_OPT = 'efficiency' const DEFAULT_OPT = 'efficiency'
const DEFAULT_TEXTCAT_EXCLUSIVE = true const DEFAULT_TEXTCAT_EXCLUSIVE = true
const COMPONENTS = ['tagger', 'morphologizer', 'trainable_lemmatizer', 'parser', 'ner', 'spancat', 'textcat'] const COMPONENTS = [
'tagger',
'morphologizer',
'trainable_lemmatizer',
'parser',
'ner',
'spancat',
'textcat',
]
const COMMENT = `# This is an auto-generated partial config. To use it with 'spacy train' const COMMENT = `# This is an auto-generated partial config. To use it with 'spacy train'
# you can run spacy init fill-config to auto-fill all default settings: # you can run spacy init fill-config to auto-fill all default settings:
# python -m spacy init fill-config ./base_config.cfg ./config.cfg` # python -m spacy init fill-config ./base_config.cfg ./config.cfg`
@ -25,7 +33,7 @@ const DATA = [
id: 'components', id: 'components',
title: 'Components', title: 'Components',
help: 'Pipeline components to train. Requires training data for those annotations.', help: 'Pipeline components to train. Requires training data for those annotations.',
options: COMPONENTS.map(id => ({ id, title: id })), options: COMPONENTS.map((id) => ({ id, title: id })),
multiple: true, multiple: true,
}, },
{ {
@ -52,8 +60,7 @@ const DATA = [
{ {
id: 'optimize', id: 'optimize',
title: 'Optimize for', title: 'Optimize for',
help: help: 'Optimize for efficiency (faster inference, smaller model, lower memory consumption) or higher accuracy (potentially larger & slower model). Will impact the choice of architecture, pretrained weights and hyperparameters.',
'Optimize for efficiency (faster inference, smaller model, lower memory consumption) or higher accuracy (potentially larger & slower model). Will impact the choice of architecture, pretrained weights and hyperparameters.',
options: [ options: [
{ id: 'efficiency', title: 'efficiency', checked: DEFAULT_OPT === 'efficiency' }, { id: 'efficiency', title: 'efficiency', checked: DEFAULT_OPT === 'efficiency' },
{ id: 'accuracy', title: 'accuracy', checked: DEFAULT_OPT === 'accuracy' }, { id: 'accuracy', title: 'accuracy', checked: DEFAULT_OPT === 'accuracy' },
@ -71,16 +78,18 @@ export default function QuickstartTraining({ id, title, download = 'base_config.
function updateComponents(value, isExclusive) { function updateComponents(value, isExclusive) {
_setComponents(value) _setComponents(value)
const updated = value.map(c => (c === 'textcat' && !isExclusive ? 'textcat_multilabel' : c)) const updated = value.map((c) =>
c === 'textcat' && !isExclusive ? 'textcat_multilabel' : c
)
setComponents(updated) setComponents(updated)
} }
const setters = { const setters = {
lang: setLang, lang: setLang,
components: v => updateComponents(v, textcatExclusive), components: (v) => updateComponents(v, textcatExclusive),
hardware: setHardware, hardware: setHardware,
optimize: setOptimize, optimize: setOptimize,
textcat: v => { textcat: (v) => {
const isExclusive = v.includes('exclusive') const isExclusive = v.includes('exclusive')
setTextcatExclusive(isExclusive) setTextcatExclusive(isExclusive)
updateComponents(_components, isExclusive) updateComponents(_components, isExclusive)
@ -101,7 +110,7 @@ export default function QuickstartTraining({ id, title, download = 'base_config.
const rawContent = `${COMMENT}\n${rawStr}` const rawContent = `${COMMENT}\n${rawStr}`
const displayContent = highlightCode('ini', rawContent) const displayContent = highlightCode('ini', rawContent)
.split('\n') .split('\n')
.map(line => (line.startsWith('#') ? `<span class="token comment">${line}</span>` : line)) .map((line) => (line.startsWith('#') ? `<span class="token comment">${line}</span>` : line))
.join('\n') .join('\n')
return ( return (
<StaticQuery <StaticQuery
@ -116,7 +125,7 @@ export default function QuickstartTraining({ id, title, download = 'base_config.
})) }))
.sort((a, b) => a.title.localeCompare(b.title)) .sort((a, b) => a.title.localeCompare(b.title))
if (!_components.includes('textcat')) { if (!_components.includes('textcat')) {
data = data.map(field => data = data.map((field) =>
field.id === 'textcat' ? { ...field, hidden: true } : field field.id === 'textcat' ? { ...field, hidden: true } : field
) )
} }

View File

@ -53,7 +53,7 @@ const Card = ({ style = {}, children }) => (
export const Colors = () => ( export const Colors = () => (
<Grid cols={4} narrow> <Grid cols={4} narrow>
{Object.keys(colors).map(name => ( {Object.keys(colors).map((name) => (
<Card key={name} style={{ height: 80, background: colors[name] }}> <Card key={name} style={{ height: 80, background: colors[name] }}>
<Label>{name}</Label> <Label>{name}</Label>
</Card> </Card>
@ -62,7 +62,7 @@ export const Colors = () => (
) )
export const Patterns = () => { export const Patterns = () => {
const imgStyle = name => ({ const imgStyle = (name) => ({
height: 125, height: 125,
background: `url(${patterns[name]}) center/150% repeat`, background: `url(${patterns[name]}) center/150% repeat`,
}) })
@ -70,7 +70,7 @@ export const Patterns = () => {
const linkStyle = { color: 'var(--color-dark)' } const linkStyle = { color: 'var(--color-dark)' }
return ( return (
<Grid cols={3} narrow> <Grid cols={3} narrow>
{Object.keys(patterns).map(name => ( {Object.keys(patterns).map((name) => (
<Card key={name} style={imgStyle(name)}> <Card key={name} style={imgStyle(name)}>
<Label>{name}</Label> <Label>{name}</Label>
<span style={textStyle}> <span style={textStyle}>