Grammalecte  Check-in [6c22a745d0]

Overview
Comment:[graphspell][js] spellchecker: option to activate dictionary while loading
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | graphspell | multid
Files: files | file ages | folders
SHA3-256: 6c22a745d0af99040aca340ab6bebbe5c18aaaa3ea064410ea2f31f0c384673d
User & Date: olr on 2018-03-31 12:35:19
Other Links: branch diff | manifest | tags
Context
2018-03-31
12:46
[graphspell][py] spellchecker: return value is success of dictionary loading check-in: 274f43cc25 user: olr tags: graphspell, multid
12:35
[graphspell][js] spellchecker: option to activate dictionary while loading check-in: 6c22a745d0 user: olr tags: graphspell, multid
12:34
[graphspell][py] spellchecker: option to activate dictionary while loading check-in: 2349600755 user: olr tags: graphspell, multid
Changes

Modified graphspell-js/spellchecker.js from [ecdde041f7] to [f1453842f8].

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
..
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
        this.oPersonalDic = this._loadDictionary(personalDic, sPath);
        this.bExtendedDic = Boolean(this.oExtendedDic);
        this.bCommunityDic = Boolean(this.oCommunityDic);
        this.bPersonalDic = Boolean(this.oPersonalDic);
        this.oTokenizer = null;
    }

    _loadDictionary (dictionary, sPath, bNecessary=false) {
        // returns an IBDAWG object
        if (!dictionary) {
            return null;
        }
        try {
            if (typeof(ibdawg) !== 'undefined') {
                return new ibdawg.IBDAWG(dictionary);  // dictionary can be a filename or a JSON object
................................................................................
    getTokenizer () {
        if (!this.oTokenizer) {
            this.loadTokenizer();
        }
        return this.oTokenizer;
    }

    setMainDictionary (dictionary) {
        // returns true if the dictionary is loaded
        this.oMainDic = this._loadDictionary(dictionary);
        return Boolean(this.oMainDic);
    }

    setExtendedDictionary (dictionary) {
        // returns true if the dictionary is loaded
        this.oExtendedDic = this._loadDictionary(dictionary);
        this.bExtendedDic = Boolean(this.oExtendedDic);
        return this.bExtendedDic;
    }

    setCommunityDictionary (dictionary) {
        // returns true if the dictionary is loaded
        this.oCommunityDic = this._loadDictionary(dictionary);
        this.bCommunityDic = Boolean(this.oCommunityDic);
        return this.bCommunityDic;
    }

    setPersonalDictionary (dictionary) {
        // returns true if the dictionary is loaded
        this.oPersonalDic = this._loadDictionary(dictionary);
        this.bPersonalDic = Boolean(this.oPersonalDic);
        return this.bPersonalDic;
    }

    activateExtendedDictionary () {
        this.bExtendedDic = Boolean(this.oExtendedDic);
    }








|







 







|

|



|

|
|



|

|
|



|

|
|







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
..
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
        this.oPersonalDic = this._loadDictionary(personalDic, sPath);
        this.bExtendedDic = Boolean(this.oExtendedDic);
        this.bCommunityDic = Boolean(this.oCommunityDic);
        this.bPersonalDic = Boolean(this.oPersonalDic);
        this.oTokenizer = null;
    }

    _loadDictionary (dictionary, sPath="", bNecessary=false) {
        // returns an IBDAWG object
        if (!dictionary) {
            return null;
        }
        try {
            if (typeof(ibdawg) !== 'undefined') {
                return new ibdawg.IBDAWG(dictionary);  // dictionary can be a filename or a JSON object
................................................................................
    getTokenizer () {
        if (!this.oTokenizer) {
            this.loadTokenizer();
        }
        return this.oTokenizer;
    }

    setMainDictionary (dictionary, sPath="") {
        // returns true if the dictionary is loaded
        this.oMainDic = this._loadDictionary(dictionary, sPath, true);
        return Boolean(this.oMainDic);
    }

    setExtendedDictionary (dictionary, sPath="", bActivate=true) {
        // returns true if the dictionary is loaded
        this.oExtendedDic = this._loadDictionary(dictionary, sPath);
        this.bExtendedDic = (bActivate) ? Boolean(this.oExtendedDic) : false;
        return this.bExtendedDic;
    }

    setCommunityDictionary (dictionary, sPath="", bActivate=true) {
        // returns true if the dictionary is loaded
        this.oCommunityDic = this._loadDictionary(dictionary, sPath);
        this.bCommunityDic = (bActivate) ? Boolean(this.oCommunityDic) : false;
        return this.bCommunityDic;
    }

    setPersonalDictionary (dictionary, sPath="", bActivate=true) {
        // returns true if the dictionary is loaded
        this.oPersonalDic = this._loadDictionary(dictionary, sPath);
        this.bPersonalDic = (bActivate) ? Boolean(this.oPersonalDic) : false;
        return this.bPersonalDic;
    }

    activateExtendedDictionary () {
        this.bExtendedDic = Boolean(this.oExtendedDic);
    }