From 2cfe9340a1727acf9fcfd23a6ac0c0f2c0215010 Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Fri, 25 Sep 2020 13:21:20 +0200 Subject: [PATCH] Link model components [ci skip] --- website/src/templates/models.js | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/website/src/templates/models.js b/website/src/templates/models.js index f67188c0b..8a73a6282 100644 --- a/website/src/templates/models.js +++ b/website/src/templates/models.js @@ -11,12 +11,23 @@ import { Table, Tr, Td, Th } from '../components/table' import Tag from '../components/tag' import { H2, Label } from '../components/typography' import Icon from '../components/icon' -import Link from '../components/link' +import Link, { OptionalLink } from '../components/link' import Infobox from '../components/infobox' import Accordion from '../components/accordion' import { join, arrayToObj, abbrNum, markdownToReact } from '../components/util' import { isString, isEmptyObj } from '../components/util' +const COMPONENT_LINKS = { + tok2vec: '/api/tok2vec', + transformer: '/api/transformer', + tagger: '/api/tagger', + parser: '/api/dependencyparser', + ner: '/api/entityrecognizer', + lemmatizer: '/api/lemmatizer', + attribute_ruler: '/api/attributeruler', + senter: '/api/sentencerecognizer', +} + const MODEL_META = { core: 'Vocabulary, syntax, entities, vectors', core_sm: 'Vocabulary, syntax, entities', @@ -146,6 +157,18 @@ function formatSources(data = []) { )) } +function linkComponents(components = []) { + return join( + components.map(c => ( + + + {c} + + + )) + ) +} + const Help = ({ children }) => ( @@ -192,10 +215,8 @@ const Model = ({ const releaseTag = meta.fullName ? `/tag/${meta.fullName}` : '' const releaseUrl = `https://github.com/${repo}/releases/${releaseTag}` - const pipeline = - meta.pipeline && join(meta.pipeline.map(p => {p})) - const components = - meta.components && join(meta.components.map(p => {p})) + const pipeline = linkComponents(meta.pipeline) + const components = linkComponents(meta.components) const sources = formatSources(meta.sources) const author = !meta.url ? meta.author : {meta.author} const licenseUrl = licenses[meta.license] ? licenses[meta.license].url : null