mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-14 13:47:13 +03:00
Update models.js
This commit is contained in:
parent
7c701784e5
commit
88fee1a768
|
@ -14,13 +14,15 @@ import Icon from '../components/icon'
|
||||||
import Link from '../components/link'
|
import Link from '../components/link'
|
||||||
import Grid from '../components/grid'
|
import Grid from '../components/grid'
|
||||||
import Infobox from '../components/infobox'
|
import Infobox from '../components/infobox'
|
||||||
import { join, arrayToObj, abbrNum, markdownToReact } from '../components/util'
|
import Accordion from '../components/accordion'
|
||||||
|
import { join, arrayToObj, abbrNum, markdownToReact, isString } from '../components/util'
|
||||||
|
|
||||||
const MODEL_META = {
|
const MODEL_META = {
|
||||||
core: 'Vocabulary, syntax, entities, vectors',
|
core: 'Vocabulary, syntax, entities, vectors',
|
||||||
core_sm: 'Vocabulary, syntax, entities',
|
core_sm: 'Vocabulary, syntax, entities',
|
||||||
dep: 'Vocabulary, syntax',
|
dep: 'Vocabulary, syntax',
|
||||||
ent: 'Named entities',
|
ent: 'Named entities',
|
||||||
|
pytt: 'PyTorch Transformers',
|
||||||
vectors: 'Word vectors',
|
vectors: 'Word vectors',
|
||||||
web: 'written text (blogs, news, comments)',
|
web: 'written text (blogs, news, comments)',
|
||||||
news: 'written text (news, media)',
|
news: 'written text (news, media)',
|
||||||
|
@ -43,6 +45,12 @@ const MODEL_META = {
|
||||||
compat: 'Latest compatible model version for your spaCy installation',
|
compat: 'Latest compatible model version for your spaCy installation',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const LABEL_SCHEME_META = {
|
||||||
|
tagger: 'Part-of-speech tags via Token.tag_',
|
||||||
|
parser: 'Dependency labels via Token.dep_',
|
||||||
|
ner: 'Named entity labels',
|
||||||
|
}
|
||||||
|
|
||||||
const MARKDOWN_COMPONENTS = {
|
const MARKDOWN_COMPONENTS = {
|
||||||
code: InlineCode,
|
code: InlineCode,
|
||||||
}
|
}
|
||||||
|
@ -96,11 +104,23 @@ function formatModelMeta(data) {
|
||||||
author: data.author,
|
author: data.author,
|
||||||
url: data.url,
|
url: data.url,
|
||||||
license: data.license,
|
license: data.license,
|
||||||
|
labels: data.labels,
|
||||||
vectors: formatVectors(data.vectors),
|
vectors: formatVectors(data.vectors),
|
||||||
accuracy: formatAccuracy(data.accuracy),
|
accuracy: formatAccuracy(data.accuracy),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatSources(data = []) {
|
||||||
|
const sources = data.map(s => (isString(s) ? { name: s } : s))
|
||||||
|
return sources.map(({ name, url, author }, i) => (
|
||||||
|
<>
|
||||||
|
{i > 0 && <br />}
|
||||||
|
{name && url ? <Link to={url}>{name}</Link> : name}
|
||||||
|
{author && ` (${author})`}
|
||||||
|
</>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
const Help = ({ children }) => (
|
const Help = ({ children }) => (
|
||||||
<span data-tooltip={children}>
|
<span data-tooltip={children}>
|
||||||
<Icon name="help2" width={16} variant="subtle" inline />
|
<Icon name="help2" width={16} variant="subtle" inline />
|
||||||
|
@ -135,11 +155,12 @@ const Model = ({ name, langId, langName, baseUrl, repo, compatibility, hasExampl
|
||||||
const releaseUrl = `https://github.com/${repo}/releases/${releaseTag}`
|
const releaseUrl = `https://github.com/${repo}/releases/${releaseTag}`
|
||||||
const pipeline =
|
const pipeline =
|
||||||
meta.pipeline && join(meta.pipeline.map(p => <InlineCode key={p}>{p}</InlineCode>))
|
meta.pipeline && join(meta.pipeline.map(p => <InlineCode key={p}>{p}</InlineCode>))
|
||||||
const sources = meta.sources && join(meta.sources)
|
const sources = formatSources(meta.sources)
|
||||||
const author = !meta.url ? meta.author : <Link to={meta.url}>{meta.author}</Link>
|
const author = !meta.url ? meta.author : <Link to={meta.url}>{meta.author}</Link>
|
||||||
const licenseUrl = licenses[meta.license] ? licenses[meta.license].url : null
|
const licenseUrl = licenses[meta.license] ? licenses[meta.license].url : null
|
||||||
const license = licenseUrl ? <Link to={licenseUrl}>{meta.license}</Link> : meta.license
|
const license = licenseUrl ? <Link to={licenseUrl}>{meta.license}</Link> : meta.license
|
||||||
const hasInteractiveCode = size === 'sm' && hasExamples && !isError
|
const hasInteractiveCode = size === 'sm' && hasExamples && !isError
|
||||||
|
const labels = meta.labels
|
||||||
|
|
||||||
const rows = [
|
const rows = [
|
||||||
{ label: 'Language', tag: langId, content: langName },
|
{ label: 'Language', tag: langId, content: langName },
|
||||||
|
@ -222,7 +243,7 @@ const Model = ({ name, langId, langName, baseUrl, repo, compatibility, hasExampl
|
||||||
{accuracy &&
|
{accuracy &&
|
||||||
accuracy.map(({ label, items }, i) =>
|
accuracy.map(({ label, items }, i) =>
|
||||||
!items ? null : (
|
!items ? null : (
|
||||||
<Table key={i}>
|
<Table fixed key={i}>
|
||||||
<thead>
|
<thead>
|
||||||
<Tr>
|
<Tr>
|
||||||
<Th colSpan={2}>{label}</Th>
|
<Th colSpan={2}>{label}</Th>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user