diff options
Diffstat (limited to 'src/lib/db/prosodydb.ts')
-rw-r--r-- | src/lib/db/prosodydb.ts | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/lib/db/prosodydb.ts b/src/lib/db/prosodydb.ts index 26687a2..fdadafb 100644 --- a/src/lib/db/prosodydb.ts +++ b/src/lib/db/prosodydb.ts @@ -7,8 +7,8 @@ type ItemType = "word" | "syllable" | "idiom"; class DatabaseHandler { db: Database; constructor() { - // const dbPath = "/home/y/code/bun/ssr/waku/bulkdata/phon.db"; - const dbPath = "/home/y/code/bun/ssr/waku/bulkdata/enphon.db"; + const dbPath = "/home/y/code/bun/ssr/sorlang/bulkdata/thaiphon.db"; + // const dbPath = "/home/y/code/bun/ssr/sorlang/bulkdata/enphon.db"; const db = new Database(dbPath, { create: true }); db.exec("PRAGMA journal_mode = WAL"); // Enable Write-Ahead Logging for better performance db.exec("PRAGMA foreign_keys = ON"); @@ -102,10 +102,12 @@ class DatabaseHandler { } // tones fetchWordsByToneAndSyls(tones: Array<string | null>) { - const toneString = tones.reduce((acc: string, item) => { - if (!item) return `${acc},%`; - else return `${acc},${item}`; - }, ""); + const toneString = tones + .reduce((acc: string, item) => { + if (!item) return `${acc},%`; + else return `${acc},${item}`; + }, "") + .slice(1); console.log({ toneString }); const query = this.db.query( ` @@ -139,7 +141,7 @@ class DatabaseHandler { ORDER BY frequency ASC NULLS LAST; `, ); - return query.all(toneString.slice(1), tones.length) as any[]; + return query.all(toneString, tones.length) as any[]; } // fetchWordsByToneAndSyls(tones: Array<string | null>) { // const toneString = tones.reduce((acc: string, item) => { |