67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
-
+
-
+
-
+
-
+
-
+
-
+
|
gce.load(sContext);
oDict = gce.getDictionary();
oLxg = new lxg.Lexicographe(oDict);
if (sGCOptions !== "") {
gce.setOptions(helpers.objectToMap(JSON.parse(sGCOptions)));
}
// we always retrieve options from the gce, for setOptions filters obsolete options
return gce.getOptions()._toString();
return gce.getOptions().gl_toString();
}
catch (e) {
worker.log("# Error: " + e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message);
}
}
}
function parse (sText, sLang, bDebug, bContext) {
let aGrammErr = gce.parse(sText, sLang, bDebug, bContext);
return JSON.stringify(aGrammErr);
}
function parseAndSpellcheck (sText, sLang, bDebug, bContext) {
let aGrammErr = gce.parse(sText, sLang, bDebug, bContext);
let aSpellErr = oTokenizer.getSpellingErrors(sText, oDict);
return JSON.stringify({ aGrammErr: aGrammErr, aSpellErr: aSpellErr });
}
function getOptions () {
return gce.getOptions()._toString();
return gce.getOptions().gl_toString();
}
function getDefaultOptions () {
return gce.getDefaultOptions()._toString();
return gce.getDefaultOptions().gl_toString();
}
function setOptions (sGCOptions) {
gce.setOptions(helpers.objectToMap(JSON.parse(sGCOptions)));
return gce.getOptions()._toString();
return gce.getOptions().gl_toString();
}
function setOption (sOptName, bValue) {
gce.setOptions(new Map([ [sOptName, bValue] ]));
return gce.getOptions()._toString();
return gce.getOptions().gl_toString();
}
function resetOptions () {
gce.resetOptions();
return gce.getOptions()._toString();
return gce.getOptions().gl_toString();
}
function fullTests (sGCOptions="") {
if (!gce || !oDict) {
return "# Error: grammar checker or dictionary not loaded."
}
let dMemoOptions = gce.getOptions();
|