Grammalecte  Check-in [312cfd6793]

Overview
Comment:[graphspell] fix export and update showDistance()
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | graphspell
Files: files | file ages | folders
SHA3-256: 312cfd6793314bfa80d2613f9124220d1b9e2d211839567b7c60e31c41611fdc
User & Date: olr on 2020-12-03 14:44:18
Other Links: manifest | tags
Context
2020-12-03
20:59
[graphspell] spellchecker: fix function name check-in: a681336660 user: olr tags: trunk, graphspell
14:44
[graphspell] fix export and update showDistance() check-in: 312cfd6793 user: olr tags: trunk, graphspell
14:43
[fr] ajustements check-in: cd832d45da user: olr tags: trunk, fr
Changes

Modified graphspell-js/str_transform.js from [a1596e1ca3] to [2de0e81f6b].

249
250
251
252
253
254
255

256

257
258
259
260
261
262
263
249
250
251
252
253
254
255
256

257
258
259
260
261
262
263
264







+
-
+







          }
        }

        return weight;
    },

    showDistance (s1, s2) {
        console.log(`Distance Jaro-Winkler: ${s1} / ${s2} = ${this.distanceJaroWinkler(s1, s2)})`);
        console.log(`Distance: ${s1} / ${s2} = ${this.distanceDamerauLevenshtein(s1, s2)})`);
        console.log(`Distance Damerau-Levenshtein: ${s1} / ${s2} = ${this.distanceDamerauLevenshtein(s1, s2)})`);
    },

    // Suffix only
    defineSuffixCode: function (sFlex, sStem) {
        /*
            Returns a string defining how to get stem from flexion
                "n(sfx)"
337
338
339
340
341
342
343
344

345
346
347
348
349
350
338
339
340
341
342
343
344

345
346
347
348
349
350
351







-
+







if (typeof(exports) !== 'undefined') {
    exports.simplifyWord = str_transform.simplifyWord;
    exports.numbersToExponent = str_transform.numbersToExponent;
    exports.spellingNormalization = str_transform.spellingNormalization;
    exports.longestCommonSubstring = str_transform.longestCommonSubstring;
    exports.distanceDamerauLevenshtein = str_transform.distanceDamerauLevenshtein;
    exports.distanceDamerauLevenshtein2 = str_transform.distanceDamerauLevenshtein2;
    exports.distanceJaroWinkler = str_transform.distanceJaroWinkler;
    exports.showDistance = str_transform.showDistance;
    exports.changeWordWithSuffixCode = str_transform.changeWordWithSuffixCode;
    exports.changeWordWithAffixCode = str_transform.changeWordWithAffixCode;
    exports.defineAffixCode = str_transform.defineAffixCode;
    exports.defineSuffixCode = str_transform.defineSuffixCode;
}

Modified graphspell/str_transform.py from [ee895b8347] to [3aad4bb295].

250
251
252
253
254
255
256

257
258
259
260
261
262
263
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264







+







            i1 = i2 = min(i1, i2)
    nLargestCS += nLocalCS
    return round(max(nLen1, nLen2) - nLargestCS + nTrans)


def showDistance (s1, s2):
    "display Damerau-Levenshtein distance and Sift4 distance between <s1> and <s2>"
    print("Jaro-Winkler: " + s1 + "/" + s2 + " = " + distanceJaroWinkler(s1, s2))
    print("Damerau-Levenshtein: " + s1 + "/" + s2 + " = " + distanceDamerauLevenshtein(s1, s2))
    print("Sift4:" + s1 + "/" + s2 + " = " + distanceSift4(s1, s2))




#### STEMMING OPERATIONS