blob: 11c591240eee727d174c256cbd2042b567e583a3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
const langs = require('./languages.json');
try {
old = new Date();
console.log("LangDetect Autotraining v1, using LangDetect Training API v1");
const train = require('./filer');
const fs = require('fs');
global.__train_totallangs = 0;
global.__train_donelangs = 0;
langs.forEach((lang) => {
if (fs.existsSync("./train/" + lang.code)) {
__train_totallangs++;
}
})
langs.forEach((lang) => {
if (fs.existsSync("./train/" + lang.code)) {
console.log("Starting training in " + lang.name + "...");
train(lang.code);
__train_donelangs++;
}
})
rec = new Date();
diff = rec - old;
dp = Math.ceil(diff / 1000);
console.log("Done in " + dp + " seconds");
} catch (e) {
if (e.message == "Unexpected end of JSON input") {
console.log("Unable to open database file. Is the databased opened by another program? Or is it corrupted?");
} else {
throw e;
}
}
|