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
|
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
|
+
+
+
-
-
+
+
+
+
-
|
// Spellchecker
// Wrapper for the IBDAWG class.
// Useful to check several dictionaries at once.
// To avoid iterating over a pile of dictionaries, it is assumed that 3 are enough:
// - the main dictionary, bundled with the package
// - the extended dictionary
// - the community dictionary, added by an organization
// - the personal dictionary, created by the user for its own convenience
/* jshint esversion:6, -W097 */
/* jslint esversion:6 */
/* global require, exports, console, IBDAWG, Tokenizer */
"use strict";
if (typeof(require) !== 'undefined') {
if(typeof(process) !== 'undefined') {
var ibdawg = require("./ibdawg.js");
var tokenizer = require("./tokenizer.js");
} else if (typeof(require) !== 'undefined') {
var ibdawg = require("resource://grammalecte/graphspell/ibdawg.js");
var tokenizer = require("resource://grammalecte/graphspell/tokenizer.js");
}
${map}
const dDefaultDictionaries = new Map([
["fr", "fr-allvars.json"],
["en", "en.json"]
|
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
-
+
|
}
}
catch (e) {
let sfDictionary = (typeof(dictionary) == "string") ? dictionary : dictionary.sLangName + "/" + dictionary.sFileName;
if (bNecessary) {
throw "Error: <" + sfDictionary + "> not loaded. " + e.message;
}
console.log("Error: <" + sfDictionary + "> not loaded.")
console.log("Error: <" + sfDictionary + "> not loaded.");
console.log(e.message);
return null;
}
}
loadTokenizer () {
if (typeof(tokenizer) !== 'undefined') {
|