💫 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 React, { Fragment } from 'react'
|
|
|
|
import { StaticQuery, graphql } from 'gatsby'
|
|
|
|
|
|
|
|
import { Quickstart, QS } from '../components/quickstart'
|
|
|
|
|
|
|
|
const data = [
|
|
|
|
{
|
|
|
|
id: 'lang',
|
|
|
|
title: 'Language',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
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
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: 'config',
|
|
|
|
title: 'Options',
|
|
|
|
multiple: true,
|
|
|
|
options: [{ id: 'example', title: 'Show usage example' }],
|
|
|
|
},
|
|
|
|
]
|
|
|
|
|
2020-08-06 02:22:49 +03:00
|
|
|
const QuickstartInstall = ({ id, title, description, defaultLang = 'en', children }) => (
|
💫 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
|
|
|
<StaticQuery
|
|
|
|
query={query}
|
|
|
|
render={({ site }) => {
|
|
|
|
const models = site.siteMetadata.languages.filter(({ models }) => models !== null)
|
|
|
|
data[0].options = models.map(({ code, name }) => ({
|
|
|
|
id: code,
|
|
|
|
title: name,
|
|
|
|
checked: code === defaultLang,
|
|
|
|
}))
|
|
|
|
return (
|
|
|
|
<Quickstart data={data} title={title} id={id} description={description}>
|
|
|
|
{models.map(({ code, models, example }) => {
|
|
|
|
const pkg = models[0]
|
|
|
|
const exampleText = example || 'No text available yet'
|
|
|
|
return (
|
|
|
|
<Fragment key={code}>
|
|
|
|
<QS lang={code}>python -m spacy download {pkg}</QS>
|
|
|
|
<QS lang={code} divider />
|
|
|
|
<QS lang={code} load="spacy" prompt="python">
|
|
|
|
import spacy
|
|
|
|
</QS>
|
|
|
|
<QS lang={code} load="spacy" prompt="python">
|
|
|
|
nlp = spacy.load("{pkg}")
|
|
|
|
</QS>
|
|
|
|
<QS lang={code} load="module" prompt="python">
|
|
|
|
import {pkg}
|
|
|
|
</QS>
|
|
|
|
<QS lang={code} load="module" prompt="python">
|
|
|
|
nlp = {pkg}.load()
|
|
|
|
</QS>
|
|
|
|
<QS lang={code} config="example" prompt="python">
|
2019-09-12 17:11:15 +03:00
|
|
|
doc = nlp("{exampleText}")
|
💫 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
|
|
|
</QS>
|
|
|
|
<QS lang={code} 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>
|
|
|
|
)
|
|
|
|
})}
|
|
|
|
|
|
|
|
{children}
|
|
|
|
</Quickstart>
|
|
|
|
)
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
|
|
|
|
export default QuickstartInstall
|
|
|
|
|
|
|
|
const query = graphql`
|
|
|
|
query QuickstartModelsQuery {
|
|
|
|
site {
|
|
|
|
siteMetadata {
|
|
|
|
languages {
|
|
|
|
code
|
|
|
|
name
|
|
|
|
models
|
|
|
|
example
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`
|