path splitting

This commit is contained in:
apex 2025-06-28 02:31:28 -04:00
parent 008126c5f4
commit b4d5966550

View File

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