flagScientific now checks for an array of tags

This commit is contained in:
Andrzej Stepien 2023-08-09 16:05:26 +02:00
parent 1281231487
commit 177ce33ff1
2 changed files with 7 additions and 1 deletions

Binary file not shown.

View File

@ -2,6 +2,12 @@ import { db, getWords } from './db.mjs'
const words = await getWords(db)
const allDefinitionsAreScientific = (meanings) => {
const scientificTags = [
"sciences",
"mathematics",
"natural-sciences",
"algebra"
]
let scientific = 0
let totalDefs = 0
for (const meaning of meanings) {
@ -9,7 +15,7 @@ const allDefinitionsAreScientific = (meanings) => {
totalDefs++
if (definition.topics) {
for (const topic of definition.topics) {
if (topic === 'sciences') {
if (scientificTags.includes(topic)) {
scientific++
break
}