2023-08-03 19:39:01 +00:00
|
|
|
|
import {db} from './db.mjs'
|
|
|
|
|
import fs from 'fs'
|
|
|
|
|
|
|
|
|
|
const wiktionary = JSON.parse(fs.readFileSync('../processing/wiktionary-p3.json'))
|
|
|
|
|
|
|
|
|
|
const sampleElement = {
|
|
|
|
|
word: 'antinomian',
|
|
|
|
|
pronunciation: '/æntiˈnoʊmi.ən/',
|
|
|
|
|
meanings: [
|
|
|
|
|
{ type: 'noun', definitions: [Array] },
|
|
|
|
|
{ type: 'adj', definitions: [Array] }
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (const element of wiktionary) {
|
|
|
|
|
await db('dictionary')
|
|
|
|
|
.where('word', element.word)
|
|
|
|
|
.update({
|
2023-08-04 18:18:48 +00:00
|
|
|
|
//deprecated now that I have a better source of IPAs
|
2023-08-04 17:59:02 +00:00
|
|
|
|
//pronunciation: element.pronunciation,
|
2023-08-03 19:39:01 +00:00
|
|
|
|
meanings: JSON.stringify(element.meanings)
|
|
|
|
|
}).then(res=>{
|
|
|
|
|
if(res==1){console.log("added data for "+element.word)
|
|
|
|
|
} else {console.error("failed to import for "+element.word+". Perhaps it doesn't exist.")}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
db.destroy()
|