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,93 +2,103 @@
# spaCy Universe
The [spaCy Universe](https://spacy.io/universe) collects the many great resources developed with or for spaCy. It
includes standalone packages, plugins, extensions, educational materials,
operational utilities and bindings for other languages.
The [spaCy Universe](https://spacy.io/universe) collects the many great
resources developed with or for spaCy. It includes standalone packages, plugins,
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
suggest it by submitting a pull request to this repository. The Universe
database is open-source and collected in a simple JSON file.
Looking for inspiration for your own spaCy plugin or extension? Check out the
[`project ideas`](https://github.com/explosion/spaCy/discussions?discussions_q=category%3A%22New+Features+%26+Project+Ideas%22)
[`project ideas`](https://github.com/explosion/spaCy/discussions?discussions_q=category%3A%22New+Features+%26+Project+Ideas%22)
discussion forum.
## Checklist
### 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**.
### 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
To add a project, fork this repository, edit the [`universe.json`](meta/universe.json)
and add an object of the following format to the list of `"resources"`. Before
you submit your pull request, make sure to use a linter to verify that your
markup is correct.
To add a project, fork this repository, edit the
[`universe.json`](meta/universe.json) and add an object of the following format
to the list of `"resources"`. Before you submit your pull request, make sure to
use a linter to verify that your markup is correct.
```json
{
"id": "unique-project-id",
"title": "Project title",
"slogan": "A short summary",
"description": "A longer description *Markdown allowed!*",
"github": "user/repo",
"pip": "package-name",
"code_example": [
"import spacy",
"import package_name",
"",
"nlp = spacy.load('en')",
"nlp.add_pipe(package_name)"
],
"code_language": "python",
"url": "https://example.com",
"thumb": "https://example.com/thumb.jpg",
"image": "https://example.com/image.jpg",
"author": "Your Name",
"author_links": {
"twitter": "username",
"github": "username",
"website": "https://example.com"
},
"category": ["pipeline", "standalone"],
"tags": ["some-tag", "etc"]
"id": "unique-project-id",
"title": "Project title",
"slogan": "A short summary",
"description": "A longer description *Markdown allowed!*",
"github": "user/repo",
"pip": "package-name",
"code_example": [
"import spacy",
"import package_name",
"",
"nlp = spacy.load('en')",
"nlp.add_pipe(package_name)"
],
"code_language": "python",
"url": "https://example.com",
"thumb": "https://example.com/thumb.jpg",
"image": "https://example.com/image.jpg",
"author": "Your Name",
"author_links": {
"twitter": "username",
"github": "username",
"website": "https://example.com"
},
"category": ["pipeline", "standalone"],
"tags": ["some-tag", "etc"]
}
```
| Field | Type | Description |
| --- | --- | --- |
| `id` | string | Unique ID of the project. |
| `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. |
| `description` | string | A longer description of the project. Markdown is allowed, but should be limited to basic formatting like bold, italics, code or links. |
| `github` | string | Associated GitHub repo in the format `user/repo`. Will be displayed as a link and used for release, license and star badges. |
| `pip` | string | Package name on pip. If available, the installation command will be displayed. |
| `cran` | string | For R packages: package name on CRAN. If available, the installation command will be displayed. |
| `code_example` | array | Short example that shows how to use the project. Formatted as an array with one string per line. |
| `code_language` | string | Defaults to `'python'`. Optional code language used for syntax highlighting with [Prism](http://prismjs.com/). |
| `url` | string | Optional project link to display as button. |
| `thumb` | string | Optional URL to project thumbnail to display in overview and project header. Recommended size is 100x100px. |
| `image` | string | Optional URL to project image to display with description. |
| `author` | string | Name(s) of project author(s). |
| `author_links` | object | Usernames and links to display as icons to author info. Currently supports `twitter` and `github` usernames, as well as `website` link. |
| `category` | list | One or more categories to assign to project. Must be one of the available options. |
| `tags` | list | Still experimental and not used for filtering: one or more tags to assign to project. |
| Field | Type | Description |
| --------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------- |
| `id` | string | Unique ID of the project. |
| `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. |
| `description` | string | A longer description of the project. Markdown is allowed, but should be limited to basic formatting like bold, italics, code or links. |
| `github` | string | Associated GitHub repo in the format `user/repo`. Will be displayed as a link and used for release, license and star badges. |
| `pip` | string | Package name on pip. If available, the installation command will be displayed. |
| `cran` | string | For R packages: package name on CRAN. If available, the installation command will be displayed. |
| `code_example` | array | Short example that shows how to use the project. Formatted as an array with one string per line. |
| `code_language` | string | Defaults to `'python'`. Optional code language used for syntax highlighting with [Prism](http://prismjs.com/). |
| `url` | string | Optional project link to display as button. |
| `thumb` | string | Optional URL to project thumbnail to display in overview and project header. Recommended size is 100x100px. |
| `image` | string | Optional URL to project image to display with description. |
| `author` | string | Name(s) of project author(s). |
| `author_links` | object | Usernames and links to display as icons to author info. Currently supports `twitter` and `github` usernames, as well as `website` link. |
| `category` | list | One or more categories to assign to project. Must be one of the available options. |
| `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
`"type": "education`. Books can also set a `"cover"` field containing a URL
to a cover image. If available, it's used in the overview and displayed on
the individual book page.
`"type": "education`. Books can also set a `"cover"` field containing a URL to a
cover image. If available, it's used in the overview and displayed on the
individual book page.

View File

@ -390,7 +390,7 @@ in other components, see
| | |
<Infobox title="Mixed precision support" variant="warning">
Mixed-precision support is currently an experimental feature.
Mixed-precision support is currently an experimental feature.
</Infobox>
<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]]~~ |
<Infobox title="Mixed precision support" variant="warning">
Mixed-precision support is currently an experimental feature.
Mixed-precision support is currently an experimental feature.
</Infobox>
<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
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
accessed as `Token.attr`, e.g. `token.dep`, while the string value can be
retrieved by appending `_` as in `token.dep_`.
For attributes that represent string values, the internal integer ID is accessed
as `Token.attr`, e.g. `token.dep`, while the string value can be retrieved by
appending `_` as in `token.dep_`.
| Attribute | Description |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |

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
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
[*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>
@ -1187,7 +1187,6 @@ be provided.
> $ python -m spacy find-threshold my_nlp data.spacy spancat threshold spans_sc_f
> ```
| Name | Description |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `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 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"}
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"}
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
is typically called by [`Language.initialize`](/api/language#initialize) and
lets you customize arguments it receives via the
from a [pattern file](/usage/rule-based-matching/#entityruler-files). This
method is typically called by [`Language.initialize`](/api/language#initialize)
and lets you customize arguments it receives via the
[`[initialize.components]`](/api/data-formats#config-initialize) block in the
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]]]]~~ |
## 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
>
@ -224,9 +224,9 @@ Remove a pattern by its ID from the entity ruler. A `ValueError` is raised if th
> ruler.remove("apple")
> ```
| Name | Description |
| ---------- | ---------------------------------------------------------------- |
| `id` | The ID of the pattern rule. ~~str~~ |
| Name | Description |
| ---- | ----------------------------------- |
| `id` | The ID of the pattern rule. ~~str~~ |
## 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 are managed using `AlignmentArray`, which is a
simplified version of Thinc's [Ragged](https://thinc.ai/docs/api-types#ragged)
type that only supports the `data` and `length` attributes.
Alignment attributes are managed using `AlignmentArray`, which is a simplified
version of Thinc's [Ragged](https://thinc.ai/docs/api-types#ragged) type that
only supports the `data` and `length` attributes.
| Name | Description |
| ----- | ------------------------------------------------------------------------------------- |

View File

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

View File

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

View File

@ -105,11 +105,11 @@ representation.
## Attributes {#attributes}
| Name | Description |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `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~~ |
| `VALUE_SEP` | The [FEATS](https://universaldependencies.org/format.html#morphological-annotation) value separator. Default is `,`. ~~str~~ |
| Name | Description |
| ------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------- |
| `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~~ |
| `VALUE_SEP` | The [FEATS](https://universaldependencies.org/format.html#morphological-annotation) value separator. Default is `,`. ~~str~~ |
## MorphAnalysis {#morphanalysis tag="class" source="spacy/tokens/morphanalysis.pyx"}

View File

@ -38,7 +38,7 @@ how the component should be configured. You can override its settings via the
> ```
| 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` |
| `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]~~ |

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">
<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-tag" dy="2em" fill="currentColor" x="50"></tspan>
</text>
<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-tag" dy="2em" fill="currentColor" x="225"></tspan>
</text>
<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-tag" dy="2em" fill="currentColor" x="400"></tspan>
</text>
<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-tag" dy="2em" fill="currentColor" x="575"></tspan>
</text>
<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-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>
<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;
"
>
<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-tag" dy="2em" fill="currentColor" x="50"></tspan>
</text>
<path class="displacy-arrowhead" d="M70,266.5 L62,254.5 78,254.5" fill="currentColor"></path>
</g>
<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>
<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>
<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-tag" dy="2em" fill="currentColor" x="225"></tspan>
</text>
<path class="displacy-arrowhead" d="M420,266.5 L412,254.5 428,254.5" fill="currentColor"></path>
</g>
<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>
<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>
<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-tag" dy="2em" fill="currentColor" x="400"></tspan>
</text>
<path 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 class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5">
<tspan class="displacy-word" fill="currentColor" x="575">healthcare</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="575"></tspan>
</text>
<path class="displacy-arrowhead" d="M750.0,266.5 L758.0,254.5 742.0,254.5" fill="currentColor"></path>
</g>
<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-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>
<path
class="displacy-arrowhead"
d="M70,266.5 L62,254.5 78,254.5"
fill="currentColor"
></path>
</g>
<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>
<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>
</text>
<path
class="displacy-arrowhead"
d="M420,266.5 L412,254.5 428,254.5"
fill="currentColor"
></path>
</g>
<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>
<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>
</text>
<path
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>

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@ -1,31 +1,78 @@
<div
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
<mark
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
<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
></mark
>is starting from behind. The company made a late push into hardware, and
<mark
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
<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
></mark
>s Siri, available on iPhones, and
<mark
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
<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
></mark
>s Alexa software, which runs on its Echo and Dot devices, have clear leads in consumer

View File

@ -1,24 +1,57 @@
<div
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
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
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
></mark
>
____ 🌳🌲 ____
<mark
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
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
></mark
>

View File

@ -1,36 +1,83 @@
<div
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
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
<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
>
</mark>
is looking at buying
<mark
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.
<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
>
</mark>
startup for
<mark
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
<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
>
</mark>

View File

@ -1,37 +1,84 @@
<div
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
<mark
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
<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
>
</mark>
started working on self-driving cars at
<mark
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
<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
>
</mark>
in
<mark
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
<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
>
</mark>

View File

@ -5,7 +5,13 @@
class="displacy"
width="1975"
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">
<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">
<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-tag" dy="2em" fill="currentColor" x="50">ADJ</tspan>
</text>
<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-tag" dy="2em" fill="currentColor" x="225">NOUN</tspan>
</text>
<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-tag" dy="2em" fill="currentColor" x="400">VERB</tspan>
</text>
<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-tag" dy="2em" fill="currentColor" x="575">NOUN</tspan>
</text>
<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-tag" dy="2em" fill="currentColor" x="750">NOUN</tspan>
</text>
<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-tag" dy="2em" fill="currentColor" x="925">ADP</tspan>
</text>
<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-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>
<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;
"
>
<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-tag" dy="2em" fill="currentColor" x="50">ADJ</tspan>
</text>
<path class="displacy-arrowhead" d="M70,266.5 L62,254.5 78,254.5" fill="currentColor"></path>
</g>
<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>
<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>
<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-tag" dy="2em" fill="currentColor" x="225">NOUN</tspan>
</text>
<path class="displacy-arrowhead" d="M245,266.5 L237,254.5 253,254.5" fill="currentColor"></path>
</g>
<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>
<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>
<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-tag" dy="2em" fill="currentColor" x="400">VERB</tspan>
</text>
<path 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-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">
<textpath xlink:href="#arrow-0-3" class="displacy-label" startOffset="50%" fill="currentColor" text-anchor="middle">dobj</textpath>
<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-tag" dy="2em" fill="currentColor" x="575">NOUN</tspan>
</text>
<path class="displacy-arrowhead" d="M745.0,266.5 L753.0,254.5 737.0,254.5" fill="currentColor"></path>
</g>
<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>
<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>
<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-tag" dy="2em" fill="currentColor" x="750">NOUN</tspan>
</text>
<path 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 class="displacy-token" fill="currentColor" text-anchor="middle" y="309.5">
<tspan class="displacy-word" fill="currentColor" x="925">toward</tspan>
<tspan class="displacy-tag" dy="2em" fill="currentColor" x="925">ADP</tspan>
</text>
<path class="displacy-arrowhead" d="M1090.0,266.5 L1098.0,254.5 1082.0,254.5" fill="currentColor"></path>
</g>
<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-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>
<path
class="displacy-arrowhead"
d="M70,266.5 L62,254.5 78,254.5"
fill="currentColor"
></path>
</g>
<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>
<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>
</text>
<path
class="displacy-arrowhead"
d="M245,266.5 L237,254.5 253,254.5"
fill="currentColor"
></path>
</g>
<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>
<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>
</text>
<path
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-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">
<textpath
xlink:href="#arrow-0-3"
class="displacy-label"
startOffset="50%"
fill="currentColor"
text-anchor="middle"
>
dobj
</textpath>
</text>
<path
class="displacy-arrowhead"
d="M745.0,266.5 L753.0,254.5 737.0,254.5"
fill="currentColor"
></path>
</g>
<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>
<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>
</text>
<path
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>

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@ -1,31 +1,84 @@
<div 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">
<div
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
<span style="font-weight: bold; display: inline-block; position: relative;">
<span style="font-weight: bold; display: inline-block; position: relative">
Bank
<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
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
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
</span>
</span>
</span>
<span style="font-weight: bold; display: inline-block; position: relative;">
<span style="font-weight: bold; display: inline-block; position: relative">
of
<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 style="font-weight: bold; display: inline-block; position: relative;">
<span style="font-weight: bold; display: inline-block; position: relative">
China
<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>
.
</div>
</div>

View File

@ -1,41 +1,123 @@
<div 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">
<div
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
<span style="font-weight: bold; display: inline-block; position: relative;">
<span style="font-weight: bold; display: inline-block; position: relative">
Bank
<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
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
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
</span>
</span>
</span>
<span style="font-weight: bold; display: inline-block; position: relative;">
<span style="font-weight: bold; display: inline-block; position: relative">
of
<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 style="font-weight: bold; display: inline-block; position: relative;">
<span style="font-weight: bold; display: inline-block; position: relative">
China
<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
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
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
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
</span>
</span>
</span>
.
</div>
</div>

View File

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

View File

@ -65,8 +65,16 @@ import { Colors, Patterns } from 'widgets/styleguide'
## Typography {#typography}
import { H1, H2, H3, H4, H5, Label, InlineList, Comment } from
'components/typography'
import {
H1,
H2,
H3,
H4,
H5,
Label,
InlineList,
Comment,
} from 'components/typography'
> #### Markdown
>
@ -101,12 +109,12 @@ in the sidebar menu.
</Infobox>
<div>
<H1>Headline 1</H1>
<H2>Headline 2</H2>
<H3>Headline 3</H3>
<H4>Headline 4</H4>
<H5>Headline 5</H5>
<Label>Label</Label>
<H1>Headline 1</H1>
<H2>Headline 2</H2>
<H3>Headline 3</H3>
<H4>Headline 4</H4>
<H5>Headline 5</H5>
<Label>Label</Label>
</div>
---
@ -182,8 +190,9 @@ installed.
<InlineList>
<Tag>method</Tag> <Tag variant="new">4</Tag> <Tag variant="model">tagger,
parser</Tag>
<Tag>method</Tag> <Tag variant="new">4</Tag> <Tag variant="model">
tagger, parser
</Tag>
</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,
the buttons are implemented as styled links instead of native button elements.
<InlineList><Button to="#" variant="primary">Primary small</Button>
<Button to="#" variant="secondary">Secondary small</Button></InlineList>
<InlineList>
<Button to="#" variant="primary">
Primary small
</Button>
<Button to="#" variant="secondary">
Secondary small
</Button>
</InlineList>
<br />
<InlineList><Button to="#" variant="primary" large>Primary large</Button>
<Button to="#" variant="secondary" large>Secondary large</Button></InlineList>
<InlineList>
<Button to="#" variant="primary" large>
Primary large
</Button>
<Button to="#" variant="secondary" large>
Secondary large
</Button>
</InlineList>
## Components

View File

@ -1,9 +1,9 @@
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
types of named entities in a document, by asking the model for a
prediction**. Because models are statistical and strongly depend on the
examples they were trained on, this doesn't always work _perfectly_ and might
need some tuning later, depending on your use case.
types of named entities in a document, by asking the model for a prediction**.
Because models are statistical and strongly depend on the examples they were
trained on, this doesn't always work _perfectly_ and might need some tuning
later, depending on your use case.
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
our example sentence and its named entities look like:
import DisplaCyEntHtml from 'images/displacy-ent1.html'; import { Iframe } from
'components/embed'
import DisplaCyEntHtml from 'images/displacy-ent1.html'
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
our example sentence and its dependencies look like:
import DisplaCyLongHtml from 'images/displacy-long.html'; import { Iframe } from
'components/embed'
import DisplaCyLongHtml from 'images/displacy-long.html'
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
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
weights through [backpropagation](https://thinc.ai/docs/backprop101). The gradients
indicate how the weight values should be changed so that the model's predictions
become more similar to the reference labels over time.
weights through [backpropagation](https://thinc.ai/docs/backprop101). The
gradients indicate how the weight values should be changed so that the model's
predictions become more similar to the reference labels over time.
> - **Training data:** Examples and their annotations.
> - **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>

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
CUDA extra (e.g., `cuda102`, `cuda113`) installs the correct version of
[`cupy`](https://docs.cupy.dev/en/stable/install.html#installing-cupy), which
is just like `numpy`, but for GPU. You may also need to set the `CUDA_PATH`
[`cupy`](https://docs.cupy.dev/en/stable/install.html#installing-cupy), which is
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
location. Putting it all together, if you had installed CUDA 11.3 in
`/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
algorithms for learning word vector tables. You can train a word vectors table
using tools such as [floret](https://github.com/explosion/floret),
[Gensim](https://radimrehurek.com/gensim/),
[FastText](https://fasttext.cc/) or
[Gensim](https://radimrehurek.com/gensim/), [FastText](https://fasttext.cc/) or
[GloVe](https://nlp.stanford.edu/projects/glove/), or download existing
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

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
> text (articles from a single newspaper, 1984-1989).
import Benchmarks from 'usage/\_benchmarks-models.mdx'
import Benchmarks from 'usage/_benchmarks-models.mdx'
<Benchmarks />

View File

@ -181,7 +181,9 @@ $ pip install --no-build-isolation --editable .[lookups,cuda102]
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`:
`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
source code and recompiling frequently.
- Install in editable mode. Changes to `.py` files will be reflected as soon
as the files are saved, but edits to Cython files (`.pxd`, `.pyx`) will
require the `pip install` command below to be run again. Before installing in
editable mode, be sure you have removed any previous installs with
- Install in editable mode. Changes to `.py` files will be reflected as soon as
the files are saved, but edits to Cython files (`.pxd`, `.pyx`) will require
the `pip install` command below to be run again. Before installing in editable
mode, be sure you have removed any previous installs with
`pip uninstall spacy`, which you may need to run multiple times to remove all
traces of earlier installs.
@ -247,8 +249,8 @@ source code and recompiling frequently.
$ pip install --no-build-isolation --editable .
```
- Build in parallel. Starting in v3.4.0, you can specify the number of
build jobs with the environment variable `SPACY_NUM_BUILD_JOBS`:
- Build in parallel. Starting in v3.4.0, you can specify the number of build
jobs with the environment variable `SPACY_NUM_BUILD_JOBS`:
```bash
$ pip install -r requirements.txt

View File

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

View File

@ -28,7 +28,7 @@ annotations.
## 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 />
@ -300,7 +300,11 @@ for token in doc:
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
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}
import NER101 from 'usage/101/\_named-entities.mdx'
import NER101 from 'usage/101/_named-entities.mdx'
<NER101 />
@ -730,7 +734,11 @@ displacy.serve(doc, style="ent")
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}
@ -785,7 +793,7 @@ during tokenization. This is kind of a core principle of spaCy's `Doc` object:
</Infobox>
import Tokenization101 from 'usage/101/\_tokenization.mdx'
import Tokenization101 from 'usage/101/_tokenization.mdx'
<Tokenization101 />
@ -1868,7 +1876,7 @@ initialized before training. See the
## Word vectors and semantic similarity {#vectors-similarity}
import Vectors101 from 'usage/101/\_vectors-similarity.mdx'
import Vectors101 from 'usage/101/_vectors-similarity.mdx'
<Vectors101 />
@ -1998,7 +2006,7 @@ for word, vector in vector_data.items():
## Language Data {#language-data}
import LanguageData101 from 'usage/101/\_language-data.mdx'
import LanguageData101 from 'usage/101/_language-data.mdx'
<LanguageData101 />

View File

@ -25,7 +25,11 @@ located anywhere on your file system.
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

View File

@ -12,7 +12,7 @@ menu:
- ['Plugins & Wrappers', 'plugins']
---
import Pipelines101 from 'usage/101/\_pipelines.mdx'
import Pipelines101 from 'usage/101/_pipelines.mdx'
<Pipelines101 />
@ -364,7 +364,8 @@ nlp.enable_pipe("tagger")
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
`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
# 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.
<Grid narrow cols={3}>
<Integration title="DVC" logo="dvc" url="#dvc">Manage and version your data</Integration>
<Integration title="Prodigy" logo="prodigy" url="#prodigy">Create labelled training data</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>
<Integration title="DVC" logo="dvc" url="#dvc">
Manage and version your data
</Integration>
<Integration title="Prodigy" logo="prodigy" url="#prodigy">
Create labelled training data
</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>
### 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'
<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:

View File

@ -10,7 +10,7 @@ menu:
## Basics {#basics hidden="true"}
import Serialization101 from 'usage/101/\_serialization.mdx'
import Serialization101 from 'usage/101/_serialization.mdx'
<Serialization101 />
@ -582,7 +582,11 @@ displayed in `#3dff74`.
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}

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
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>
@ -191,7 +195,7 @@ text with spaCy.
### Tokenization {#annotations-token}
import Tokenization101 from 'usage/101/\_tokenization.mdx'
import Tokenization101 from 'usage/101/_tokenization.mdx'
<Tokenization101 />
@ -207,7 +211,7 @@ language-specific data**, see the usage guides on
### 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 />
@ -222,7 +226,7 @@ how to **navigate and use the parse tree** effectively, see the usage guides on
### Named Entities {#annotations-ner model="ner"}
import NER101 from 'usage/101/\_named-entities.mdx'
import NER101 from 'usage/101/_named-entities.mdx'
<NER101 />
@ -238,7 +242,7 @@ of a model, see the usage guides on
### 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 />
@ -252,7 +256,7 @@ To learn more about word vectors, how to **customize them** and how to load
## Pipelines {#pipelines}
import Pipelines101 from 'usage/101/\_pipelines.mdx'
import Pipelines101 from 'usage/101/_pipelines.mdx'
<Pipelines101 />
@ -266,7 +270,7 @@ guide on [language processing pipelines](/usage/processing-pipelines).
## Architecture {#architecture}
import Architecture101 from 'usage/101/\_architecture.mdx'
import Architecture101 from 'usage/101/_architecture.mdx'
<Architecture101 />
@ -384,7 +388,7 @@ it.
## Serialization {#serialization}
import Serialization101 from 'usage/101/\_serialization.mdx'
import Serialization101 from 'usage/101/_serialization.mdx'
<Serialization101 />
@ -397,7 +401,7 @@ guide on [saving and loading](/usage/saving-loading#models).
## Training {#training}
import Training101 from 'usage/101/\_training.mdx'
import Training101 from 'usage/101/_training.mdx'
<Training101 />
@ -476,7 +480,7 @@ for trainable components.
## Language data {#language-data}
import LanguageData101 from 'usage/101/\_language-data.mdx'
import LanguageData101 from 'usage/101/_language-data.mdx'
<LanguageData101 />
@ -513,10 +517,11 @@ via the following platforms:
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
solved by others, you'll receive help much quicker.
- [GitHub discussions](https://github.com/explosion/spaCy/discussions): **General
discussion**, **project ideas** and **usage questions**. Meet other community
members to get help with a specific code implementation, discuss ideas for new
projects/plugins, support more languages, and share best practices.
- [GitHub discussions](https://github.com/explosion/spaCy/discussions):
**General discussion**, **project ideas** and **usage questions**. Meet other
community members to get help with a specific code implementation, discuss
ideas for new projects/plugins, support more languages, and share best
practices.
- [GitHub issue tracker](https://github.com/explosion/spaCy/issues): **Bug
reports** and **improvement suggestions**, i.e. everything that's likely
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)
```
<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

View File

@ -17,7 +17,7 @@ menu:
## Introduction to training {#basics hidden="true"}
import Training101 from 'usage/101/\_training.mdx'
import Training101 from 'usage/101/_training.mdx'
<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
contribute to the documentation. For more details, check out the
[styleguide](/styleguide) and
[source](https://github.com/explosion/spacy/tree/v2.x/website). While
converting the pages to Markdown, we've also fixed a bunch of typos, improved
the existing pages and added some new content:
[source](https://github.com/explosion/spacy/tree/v2.x/website). While converting
the pages to Markdown, we've also fixed a bunch of typos, improved the existing
pages and added some new content:
- **Usage Guide:** [Rule-based Matching](/usage/rule-based-matching)<br/>How to
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'
<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

View File

@ -63,8 +63,8 @@ All CNN pipelines have been extended with whitespace augmentation.
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.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 |

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)
import Benchmarks from 'usage/\_benchmarks-models.mdx'
import Benchmarks from 'usage/_benchmarks-models.mdx'
<Benchmarks />

View File

@ -118,12 +118,16 @@ displacy.serve(doc, style="ent")
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`:
| Argument | Description |
| -------- | ------------------------------------------------------------------------------------------------------------- |
| -------- | ------------------------------------------------------------------------------------------------------------- | ------ |
| `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]~~ |
@ -145,7 +149,11 @@ use the `colors` setting to add your own colors for them.
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
added as the `background` style attribute, you can use any
@ -184,7 +192,7 @@ nlp = spacy.blank("en")
doc = nlp(text)
doc.spans["sc"] = [
Span(doc, 3, 6, "ORG"),
Span(doc, 3, 6, "ORG"),
Span(doc, 5, 6, "GPE"),
]
@ -193,8 +201,11 @@ displacy.serve(doc, style="span")
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`:
@ -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]~~ |
| `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
which one displaCy should use with `spans_key` (`sc` is the default).
Because spans can be stored across different keys in `doc.spans`, you need to
specify which one displaCy should use with `spans_key` (`sc` is the default).
> #### 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")]
> options = {"spans_key": "custom"}
> displacy.serve(doc, style="span", options=options)
> ```
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}
@ -343,11 +357,11 @@ want to visualize output from other libraries, like [NLTK](http://www.nltk.org)
or
[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
in displaCy's format as a dictionary (instead of `Doc` objects). There are helper
functions for converting `Doc` objects to displaCy's format for use with `manual=True`:
[`displacy.parse_deps`](/api/top-level#displacy.parse_deps),
[`displacy.parse_ents`](/api/top-level#displacy.parse_ents),
and [`displacy.parse_spans`](/api/top-level#displacy.parse_spans).
in displaCy's format as a dictionary (instead of `Doc` objects). There are
helper functions for converting `Doc` objects to displaCy's format for use with
`manual=True`: [`displacy.parse_deps`](/api/top-level#displacy.parse_deps),
[`displacy.parse_ents`](/api/top-level#displacy.parse_ents), and
[`displacy.parse_spans`](/api/top-level#displacy.parse_spans).
> #### 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)
> ```
```python
### DEP input
{

View File

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

View File

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

View File

@ -1,6 +1,6 @@
{
"resources": [
{
{
"id": "grecy",
"title": "greCy",
"slogan": "Ancient Greek pipelines for spaCy",
@ -60,12 +60,8 @@
"github": "Ce11an",
"website": "https://www.linkedin.com/in/cellan-hall/"
},
"category": [
"extension"
],
"tags": [
"text-processing"
]
"category": ["extension"],
"tags": ["text-processing"]
},
{
"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",
"github": "aimhubio/aim-spacy",
"pip": "aim-spacy",
"code_example": [
"https://github.com/aimhubio/aim-spacy/tree/master/examples"
],
"code_example": ["https://github.com/aimhubio/aim-spacy/tree/master/examples"],
"code_language": "python",
"url": "https://aimstack.io/spacy",
"thumb": "https://user-images.githubusercontent.com/13848158/172912427-ee9327ea-3cd8-47fa-8427-6c0d36cd831f.png",
@ -266,7 +260,7 @@
"code_language": "python",
"author": "Peter Baumgartner",
"author_links": {
"twitter" : "pmbaumgartner",
"twitter": "pmbaumgartner",
"github": "pmbaumgartner",
"website": "https://www.peterbaumgartner.com/"
},
@ -286,7 +280,7 @@
"code_language": "python",
"author": "Explosion",
"author_links": {
"twitter" : "explosion_ai",
"twitter": "explosion_ai",
"github": "explosion",
"website": "https://explosion.ai/"
},
@ -748,7 +742,7 @@
"code_language": "python",
"author": "Keith Rozario",
"author_links": {
"twitter" : "keithrozario",
"twitter": "keithrozario",
"github": "keithrozario",
"website": "https://www.keithrozario.com"
},
@ -2664,10 +2658,7 @@
"github": "davidberenstein1957",
"website": "https://www.linkedin.com/in/david-berenstein-1bab11105/"
},
"category": [
"pipeline",
"standalone"
],
"category": ["pipeline", "standalone"],
"tags": [
"classification",
"zero-shot",
@ -2720,14 +2711,8 @@
"github": "davidberenstein1957",
"website": "https://www.linkedin.com/in/david-berenstein-1bab11105/"
},
"category": [
"pipeline"
],
"tags": [
"ner",
"few-shot",
"gensim"
],
"category": ["pipeline"],
"tags": ["ner", "few-shot", "gensim"],
"spacy_version": 3
},
{
@ -2778,16 +2763,8 @@
"github": "davidberenstein1957",
"website": "https://www.linkedin.com/in/david-berenstein-1bab11105/"
},
"category": [
"pipeline",
"standalone"
],
"tags": [
"coreference",
"multi-lingual",
"cross-lingual",
"allennlp"
],
"category": ["pipeline", "standalone"],
"tags": ["coreference", "multi-lingual", "cross-lingual", "allennlp"],
"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).",
"github": "natasha/ipymarkup",
"image": "https://github.com/natasha/ipymarkup/blob/master/table.png?raw=true",
"pip":"pip install ipymarkup",
"pip": "pip install ipymarkup",
"code_example": [
"from ipymarkup import show_span_ascii_markup, show_dep_ascii_markup",
"",
@ -3715,7 +3692,15 @@
"website": "https://brucewlee.github.io/"
},
"category": ["research", "scientific"],
"tags": ["Readability", "Simplification", "Feature Extraction", "Syntax", "Discourse", "Semantics", "Lexical"]
"tags": [
"Readability",
"Simplification",
"Feature Extraction",
"Syntax",
"Discourse",
"Semantics",
"Lexical"
]
},
{
"id": "hmrb",
@ -4063,7 +4048,6 @@
"github": "yasufumy"
}
}
],
"categories": [

View File

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

View File

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

View File

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

View File

@ -27,11 +27,11 @@ const GitHubCode = ({ url, lang, errorMsg = defaultErrorMsg, className }) => {
if (!initialized) {
setCode(null)
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 }) => {
setCode(ok ? text : errorMsg)
})
.catch(err => {
.catch((err) => {
setCode(errorMsg)
console.error(err)
})

View File

@ -14,7 +14,7 @@ export default class Juniper extends React.Component {
state = { kernel: null, renderers: null, fromStorage: null }
componentDidMount() {
const renderers = standardRendererFactories.filter(factory =>
const renderers = standardRendererFactories.filter((factory) =>
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 }))
return new Promise((resolve, reject) => {
const es = new EventSource(binderUrl)
es.onerror = err => {
es.onerror = (err) => {
es.close()
this.log(() => console.error('failed'))
reject(new Error(err))
@ -92,7 +92,7 @@ export default class Juniper extends React.Component {
window.localStorage.setItem(this.props.storageKey, json)
}
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'))
return kernel
})
@ -116,7 +116,7 @@ export default class Juniper extends React.Component {
}
if (this.props.useBinder) {
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)
@ -173,12 +173,8 @@ export default class Juniper extends React.Component {
name: 'stdout',
text: `${action} Docker container on ${url}...`,
})
new Promise((resolve, reject) =>
this.getKernel()
.then(resolve)
.catch(reject)
)
.then(kernel => {
new Promise((resolve, reject) => this.getKernel().then(resolve).catch(reject))
.then((kernel) => {
this.setState({ kernel })
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.input}
ref={x => {
ref={(x) => {
this.inputRef = x
}}
/>
@ -211,7 +207,7 @@ export default class Juniper extends React.Component {
{this.props.msgButton}
</button>
<div
ref={x => {
ref={(x) => {
this.outputRef = x
}}
className={this.props.classNames.output}

View File

@ -7,7 +7,8 @@ import Icon from './icon'
import classes from '../styles/link.module.sass'
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 }) => (
// 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 { replaceEmoji } from './icon'
export const Ol = props => <ol className={classes.ol} {...props} />
export const Ul = props => <ul className={classes.ul} {...props} />
export const Ol = (props) => <ol className={classes.ol} {...props} />
export const Ul = (props) => <ul className={classes.ul} {...props} />
export const Li = ({ children, emoji, ...props }) => {
const { hasIcon, content } = replaceEmoji(children)
const liClassNames = classNames(classes.li, {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -85,9 +85,7 @@ export function htmlToReact(html) {
* @returns {Node} - The converted React elements.
*/
export function markdownToReact(markdown, remarkReactComponents = {}) {
return remark()
.use(remark2react, { remarkReactComponents })
.processSync(markdown).contents
return remark().use(remark2react, { remarkReactComponents }).processSync(markdown).contents
}
/**
@ -113,7 +111,7 @@ export function join(arr, delimiter = ', ') {
* @return {Object} - The converted object.
*/
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)
function transformer(tree) {
visit(tree, 'code', node => {
visit(tree, 'code', (node) => {
if (node.value) {
const langName = node.lang || 'none'
const lang = options.languageAliases[langName] || langName

View File

@ -17,7 +17,7 @@ const defaultOptions = {
function remarkCustomAttrs(userOptions = {}) {
const options = Object.assign({}, defaultOptions, userOptions)
function transformer(tree) {
visit(tree, null, node => {
visit(tree, null, (node) => {
if (options.elements.includes(node.type)) {
if (
node.children &&
@ -25,10 +25,13 @@ function remarkCustomAttrs(userOptions = {}) {
node.children[0].type === 'text' &&
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.
// 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 = [node.children[0]]
}

View File

@ -28,7 +28,7 @@ function remarkWrapSection(userOptions = {}) {
const headingsMap = []
const newTree = []
visit(tree, 'import', node => {
visit(tree, 'import', (node) => {
// For compatibility with MDX / gatsby-mdx, make sure import nodes
// are not moved further down into children (which means they're not
// 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
const children = tree.children
.slice(sectionStartIndex, sectionEndIndex)
.filter(node => node.type !== 'import')
.filter((node) => node.type !== 'import')
if (children.length) {
const headingId = index === 0 ? 0 : headingsMap[index - 1].id

View File

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

View File

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

View File

@ -12,7 +12,7 @@ const WrappedComponent = React.memo(({ scope = {}, components = {}, children, ..
if (!children) return null
const fullScope = { React, MDXTag, ...scope }
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 End = fn({}, ...values)
return React.createElement(End, { components, ...props })

View File

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

View File

@ -28,7 +28,7 @@ function getSlug(data) {
function filterResources(resources, data) {
const sorted = resources.sort((a, b) => a.id.localeCompare(b.id))
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 }) => {
@ -142,7 +142,13 @@ const UniverseContent = ({ content = [], categories, theme, pageContext, mdxComp
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.
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
</Link>
section in Discussions.
@ -316,7 +322,7 @@ const Project = ({ data, components }) => (
{data.category && (
<p style={{ marginBottom: 0 }}>
<Label>Categories</Label>
{data.category.map(cat => (
{data.category.map((cat) => (
<Link to={`/universe/category/${cat}`} key={cat} ws>
<InlineCode>{cat}</InlineCode>
</Link>
@ -330,7 +336,7 @@ const Project = ({ data, components }) => (
const Universe = ({ pageContext, location, mdxComponents }) => (
<StaticQuery
query={query}
render={data => {
render={(data) => {
const { universe, nightly, legacy } = data.site.siteMetadata
const theme = nightly ? 'nightly' : legacy ? 'legacy' : pageContext.theme
return (

View File

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

View File

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

View File

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

View File

@ -10,7 +10,15 @@ const DEFAULT_LANG = 'en'
const DEFAULT_HARDWARE = 'cpu'
const DEFAULT_OPT = 'efficiency'
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'
# you can run spacy init fill-config to auto-fill all default settings:
# python -m spacy init fill-config ./base_config.cfg ./config.cfg`
@ -25,7 +33,7 @@ const DATA = [
id: 'components',
title: 'Components',
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,
},
{
@ -52,8 +60,7 @@ const DATA = [
{
id: 'optimize',
title: 'Optimize for',
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.',
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.',
options: [
{ id: 'efficiency', title: 'efficiency', checked: DEFAULT_OPT === 'efficiency' },
{ 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) {
_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)
}
const setters = {
lang: setLang,
components: v => updateComponents(v, textcatExclusive),
components: (v) => updateComponents(v, textcatExclusive),
hardware: setHardware,
optimize: setOptimize,
textcat: v => {
textcat: (v) => {
const isExclusive = v.includes('exclusive')
setTextcatExclusive(isExclusive)
updateComponents(_components, isExclusive)
@ -101,7 +110,7 @@ export default function QuickstartTraining({ id, title, download = 'base_config.
const rawContent = `${COMMENT}\n${rawStr}`
const displayContent = highlightCode('ini', rawContent)
.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')
return (
<StaticQuery
@ -116,7 +125,7 @@ export default function QuickstartTraining({ id, title, download = 'base_config.
}))
.sort((a, b) => a.title.localeCompare(b.title))
if (!_components.includes('textcat')) {
data = data.map(field =>
data = data.map((field) =>
field.id === 'textcat' ? { ...field, hidden: true } : field
)
}

View File

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