Grammalecte  Check-in [2be0562a74]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:[graphspell] import dictionary: include lang code in error message
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | graphspell
Files: files | file ages | folders
SHA3-256:2be0562a74955a244316b48eb4649d628223e6502632373234cbd2578315679d
User & Date: olr 2019-05-15 10:47:11
Context
2019-05-15
11:55
[graphspell][core][fr] code cleaning (pylint) check-in: c65b7e2b8b user: olr tags: core, fr, graphspell, trunk
10:47
[graphspell] import dictionary: include lang code in error message check-in: 2be0562a74 user: olr tags: graphspell, trunk
09:15
pylint: exclusion list check-in: a31e62962a user: olr tags: trunk
Changes

Changes to graphspell-js/spellchecker.js.

65
66
67
68
69
70
71

72
73

74
75

76
77
78
79
80
81
82
                return new ibdawg.IBDAWG(dictionary, sPath);  // dictionary can be a filename or a JSON object
            } else {
                return new IBDAWG(dictionary, sPath);  // dictionary can be a filename or a JSON object
            }
        }
        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(e.message);
            return null;
        }
    }

    loadTokenizer () {
        if (typeof(tokenizer) !== 'undefined') {







>

<
>

<
>







65
66
67
68
69
70
71
72
73

74
75

76
77
78
79
80
81
82
83
                return new ibdawg.IBDAWG(dictionary, sPath);  // dictionary can be a filename or a JSON object
            } else {
                return new IBDAWG(dictionary, sPath);  // dictionary can be a filename or a JSON object
            }
        }
        catch (e) {
            let sfDictionary = (typeof(dictionary) == "string") ? dictionary : dictionary.sLangName + "/" + dictionary.sFileName;
            let sErrorMessage = "Error [" + this.sLangCode + "]: <" + sfDictionary + "> not loaded.";
            if (bNecessary) {

                throw sErrorMessage + " | " + e.message;
            }

            console.log(sErrorMessage);
            console.log(e.message);
            return null;
        }
    }

    loadTokenizer () {
        if (typeof(tokenizer) !== 'undefined') {

Changes to graphspell/spellchecker.py.

46
47
48
49
50
51
52

53
54
55

56
57
58
59
60
61
62
    def _loadDictionary (self, source, bNecessary=False):
        "returns an IBDAWG object"
        if not source:
            return None
        try:
            return ibdawg.IBDAWG(source)
        except Exception as e:

            if bNecessary:
                raise Exception(str(e), "Error: <" + str(source) + "> not loaded.")
            print("Error: <" + str(source) + "> not loaded.")

            traceback.print_exc()
            return None

    def _loadTokenizer (self):
        self.oTokenizer = tokenizer.Tokenizer(self.sLangCode)

    def getTokenizer (self):







>

|
<
>







46
47
48
49
50
51
52
53
54
55

56
57
58
59
60
61
62
63
    def _loadDictionary (self, source, bNecessary=False):
        "returns an IBDAWG object"
        if not source:
            return None
        try:
            return ibdawg.IBDAWG(source)
        except Exception as e:
            sErrorMessage = "Error [" + self.sLangCode + "]: <" + str(source) + "> not loaded."
            if bNecessary:
                raise Exception(str(e), sErrorMessage)

            print(sErrorMessage)
            traceback.print_exc()
            return None

    def _loadTokenizer (self):
        self.oTokenizer = tokenizer.Tokenizer(self.sLangCode)

    def getTokenizer (self):