mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-11 04:08:09 +03:00
Fix model accuracy table [ci skip]
This commit is contained in:
parent
c94f7d0e75
commit
bb54f54369
|
@ -1,4 +1,4 @@
|
||||||
import React, { useEffect, useState, useMemo } from 'react'
|
import React, { useEffect, useState, useMemo, Fragment } from 'react'
|
||||||
import { StaticQuery, graphql } from 'gatsby'
|
import { StaticQuery, graphql } from 'gatsby'
|
||||||
import { window } from 'browser-monads'
|
import { window } from 'browser-monads'
|
||||||
|
|
||||||
|
@ -83,15 +83,24 @@ function formatVectors(data) {
|
||||||
|
|
||||||
function formatAccuracy(data) {
|
function formatAccuracy(data) {
|
||||||
if (!data) return null
|
if (!data) return null
|
||||||
const labels = { tags_acc: 'POS', ents_f: 'NER F', ents_p: 'NER P', ents_r: 'NER R' }
|
const labels = {
|
||||||
|
las: 'LAS',
|
||||||
|
uas: 'UAS',
|
||||||
|
tags_acc: 'TAG',
|
||||||
|
ents_f: 'NER F',
|
||||||
|
ents_p: 'NER P',
|
||||||
|
ents_r: 'NER R',
|
||||||
|
}
|
||||||
const isSyntax = key => ['tags_acc', 'las', 'uas'].includes(key)
|
const isSyntax = key => ['tags_acc', 'las', 'uas'].includes(key)
|
||||||
const isNer = key => key.startsWith('ents_')
|
const isNer = key => key.startsWith('ents_')
|
||||||
return Object.keys(data).map(key => ({
|
return Object.keys(data)
|
||||||
label: labels[key] || key.toUpperCase(),
|
.filter(key => labels[key])
|
||||||
value: data[key].toFixed(2),
|
.map(key => ({
|
||||||
help: MODEL_META[key],
|
label: labels[key],
|
||||||
type: isNer(key) ? 'ner' : isSyntax(key) ? 'syntax' : null,
|
value: data[key].toFixed(2),
|
||||||
}))
|
help: MODEL_META[key],
|
||||||
|
type: isNer(key) ? 'ner' : isSyntax(key) ? 'syntax' : null,
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatModelMeta(data) {
|
function formatModelMeta(data) {
|
||||||
|
@ -115,11 +124,11 @@ function formatModelMeta(data) {
|
||||||
function formatSources(data = []) {
|
function formatSources(data = []) {
|
||||||
const sources = data.map(s => (isString(s) ? { name: s } : s))
|
const sources = data.map(s => (isString(s) ? { name: s } : s))
|
||||||
return sources.map(({ name, url, author }, i) => (
|
return sources.map(({ name, url, author }, i) => (
|
||||||
<>
|
<Fragment key={i}>
|
||||||
{i > 0 && <br />}
|
{i > 0 && <br />}
|
||||||
{name && url ? <Link to={url}>{name}</Link> : name}
|
{name && url ? <Link to={url}>{name}</Link> : name}
|
||||||
{author && ` (${author})`}
|
{author && ` (${author})`}
|
||||||
</>
|
</Fragment>
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,12 +317,12 @@ const Model = ({ name, langId, langName, baseUrl, repo, compatibility, hasExampl
|
||||||
</Td>
|
</Td>
|
||||||
<Td>
|
<Td>
|
||||||
{labelNames.map((label, i) => (
|
{labelNames.map((label, i) => (
|
||||||
<>
|
<Fragment key={i}>
|
||||||
{i > 0 && ', '}
|
{i > 0 && ', '}
|
||||||
<InlineCode wrap key={label}>
|
<InlineCode wrap key={label}>
|
||||||
{label}
|
{label}
|
||||||
</InlineCode>
|
</InlineCode>
|
||||||
</>
|
</Fragment>
|
||||||
))}
|
))}
|
||||||
</Td>
|
</Td>
|
||||||
</Tr>
|
</Tr>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user