Update website model display (#9589)

* Remove vectors from core trf model descriptions

* Update accuracy labels and exclude morph_acc for ja
This commit is contained in:
Adriane Boyd 2021-11-03 09:56:00 +01:00 committed by GitHub
parent 6eee024ff6
commit 79cea03983
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,7 +31,7 @@ const COMPONENT_LINKS = {
const MODEL_META = { const MODEL_META = {
core: 'Vocabulary, syntax, entities, vectors', core: 'Vocabulary, syntax, entities, vectors',
core_sm: 'Vocabulary, syntax, entities', core_no_vectors: 'Vocabulary, syntax, entities',
dep: 'Vocabulary, syntax', dep: 'Vocabulary, syntax',
ent: 'Named entities', ent: 'Named entities',
sent: 'Sentence boundaries', sent: 'Sentence boundaries',
@ -41,14 +41,16 @@ const MODEL_META = {
web: 'written text (blogs, news, comments)', web: 'written text (blogs, news, comments)',
news: 'written text (news, media)', news: 'written text (news, media)',
wiki: 'Wikipedia', wiki: 'Wikipedia',
uas: 'Unlabelled dependencies', uas: 'Unlabeled dependencies',
las: 'Labelled dependencies', las: 'Labeled dependencies',
dep_uas: 'Unlabelled dependencies', dep_uas: 'Unlabeled dependencies',
dep_las: 'Labelled dependencies', dep_las: 'Labeled dependencies',
token_acc: 'Tokenization', token_acc: 'Tokenization',
tok: 'Tokenization', tok: 'Tokenization',
lemma: 'Lemmatization', lemma: 'Lemmatization',
morph: 'Morphological analysis', morph: 'Morphological analysis',
lemma_acc: 'Lemmatization',
morph_acc: 'Morphological analysis',
tags_acc: 'Part-of-speech tags (fine grained tags, Token.tag)', tags_acc: 'Part-of-speech tags (fine grained tags, Token.tag)',
tag_acc: 'Part-of-speech tags (fine grained tags, Token.tag)', tag_acc: 'Part-of-speech tags (fine grained tags, Token.tag)',
tag: 'Part-of-speech tags (fine grained tags, Token.tag)', tag: 'Part-of-speech tags (fine grained tags, Token.tag)',
@ -115,8 +117,8 @@ function formatVectors(data) {
return `${abbrNum(keys)} keys, ${abbrNum(vectors)} unique vectors (${width} dimensions)` return `${abbrNum(keys)} keys, ${abbrNum(vectors)} unique vectors (${width} dimensions)`
} }
function formatAccuracy(data) { function formatAccuracy(data, lang) {
const exclude = ['speed'] const exclude = (lang !== "ja") ? ['speed'] : ['speed', 'morph_acc']
if (!data) return [] if (!data) return []
return Object.keys(data) return Object.keys(data)
.map(label => { .map(label => {
@ -147,8 +149,7 @@ function formatModelMeta(data) {
license: data.license, license: data.license,
labels: isEmptyObj(data.labels) ? null : data.labels, labels: isEmptyObj(data.labels) ? null : data.labels,
vectors: formatVectors(data.vectors), vectors: formatVectors(data.vectors),
// TODO: remove accuracy fallback accuracy: formatAccuracy(data.performance, data.lang),
accuracy: formatAccuracy(data.accuracy || data.performance),
} }
} }
@ -196,7 +197,7 @@ const Model = ({
const [isError, setIsError] = useState(true) const [isError, setIsError] = useState(true)
const [meta, setMeta] = useState({}) const [meta, setMeta] = useState({})
const { type, genre, size } = getModelComponents(name) const { type, genre, size } = getModelComponents(name)
const display_type = type === 'core' && size === 'sm' ? 'core_sm' : type const display_type = type === 'core' && (size === 'sm' || size === 'trf') ? 'core_no_vectors' : type
const version = useMemo(() => getLatestVersion(name, compatibility, prereleases), [ const version = useMemo(() => getLatestVersion(name, compatibility, prereleases), [
name, name,
compatibility, compatibility,