From b4d59665507af93123bafeec639051385cebf8e6 Mon Sep 17 00:00:00 2001 From: apex Date: Sat, 28 Jun 2025 02:31:28 -0400 Subject: [PATCH] path splitting --- gendictionary.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gendictionary.js b/gendictionary.js index 944e0f5..cd237e1 100644 --- a/gendictionary.js +++ b/gendictionary.js @@ -16,7 +16,7 @@ reader.on('line', (line) => { iter++; console.log("Iteration Number: "+iter.toString()); let entry = JSON.parse(line); - let thispath = path + entry.word + "/" + entry.pos + "/"; + let thispath = path + getPath(entry.word) + entry.pos + "/"; console.log(thispath); if (!fs.existsSync(thispath)) { initializeDir(thispath); @@ -29,6 +29,15 @@ reader.on('line', (line) => { }); +function getPath(word){ + let path = ""; + for (let i = 0; i < word.length; i+=2){ + path += word[i] + (word[i+1] ?? ""); + path += "/"; + } + return path; +} + function writeThesaurus(thispath, entry) { }