2020-10-03 12:35:42 +03:00
|
|
|
import React, { Fragment, useState } from 'react'
|
💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 21:31:19 +03:00
|
|
|
import { StaticQuery, graphql } from 'gatsby'
|
|
|
|
|
|
|
|
import { Quickstart, QS } from '../components/quickstart'
|
|
|
|
|
2020-10-03 12:35:42 +03:00
|
|
|
const DEFAULT_LANG = 'en'
|
|
|
|
const DEFAULT_OPT = 'efficiency'
|
|
|
|
|
💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 21:31:19 +03:00
|
|
|
const data = [
|
|
|
|
{
|
|
|
|
id: 'lang',
|
|
|
|
title: 'Language',
|
2020-10-03 12:35:42 +03:00
|
|
|
defaultValue: DEFAULT_LANG,
|
💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 21:31:19 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'load',
|
|
|
|
title: 'Loading style',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
id: 'spacy',
|
|
|
|
title: 'Use spacy.load()',
|
2020-09-03 14:13:03 +03:00
|
|
|
help: "Use spaCy's built-in loader to load the package by name",
|
💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 21:31:19 +03:00
|
|
|
checked: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'module',
|
|
|
|
title: 'Import as module',
|
2020-09-03 14:13:03 +03:00
|
|
|
help: 'Import the package explicitly as a Python module',
|
💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 21:31:19 +03:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2020-10-03 12:35:42 +03:00
|
|
|
{
|
|
|
|
id: 'optimize',
|
2020-10-05 22:05:41 +03:00
|
|
|
title: 'Select for',
|
2020-10-03 12:35:42 +03:00
|
|
|
options: [
|
2020-10-05 22:05:41 +03:00
|
|
|
{
|
|
|
|
id: 'efficiency',
|
|
|
|
title: 'efficiency',
|
|
|
|
checked: DEFAULT_OPT === 'efficiency',
|
|
|
|
help: 'Faster and smaller pipeline, but less accurate',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'accuracy',
|
|
|
|
title: 'accuracy',
|
|
|
|
checked: DEFAULT_OPT === 'accuracy',
|
|
|
|
help: 'Larger and slower pipeline, but more accurate',
|
|
|
|
},
|
2020-10-03 12:35:42 +03:00
|
|
|
],
|
|
|
|
},
|
💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 21:31:19 +03:00
|
|
|
{
|
|
|
|
id: 'config',
|
|
|
|
title: 'Options',
|
|
|
|
multiple: true,
|
2021-01-31 08:11:24 +03:00
|
|
|
options: [
|
|
|
|
{
|
|
|
|
id: 'wheel',
|
|
|
|
title: 'Download binary wheel',
|
|
|
|
help: 'Can make download and installation more efficient',
|
|
|
|
},
|
|
|
|
{ id: 'example', title: 'Show text example' },
|
|
|
|
],
|
💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 21:31:19 +03:00
|
|
|
},
|
|
|
|
]
|
|
|
|
|
2020-10-03 12:35:42 +03:00
|
|
|
const QuickstartInstall = ({ id, title, description, children }) => {
|
|
|
|
const [lang, setLang] = useState(DEFAULT_LANG)
|
2021-01-31 08:11:24 +03:00
|
|
|
const [wheel, setWheel] = useState(false)
|
2020-10-05 22:05:41 +03:00
|
|
|
const [efficiency, setEfficiency] = useState(DEFAULT_OPT === 'efficiency')
|
2020-10-03 12:35:42 +03:00
|
|
|
const setters = {
|
|
|
|
lang: setLang,
|
|
|
|
optimize: v => setEfficiency(v.includes('efficiency')),
|
2021-01-31 08:11:24 +03:00
|
|
|
config: v => setWheel(v.includes('wheel')),
|
2020-10-03 12:35:42 +03:00
|
|
|
}
|
|
|
|
return (
|
|
|
|
<StaticQuery
|
|
|
|
query={query}
|
|
|
|
render={({ site }) => {
|
|
|
|
const models = site.siteMetadata.languages.filter(({ models }) => models !== null)
|
|
|
|
data[0].dropdown = models
|
|
|
|
.sort((a, b) => a.name.localeCompare(b.name))
|
|
|
|
.map(({ code, name }) => ({
|
|
|
|
id: code,
|
|
|
|
title: name,
|
|
|
|
}))
|
|
|
|
return (
|
|
|
|
<Quickstart
|
|
|
|
data={data}
|
|
|
|
title={title}
|
|
|
|
id={id}
|
|
|
|
description={description}
|
|
|
|
setters={setters}
|
|
|
|
copy={false}
|
|
|
|
>
|
|
|
|
{models.map(({ code, models, example }) => {
|
|
|
|
const pkg = efficiency ? models[0] : models[models.length - 1]
|
|
|
|
const exampleText = example || 'No text available yet'
|
|
|
|
return lang !== code ? null : (
|
|
|
|
<Fragment key={code}>
|
2021-01-31 08:11:24 +03:00
|
|
|
<QS>
|
|
|
|
python -m spacy download {pkg}
|
|
|
|
{wheel ? ' --wheel' : ''}
|
|
|
|
</QS>
|
2020-10-03 12:35:42 +03:00
|
|
|
<QS divider />
|
|
|
|
<QS load="spacy" prompt="python">
|
|
|
|
import spacy
|
|
|
|
</QS>
|
|
|
|
<QS load="spacy" prompt="python">
|
|
|
|
nlp = spacy.load("{pkg}")
|
|
|
|
</QS>
|
|
|
|
<QS load="module" prompt="python">
|
|
|
|
import {pkg}
|
|
|
|
</QS>
|
|
|
|
<QS load="module" prompt="python">
|
|
|
|
nlp = {pkg}.load()
|
|
|
|
</QS>
|
|
|
|
<QS config="example" prompt="python">
|
|
|
|
doc = nlp("{exampleText}")
|
|
|
|
</QS>
|
|
|
|
<QS config="example" prompt="python">
|
|
|
|
print([
|
|
|
|
{code === 'xx'
|
|
|
|
? '(ent.text, ent.label) for ent in doc.ents'
|
|
|
|
: '(w.text, w.pos_) for w in doc'}
|
|
|
|
])
|
|
|
|
</QS>
|
|
|
|
</Fragment>
|
|
|
|
)
|
|
|
|
})}
|
💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 21:31:19 +03:00
|
|
|
|
2020-10-03 12:35:42 +03:00
|
|
|
{children}
|
|
|
|
</Quickstart>
|
|
|
|
)
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
}
|
💫 Update website (#3285)
<!--- Provide a general summary of your changes in the title. -->
## Description
The new website is implemented using [Gatsby](https://www.gatsbyjs.org) with [Remark](https://github.com/remarkjs/remark) and [MDX](https://mdxjs.com/). This allows authoring content in **straightforward Markdown** without the usual limitations. Standard elements can be overwritten with powerful [React](http://reactjs.org/) components and wherever Markdown syntax isn't enough, JSX components can be used. Hopefully, this update will also make it much easier to contribute to the docs. Once this PR is merged, I'll implement auto-deployment via [Netlify](https://netlify.com) on a specific branch (to avoid building the website on every PR). There's a bunch of other cool stuff that the new setup will allow us to do – including writing front-end tests, service workers, offline support, implementing a search and so on.
This PR also includes various new docs pages and content.
Resolves #3270. Resolves #3222. Resolves #2947. Resolves #2837.
### Types of change
enhancement
## Checklist
<!--- Before you submit the PR, go over this checklist and make sure you can
tick off all the boxes. [] -> [x] -->
- [x] I have submitted the spaCy Contributor Agreement.
- [x] I ran the tests, and all new and existing tests passed.
- [x] My changes don't require a change to the documentation, or if they do, I've added all required information.
2019-02-17 21:31:19 +03:00
|
|
|
|
|
|
|
export default QuickstartInstall
|
|
|
|
|
|
|
|
const query = graphql`
|
|
|
|
query QuickstartModelsQuery {
|
|
|
|
site {
|
|
|
|
siteMetadata {
|
|
|
|
languages {
|
|
|
|
code
|
|
|
|
name
|
|
|
|
models
|
|
|
|
example
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`
|