Enable frequency dictionaries to specify the frequency mode (#1944)

This commit is contained in:
toasted-nutbread 2021-09-26 11:08:25 -04:00 committed by GitHub
parent c15683d206
commit 6694a9d9c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -46,6 +46,10 @@
"type": "string", "type": "string",
"description": "Attribution information for the dictionary data." "description": "Attribution information for the dictionary data."
}, },
"frequencyMode": {
"type": "string",
"enum": ["occurrence-based", "rank-based"]
},
"tagMeta": { "tagMeta": {
"type": "object", "type": "object",
"description": "Tag information for terms and kanji. This object is obsolete and individual tag files should be used instead.", "description": "Tag information for terms and kanji. This object is obsolete and individual tag files should be used instead.",

View File

@ -201,11 +201,12 @@ class DictionaryImporter {
importDate: Date.now() importDate: Date.now()
}; };
const {author, url, description, attribution} = index; const {author, url, description, attribution, frequencyMode} = index;
if (typeof author === 'string') { summary.author = author; } if (typeof author === 'string') { summary.author = author; }
if (typeof url === 'string') { summary.url = url; } if (typeof url === 'string') { summary.url = url; }
if (typeof description === 'string') { summary.description = description; } if (typeof description === 'string') { summary.description = description; }
if (typeof attribution === 'string') { summary.attribution = attribution; } if (typeof attribution === 'string') { summary.attribution = attribution; }
if (typeof frequencyMode === 'string') { summary.frequencyMode = frequencyMode; }
Object.assign(summary, details); Object.assign(summary, details);