-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
32 lines (28 loc) · 1015 Bytes
/
index.js
File metadata and controls
32 lines (28 loc) · 1015 Bytes
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
var Spellchecker = require("hunspell-spellchecker");
var fs = require('fs')
var spellchecker = new Spellchecker();
var DICT = spellchecker.parse({
aff: fs.readFileSync("./si_LK.aff"),
dic: fs.readFileSync("./si_LK.dic")
});
fs.readFile("./autocorrectionWords.txt", 'utf8', function(err, data) {
if (err) throw err;
var autolist = data.split('\n');
var incorrectlist = [];
var correctlist = [];
for (const index in autolist) {
const oneset = autolist[index]
var incorrect = oneset.split(':')[0];
var correct = oneset.split(':')[1];
incorrectlist.push(incorrect);
correctlist.push(correct);
}
window.incorrectlist1 = incorrectlist;
window.correctlist1 = correctlist;
});
window.spellchecker = spellchecker;
window.checkSpell = function () {
var texttocheck = document.getElementById("TextToCheck").value;
const UIHandler = require('./UIHandler')
UIHandler("output",texttocheck.split(' '))
}