Header 1 | Header 2 |
---|---|
Column 1 | Column 2 |
+
+ + +{' '} + + +
+ ++ + +{' '} + + +
+ +## Components + +### Table {id="table"} + +> #### Markdown +> +> ```markdown +> | Header 1 | Header 2 | +> | -------- | -------- | +> | Column 1 | Column 2 | +> ``` +> +> #### JSX +> +> ```markup +>Header 1 | Header 2 |
---|---|
Column 1 | Column 2 |
+
+
+ + Get a custom spaCy pipeline, tailor-made for your NLP problem by + spaCy's core developers. + +
+
+
+ Prodigy is an annotation tool so efficient that data + scientists can do the annotation themselves, enabling a new level of rapid + iteration. Whether you're working on entity recognition, intent + detection or image classification, Prodigy can help you{' '} + train and evaluate your models faster. +
- spaCy's new project system gives you a smooth path from prototype to + spaCy's new project system gives you a smooth path from prototype to production. It lets you keep track of all those{' '} data transformation, preprocessing and{' '} training steps, so you can make sure your project is always @@ -236,13 +246,15 @@ const Landing = ({ data }) => { button="See what's new" small > - spaCy v3.0 features all new transformer-based pipelines that - bring spaCy's accuracy right up to the current state-of-the-art - . You can use any pretrained transformer to train your own pipelines, and even - share one transformer between multiple components with{' '} - multi-task learning. Training is now fully configurable and - extensible, and you can define your own custom models using{' '} - PyTorch, TensorFlow and other frameworks. +
+ spaCy v3.0 features all new transformer-based pipelines{' '} + that bring spaCy's accuracy right up to the current{' '} + state-of-the-art. You can use any pretrained transformer to + train your own pipelines, and even share one transformer between multiple + components with multi-task learning. Training is now fully + configurable and extensible, and you can define your own custom models using{' '} + PyTorch, TensorFlow and other frameworks. +
+
+
+ In this free and interactive online course you’ll learn how + to use spaCy to build advanced natural language understanding systems, using + both rule-based and machine learning approaches. It includes{' '} + 55 exercises featuring videos, slide decks, multiple-choice + questions and interactive coding practice in the browser. +
- spaCy v3.0 introduces transformer-based pipelines that bring spaCy's
+ spaCy v3.0 introduces transformer-based pipelines that bring spaCy's
accuracy right up to the current state-of-the-art. You can
also use a CPU-optimized pipeline, which is less accurate but much cheaper
to run.
@@ -285,33 +299,8 @@ const Landing = ({ data }) => {
-
-
-)
+const splitLines = (children) => {
+ const listChildrenPerLine = []
-export const Pre = props => {
- return {props.children}-} + if (typeof children === 'string') { + listChildrenPerLine.push(...children.split('\n')) + } else { + listChildrenPerLine.push([]) + let indexLine = 0 + if (Array.isArray(children)) { + children.forEach((child) => { + if (typeof child === 'string' && child.includes('\n')) { + const listString = child.split('\n') + listString.forEach((string, index) => { + listChildrenPerLine[indexLine].push(string) -export const InlineCode = ({ wrap = false, className, children, ...props }) => { - const codeClassNames = classNames(classes.inlineCode, className, { - [classes.wrap]: wrap || (isString(children) && children.length >= WRAP_THRESHOLD), - }) - return ( -
- {children}
-
- )
-}
-
-InlineCode.propTypes = {
- wrap: PropTypes.bool,
- className: PropTypes.string,
- children: PropTypes.node,
-}
-
-function linkType(el, showLink = true) {
- if (!isString(el) || !el.length) return el
- const elStr = el.trim()
- if (!elStr) return el
- const typeUrl = CUSTOM_TYPES[elStr]
- const url = typeUrl == true ? DEFAULT_TYPE_URL : typeUrl
- const ws = el[0] == ' '
- return url && showLink ? (
-
- {elements.map((el, i) => (
- {linkType(el, !!link)}
- ))}
- {meta && {meta}}
-
- )
-}
+ }
-function replacePrompt(line, prompt, isFirst = false) {
- let result = line
- const hasPrompt = result.startsWith(`${prompt} `)
- const showPrompt = hasPrompt || isFirst
- if (hasPrompt) result = result.slice(2)
- return result && showPrompt ? `${result}` : result
+ const listLine = listChildrenPerLine[listChildrenPerLine.length - 1]
+ if (listLine === '' || (listLine.length === 1 && listLine[0] === '')) {
+ listChildrenPerLine.pop()
+ }
+
+ return listChildrenPerLine.map((childrenPerLine, index) => (
+ <>
+ {childrenPerLine}
+ {index !== listChildrenPerLine.length - 1 && '\n'}
+ >
+ ))
}
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()
@@ -120,208 +89,221 @@ function parseArgs(raw) {
return result
}
-function convertLine(line, i) {
- const cliRegex = /^(\$ )?python -m spacy/
- if (cliRegex.test(line)) {
- const text = line.replace(cliRegex, '')
- const args = parseArgs(text)
- const cmd = Object.keys(args).map((key, i) => {
- const value = args[key]
- return value === null || value === true || i === 0 ? key : `${key} ${value}`
- })
+const flattenReact = (children) => {
+ if (children === null || children === undefined || children === false) {
+ return []
+ }
+
+ if (typeof children === 'string') {
+ return [children]
+ }
+
+ if (children.props) {
+ return flattenReact(children.props.children)
+ }
+
+ return children.flatMap(flattenReact)
+}
+
+const checkoutForComment = (line) => {
+ const lineParts = line.split(' # ')
+
+ if (lineParts.length !== 2) {
+ return line
+ }
+
+ return (
+ <>
+ {lineParts[0]}
+ {` `}
+
+ {`# `}
+ {lineParts[1]}
+
+ >
+ )
+}
+
+const handlePromot = ({ lineFlat, prompt }) => {
+ const lineWithoutPrompt = lineFlat.slice(prompt.length + 1)
+
+ const cliRegex = /^python -m spacy/
+
+ if (!cliRegex.test(lineWithoutPrompt)) {
+ return {checkoutForComment(lineWithoutPrompt)}
+ }
+
+ const text = lineWithoutPrompt.replace(cliRegex, '')
+ const args = parseArgs(text)
+ const cmd = Object.keys(args).map((key, i) => {
+ const value = args[key]
+ return value === null || value === true || i === 0 ? key : `${key} ${value}`
+ })
+ return (
+
+ python -m spacy{' '}
+ {cmd.map((item, j) => {
+ const isCmd = j === 0
+ const url = isCmd ? `/api/cli#${item.replace(' ', '-')}` : null
+ const isAbstract = isString(item) && /^\[(.+)\]$/.test(item)
+ const itemClassNames = classNames(classes['cli-arg'], {
+ [classes['cli-arg-highlight']]: isCmd,
+ [classes['cli-arg-emphasis']]: isAbstract,
+ })
+ const text = isAbstract ? item.slice(1, -1) : item
+ return (
+ {html}
+ {title &&
+
+ {children}
+
+
>
)
}
}
-const JuniperWrapper = ({ Juniper, title, lang, children }) => (
- {props.children}+} + +const CodeBlock = (props) => ( +
+
+
+)
+export default CodeBlock
diff --git a/website/src/components/codeDynamic.js b/website/src/components/codeDynamic.js
new file mode 100644
index 000000000..8c9483567
--- /dev/null
+++ b/website/src/components/codeDynamic.js
@@ -0,0 +1,5 @@
+import dynamic from 'next/dynamic'
+
+export default dynamic(() => import('./code'), {
+ loading: () =>