Grammalecte  Check-in [8959d8c2be]

Overview
Comment:[njs] core add Set Dictionary for main and personal
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | nodejs
Files: files | file ages | folders
SHA3-256: 8959d8c2beb0cdba291c52be10a34c82a45af3fce370ddca211bd28c21419028
User & Date: IllusionPerdu on 2018-10-21 21:45:37
Other Links: branch diff | manifest | tags
Context
2018-10-21
22:10
[njs] cli possibility to change main and personal dictionary check-in: e22e75159b user: IllusionPerdu tags: nodejs
21:45
[njs] core add Set Dictionary for main and personal check-in: 8959d8c2be user: IllusionPerdu tags: nodejs
17:31
[njs] Cli update doc with new command check-in: c4df2bb8f2 user: IllusionPerdu tags: nodejs
Changes

Modified gc_lang/fr/nodejs/core/api.js from [83bcbb9eeb] to [df78933803].

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
...
168
169
170
171
172
173
174
175

176
177

178
179
180
181
182
183
184
...
191
192
193
194
195
196
197








198
199
200
201
202
203
204
...
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
...
316
317
318
319
320
321
322
323
324
325
326
327
328
/* jshint esversion:6, -W097 */
/* jslint esversion:6 */
/* global require, exports, console */

"use strict";

class GrammarChecker {

    constructor(aInit, sLangCode = "fr", sContext = "Javascript") {
        this.sLangCode = sLangCode;
        this.sContext = sContext;

        //Importation des fichiers nécessaire
        this.sPathRoot = __dirname + "/grammalecte";
        this._helpers = require(this.sPathRoot + "/graphspell/helpers.js");
................................................................................
        return Array.from(this._oGce.getIgnoreRules());
    }

    setGceIgnoreRule (sRuleId, bValue) {
        if (!this.isInit.Grammalecte) {
            this.load(["Grammalecte"]);
        }
        if (bValue){ //Add

            this._oGce.ignoreRule(sRuleId);
        } else {     //Delete

            this._oGce.reactivateRule(sRuleId);
        }
        return Array.from(this._oGce.getIgnoreRules());
    }

    resetGceIgnoreRules () {
        if (!this.isInit.Grammalecte) {
................................................................................
    //Fonctions concernant: Graphspell
    getGraphspell(){
        if (!this.isInit.Graphspell) {
            this.load(["Graphspell"]);
        }
        return this.oSpellChecker;
    }









    spellParagraph(sText, bSuggest = true){
        if (!this.isInit.Graphspell) {
            this.load(["Graphspell"]);
        }
        if (bSuggest){
            let lError = this.oSpellChecker.parseParagraph(sText);
................................................................................
                    lSuggestRep.push(word);
                }
            }
            return lSuggestRep;
        } else {
            return Array.from(lSuggest);
        }

    }

    lemma(sWord){
        if (!this.isInit.Graphspell) {
            this.load(["Graphspell"]);
        }
        return this.oSpellChecker.getLemma(sWord);
................................................................................
            this.load(["Grammalecte"]);
        }
        return {
            lGrammarErrors: Array.from(this._oGce.parse(sText, this.sLangCode)),
            lSpellingErrors: this.spellParagraph(sText, bSuggest)
        };
    }

}

if (typeof exports !== "undefined") {
    exports.GrammarChecker = GrammarChecker;
}







<







 







|
>

|
>







 







>
>
>
>
>
>
>
>







 







<







 







<





6
7
8
9
10
11
12

13
14
15
16
17
18
19
...
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
...
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
...
239
240
241
242
243
244
245

246
247
248
249
250
251
252
...
324
325
326
327
328
329
330

331
332
333
334
335
/* jshint esversion:6, -W097 */
/* jslint esversion:6 */
/* global require, exports, console */

"use strict";

class GrammarChecker {

    constructor(aInit, sLangCode = "fr", sContext = "Javascript") {
        this.sLangCode = sLangCode;
        this.sContext = sContext;

        //Importation des fichiers nécessaire
        this.sPathRoot = __dirname + "/grammalecte";
        this._helpers = require(this.sPathRoot + "/graphspell/helpers.js");
................................................................................
        return Array.from(this._oGce.getIgnoreRules());
    }

    setGceIgnoreRule(sRuleId, bValue) {
        if (!this.isInit.Grammalecte) {
            this.load(["Grammalecte"]);
        }
        if (bValue) {
            //Add
            this._oGce.ignoreRule(sRuleId);
        } else {
            //Delete
            this._oGce.reactivateRule(sRuleId);
        }
        return Array.from(this._oGce.getIgnoreRules());
    }

    resetGceIgnoreRules() {
        if (!this.isInit.Grammalecte) {
................................................................................
    //Fonctions concernant: Graphspell
    getGraphspell() {
        if (!this.isInit.Graphspell) {
            this.load(["Graphspell"]);
        }
        return this.oSpellChecker;
    }

    setMainDictionary(dictionary, sPath = "") {
        return this.oSpellChecker.setMainDictionary(dictionary, sPath);
    }

    setPersonalDictionary(dictionary, sPath = "", bActivate = true) {
        return this.oSpellChecker.setPersonalDictionary(dictionary, sPath, bActivate);
    }

    spellParagraph(sText, bSuggest = true) {
        if (!this.isInit.Graphspell) {
            this.load(["Graphspell"]);
        }
        if (bSuggest) {
            let lError = this.oSpellChecker.parseParagraph(sText);
................................................................................
                    lSuggestRep.push(word);
                }
            }
            return lSuggestRep;
        } else {
            return Array.from(lSuggest);
        }

    }

    lemma(sWord) {
        if (!this.isInit.Graphspell) {
            this.load(["Graphspell"]);
        }
        return this.oSpellChecker.getLemma(sWord);
................................................................................
            this.load(["Grammalecte"]);
        }
        return {
            lGrammarErrors: Array.from(this._oGce.parse(sText, this.sLangCode)),
            lSpellingErrors: this.spellParagraph(sText, bSuggest)
        };
    }

}

if (typeof exports !== "undefined") {
    exports.GrammarChecker = GrammarChecker;
}