flagScientific now checks for an array of tags
This commit is contained in:
parent
1281231487
commit
177ce33ff1
Binary file not shown.
|
@ -2,6 +2,12 @@ import { db, getWords } from './db.mjs'
|
||||||
|
|
||||||
const words = await getWords(db)
|
const words = await getWords(db)
|
||||||
const allDefinitionsAreScientific = (meanings) => {
|
const allDefinitionsAreScientific = (meanings) => {
|
||||||
|
const scientificTags = [
|
||||||
|
"sciences",
|
||||||
|
"mathematics",
|
||||||
|
"natural-sciences",
|
||||||
|
"algebra"
|
||||||
|
]
|
||||||
let scientific = 0
|
let scientific = 0
|
||||||
let totalDefs = 0
|
let totalDefs = 0
|
||||||
for (const meaning of meanings) {
|
for (const meaning of meanings) {
|
||||||
|
@ -9,7 +15,7 @@ const allDefinitionsAreScientific = (meanings) => {
|
||||||
totalDefs++
|
totalDefs++
|
||||||
if (definition.topics) {
|
if (definition.topics) {
|
||||||
for (const topic of definition.topics) {
|
for (const topic of definition.topics) {
|
||||||
if (topic === 'sciences') {
|
if (scientificTags.includes(topic)) {
|
||||||
scientific++
|
scientific++
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue