feat: source frequency ranks from installed Yomitan dictionaries

This commit is contained in:
2026-02-28 03:47:57 -08:00
parent 185528aee6
commit 93e392910c
21 changed files with 448 additions and 55 deletions

View File

@@ -28,7 +28,7 @@ export function getFrequencyDictionarySearchPaths(
const rawSearchPaths: string[] = [];
// User-provided path takes precedence over bundled/default roots.
// Root list should include `vendor/jiten_freq_global` in callers.
// Root list should include default installed frequency-dictionary locations in callers.
if (sourcePath && sourcePath.trim()) {
rawSearchPaths.push(sourcePath.trim());
rawSearchPaths.push(path.join(sourcePath.trim(), 'frequency-dictionary'));

View File

@@ -53,9 +53,9 @@ test('frequency dictionary roots main handler returns expected root list', () =>
joinPath: (...parts) => parts.join('/'),
})();
assert.equal(roots.length, 15);
assert.equal(roots[0], '/repo/dist/main/../../vendor/jiten_freq_global');
assert.equal(roots[14], '/repo');
assert.equal(roots.length, 11);
assert.equal(roots[0], '/repo/dist/main/../../vendor/frequency-dictionary');
assert.equal(roots[10], '/repo');
});
test('frequency dictionary runtime main deps builder maps search paths/source and log prefix', () => {

View File

@@ -38,13 +38,9 @@ export function createBuildFrequencyDictionaryRootsMainHandler(deps: {
joinPath: (...parts: string[]) => string;
}) {
return () => [
deps.joinPath(deps.dirname, '..', '..', 'vendor', 'jiten_freq_global'),
deps.joinPath(deps.dirname, '..', '..', 'vendor', 'frequency-dictionary'),
deps.joinPath(deps.appPath, 'vendor', 'jiten_freq_global'),
deps.joinPath(deps.appPath, 'vendor', 'frequency-dictionary'),
deps.joinPath(deps.resourcesPath, 'jiten_freq_global'),
deps.joinPath(deps.resourcesPath, 'frequency-dictionary'),
deps.joinPath(deps.resourcesPath, 'app.asar', 'vendor', 'jiten_freq_global'),
deps.joinPath(deps.resourcesPath, 'app.asar', 'vendor', 'frequency-dictionary'),
deps.userDataPath,
deps.appUserDataPath,