-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
29 lines (26 loc) · 1.13 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* Copyright (C) 2020-2021 b1f6c1c4
*
* This file is part of IPA-JFK.
*
* IPA-JFK is free software: you can redistribute it and/or modify it under the
* terms of the GNU Affero General Public License as published by the Free
* Software Foundation, version 3.
*
* IPA-JFK is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
* more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with IPA-JFK. If not, see <https://www.gnu.org/licenses/>.
*/
import htmlencode from 'htmlencode';
const { htmlEncode } = htmlencode;
import path from 'node:path';
import fs from 'node:fs';
import * as db from './db.js';
db.load(fs.readFileSync(new URL('./data/cmudict.txt', import.meta.url), 'utf-8'));
export { cache as cacheDatabase, query as queryDatabase, process } from './db.js';
export const unicode = db.display.utf8Encode;
export const html = (phs) => htmlEncode(db.display.utf8Encode(phs));
export const latex = db.display.latexEncode;