new IPA import script

This commit is contained in:
Andrzej Stepien 2023-08-04 14:24:17 +02:00
parent bddb22565c
commit 044c16aa15
4 changed files with 65142 additions and 0 deletions

65123
src/data/IPAs_en_UK.json Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,19 @@
import {db} from './db.mjs'
import fs from 'fs'
const IPAs = JSON.parse(fs.readFileSync('../IPAs_en_UK.json')).en_UK[0]
const keys = Object.keys(IPAs)
console.dir(IPAs)
for (const element of keys) {
await db('dictionary')
.where('word', element)
.update({
pronunciation: IPAs[element]
}).then(res=>{
if(res==1){console.log("added data for "+element)
} else {console.error("failed to import for "+element+". Perhaps it doesn't exist.")}
})
}
db.destroy()