Grammalecte  Check-in [48d2a67a6a]

Overview
Comment:[graphspell][js] remove importation dirt...
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | graphspell
Files: files | file ages | folders
SHA3-256: 48d2a67a6aa4de5b83b8e69d49fad9b1546b5ec3890150a6e4ed1503432d0a44
User & Date: olr on 2020-08-19 15:57:22
Other Links: manifest | tags
Context
2020-08-20
12:02
[fr] faux positifs et ajustements check-in: 11a61c0c94 user: olr tags: trunk, fr
2020-08-19
15:57
[graphspell][js] remove importation dirt... check-in: 48d2a67a6a user: olr tags: trunk, graphspell
15:53
[core][js] code clarification: separate specific inner functions from gc engine core check-in: 1975bd1394 user: olr tags: trunk, core
Changes

Modified graphspell-js/dawg.js from [239974bcc4] to [525275df92].

10
11
12
13
14
15
16



17

18
19
20
21
22
23
24
25
26
27
28
29
30
31
10
11
12
13
14
15
16
17
18
19

20
21


22
23


24
25
26
27
28
29
30







+
+
+
-
+

-
-


-
-








/* jshint esversion:6, -W097 */
/* jslint esversion:6 */
/* global require, exports, console, helpers */

"use strict";

${map}


if(typeof(process) !== 'undefined') {
if (typeof(process) !== 'undefined') {
    var str_transform = require("./str_transform.js");
} else if (typeof(require) !== 'undefined') {
    var str_transform = require("resource://grammalecte/graphspell/str_transform.js");
}

${map}


class DAWG {
    /*  DIRECT ACYCLIC WORD GRAPH
        This code is inspired from Steve Hanov’s DAWG, 2011. (http://stevehanov.ca/blog/index.php?id=115)
        We store suffix/affix codes and tags within the graph after the “real” word.
        A word is a list of numbers [ c1, c2, c3 . . . cN, iAffix, iTags]
        Each arc is an index in this.lArcVal, where are stored characters, suffix/affix codes for stemming and tags.

Modified graphspell-js/dic_merger.js from [e44b159d9d] to [dea1fd0b02].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
1
2
3
4
5
6
7
8




9
10
11
12
13
14
15








-
-
-
-







// Dictionaries merger

"use strict";

if (typeof(process) !== 'undefined') {
    var dawg = require("./dawg.js");
    var ibdawg = require("./ibdawg.js");
}
else if (typeof(require) !== 'undefined') {
    var dawg = require("resource://grammalecte/graphspell/dawg.js");
    var ibdawg = require("resource://grammalecte/graphspell/ibdawg.js");
}


const dic_merger = {

    merge: function (lDict, cStemming, sLangCode, sLangName, sDicName, sDescription, xProgressBar=null) {
        // merge a list of dictionaries (given as JSON objects)
        // return a merged dictionary as JSON object.
47
48
49
50
51
52
53
54

55
43
44
45
46
47
48
49

50








-
+
-
        }
        catch (e) {
            console.log("Dictionaries merger: unable to generate merged dictionary");
            console.error(e);
            return null;
        }
    }

}
}

Modified graphspell-js/ibdawg.js from [a6b92daf69] to [25fa8fe973].

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
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








-
-
-
-
-
-
-
-
-
-





+
+
+
+
+
+
+







// IBDAWG

/* jshint esversion:6, -W097 */
/* jslint esversion:6 */
/* global require, exports, console, __dirname */

"use strict";

if(typeof(process) !== 'undefined') {
    var str_transform = require("./str_transform.js");
    var helpers = require("./helpers.js");
    var char_player = require("./char_player.js");
} else if (typeof(require) !== 'undefined') {
    var str_transform = require("resource://grammalecte/graphspell/str_transform.js");
    var helpers = require("resource://grammalecte/graphspell/helpers.js");
    var char_player = require("resource://grammalecte/graphspell/char_player.js");
}

// Don’t remove <string>. Necessary in TB.
${string}
${map}
${set}


if (typeof(process) !== 'undefined') {
    var str_transform = require("./str_transform.js");
    var helpers = require("./helpers.js");
    var char_player = require("./char_player.js");
}


class SuggResult {
    // Structure for storing, classifying and filtering suggestions

    constructor (sWord, nDistLimit=-1) {
        this.sWord = sWord;
        this.sSimplifiedWord = str_transform.simplifyWord(sWord);

Modified graphspell-js/spellchecker.js from [af4645de50] to [be4f6fe289].

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
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22






23
24
25
26
27
28
29







+
+
+





-
-
-
-
-
-







// - 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";

${map}


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"]
]);

Modified graphspell-js/str_transform.js from [46f5d63858] to [85944d11a1].

1
2
3
4
5
6
7

8
9
10
11
12
13
14
15
16
17
18
19
1
2
3
4
5
6
7
8
9
10
11


12
13
14
15
16
17
18







+



-
-







// STRING TRANSFORMATION

/* jshint esversion:6, -W097 */
/* jslint esversion:6 */
/* global exports, console */

"use strict";


if (typeof(process) !== 'undefined') {
    var char_player = require("./char_player.js");
} else if (typeof(require) !== 'undefined') {
    var char_player = require("resource://grammalecte/graphspell/char_player.js");
}


// Note: 48 is the ASCII code for "0"

var str_transform = {