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) { }