(nlpDir: string, dictId: string)
| 47 | } |
| 48 | |
| 49 | export function loadDictBuffer(nlpDir: string, dictId: string): Buffer | null { |
| 50 | const filePath = getDictFilePath(nlpDir, dictId) |
| 51 | if (!fs.existsSync(filePath)) return null |
| 52 | try { |
| 53 | return fs.readFileSync(filePath) |
| 54 | } catch (error) { |
| 55 | console.error(`[NLP DictManager] Failed to read dict file: ${filePath}`, error) |
| 56 | return null |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | export async function downloadDict( |
| 61 | nlpDir: string, |
nothing calls this directly
no test coverage detected