mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 01:16:28 +03:00
Only show label scheme if not empty [ci skip]
This commit is contained in:
parent
8f76d6c9ef
commit
5cbe21700b
|
@ -45,6 +45,14 @@ export function isString(obj) {
|
|||
return typeof obj === 'string' || obj instanceof String
|
||||
}
|
||||
|
||||
/**
|
||||
* @param obj - The object to check.
|
||||
* @returns {boolean} - Whether the object is empty.
|
||||
*/
|
||||
export function isEmptyObj(obj) {
|
||||
return Object.entries(obj).length === 0 && obj.constructor === Object
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert raw HTML to React elements
|
||||
* @param {string} html - The HTML markup to convert.
|
||||
|
|
|
@ -15,7 +15,8 @@ import Link from '../components/link'
|
|||
import Grid from '../components/grid'
|
||||
import Infobox from '../components/infobox'
|
||||
import Accordion from '../components/accordion'
|
||||
import { join, arrayToObj, abbrNum, markdownToReact, isString } from '../components/util'
|
||||
import { join, arrayToObj, abbrNum, markdownToReact } from '../components/util'
|
||||
import { isString, isEmptyObj } from '../components/util'
|
||||
|
||||
const MODEL_META = {
|
||||
core: 'Vocabulary, syntax, entities, vectors',
|
||||
|
@ -105,7 +106,7 @@ function formatModelMeta(data) {
|
|||
author: data.author,
|
||||
url: data.url,
|
||||
license: data.license,
|
||||
labels: data.labels,
|
||||
labels: isEmptyObj(data.labels) ? null : data.labels,
|
||||
vectors: formatVectors(data.vectors),
|
||||
accuracy: formatAccuracy(data.accuracy),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user