From 88fee1a768c120874b3222bb5e1b7adff841fc7c Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Mon, 30 Sep 2019 13:22:17 +0200 Subject: [PATCH] Update models.js --- website/src/templates/models.js | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/website/src/templates/models.js b/website/src/templates/models.js index 1466235e4..159744aa8 100644 --- a/website/src/templates/models.js +++ b/website/src/templates/models.js @@ -14,13 +14,15 @@ import Icon from '../components/icon' import Link from '../components/link' import Grid from '../components/grid' 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 = { core: 'Vocabulary, syntax, entities, vectors', core_sm: 'Vocabulary, syntax, entities', dep: 'Vocabulary, syntax', ent: 'Named entities', + pytt: 'PyTorch Transformers', vectors: 'Word vectors', web: 'written text (blogs, news, comments)', news: 'written text (news, media)', @@ -43,6 +45,12 @@ const MODEL_META = { 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 = { code: InlineCode, } @@ -96,11 +104,23 @@ function formatModelMeta(data) { author: data.author, url: data.url, license: data.license, + labels: data.labels, vectors: formatVectors(data.vectors), 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 &&
} + {name && url ? {name} : name} + {author && ` (${author})`} + + )) +} + const Help = ({ children }) => ( @@ -135,11 +155,12 @@ const Model = ({ name, langId, langName, baseUrl, repo, compatibility, hasExampl const releaseUrl = `https://github.com/${repo}/releases/${releaseTag}` const pipeline = meta.pipeline && join(meta.pipeline.map(p => {p})) - const sources = meta.sources && join(meta.sources) + const sources = formatSources(meta.sources) const author = !meta.url ? meta.author : {meta.author} const licenseUrl = licenses[meta.license] ? licenses[meta.license].url : null const license = licenseUrl ? {meta.license} : meta.license const hasInteractiveCode = size === 'sm' && hasExamples && !isError + const labels = meta.labels const rows = [ { label: 'Language', tag: langId, content: langName }, @@ -222,7 +243,7 @@ const Model = ({ name, langId, langName, baseUrl, repo, compatibility, hasExampl {accuracy && accuracy.map(({ label, items }, i) => !items ? null : ( - +
{label}