path splitting
This commit is contained in:
parent
008126c5f4
commit
b4d5966550
@ -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) {
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user