From c3f3f37472464f1c6b3954121bf04630d302cb78 Mon Sep 17 00:00:00 2001 From: "Daniel W. Hieber" Date: Wed, 5 Jan 2022 14:16:54 -0700 Subject: [PATCH] fixes --- lib/aggregate/index.js | 2 +- lib/import/CW-sources.js | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/aggregate/index.js b/lib/aggregate/index.js index c16c742..8e04bea 100644 --- a/lib/aggregate/index.js +++ b/lib/aggregate/index.js @@ -294,7 +294,7 @@ export default async function aggregate(dbPath, outPath = `out.ndjson`) { let entries = await readNDJSON(dbPath); entries = entries.filter(entry => { - if (!entry.dataSources.CW) return true; + if (!entry.dataSources.CW) return false; return entry.dataSources.CW.dialects.includes(`plai1258`); }); diff --git a/lib/import/CW-sources.js b/lib/import/CW-sources.js index ba2c7ab..5bd259d 100644 --- a/lib/import/CW-sources.js +++ b/lib/import/CW-sources.js @@ -96,9 +96,9 @@ export default async function importCWSources(sourcesPath, toolboxPath, outPath for (const entry of originalEntries) { const originalStem = entry.head - .replace(/^-/u, ``) // remove leading hyphen - .replace(/-$/u, ``) // remove trailing hyphen - .replace(/Y/gu, `ý`); + .replace(/^-/u, ``) // remove leading hyphen + .replace(/-$/u, ``) // remove trailing hyphen + .replace(/Y/gu, `y`); // normalize historical /ý/ const converted = [originalStem]; const dependent = []; @@ -161,10 +161,12 @@ export default async function importCWSources(sourcesPath, toolboxPath, outPath // NA // - remove postconsonantal final /w/ - // - add final /a/ (NA-4, NA-4w) + // - add final -a (NA-4, NA-4w) + // - add final -ak (NA-3) if (entry.POS === `NA`) { if (wFinalRegExp.test(originalStem)) converted.push(originalStem.replace(/w$/u, ``)); converted.push(`${ originalStem }a`); + converted.push(`${ originalStem }ak`); continue; } @@ -256,15 +258,16 @@ export default async function importCWSources(sourcesPath, toolboxPath, outPath for (const currentEntry of toolboxEntries) { - const existingEntry = index.get(currentEntry.sro); + const normalizedHead = currentEntry.sro.replace(/ý/gu, `y`); // normalize historical /ý/ + const existingEntry = index.get(normalizedHead); if (existingEntry) { if (Array.isArray(existingEntry)) existingEntry.push(currentEntry); - else index.set(currentEntry.sro, [existingEntry, currentEntry]); + else index.set(normalizedHead, [existingEntry, currentEntry]); continue; } - index.set(currentEntry.sro, currentEntry); + index.set(normalizedHead, currentEntry); }