Grammalecte  Check-in [2bfe79e9aa]

Overview
Comment:[graphspell][js] str_transform: fix cleanWord()
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | graphspell | bdic_opt
Files: files | file ages | folders
SHA3-256: 2bfe79e9aa31c8ac7f218f12dff3b5256b22a85cae9757f22eabd0af7ae542b2
User & Date: olr on 2020-09-15 14:09:34
Original Comment: [graphspell] str_transform: fix cleanWord()
Other Links: branch diff | manifest | tags
Context
2020-09-15
16:57
[graphspell][py] suggestion: use Jaro-Winkler check-in: 7db21c89fd user: olr tags: graphspell, bdic_opt
14:09
[graphspell][js] str_transform: fix cleanWord() check-in: 2bfe79e9aa user: olr tags: graphspell, bdic_opt
14:01
[graphspell][js] remove specific trick in cleanWord() check-in: 6569849b49 user: olr tags: graphspell, bdic_opt
Changes

Modified graphspell-js/str_transform.js from [f62ed68e13] to [3bf8e3b480].

66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
        }
        return sNewWord.replace(/eau/g, "o").replace(/au/g, "o").replace(/ai/g, "éi").replace(/ei/g, "é").replace(/ph/g, "f");
    },

    cleanWord: function (sWord) {
        // word clean for the user who make commun and preditive error help suggest
        // remove letters repeated more than 2 times
        if (sWord.match(/(.)(\1){2,}/igm)){
            sWord = sWord.replace(/(.*)(.)(.\2)/igm,'$1$2').replace(/(.)(\1)+/igm,'$1$1');
        }
        return sWord;
    },

    _xTransNumbersToExponent: new Map([
        ["0", "⁰"], ["1", "¹"], ["2", "²"], ["3", "³"], ["4", "⁴"], ["5", "⁵"], ["6", "⁶"], ["7", "⁷"], ["8", "⁸"], ["9", "⁹"]
    ]),

    numbersToExponent: function (sWord) {







<
<
<
|







66
67
68
69
70
71
72



73
74
75
76
77
78
79
80
        }
        return sNewWord.replace(/eau/g, "o").replace(/au/g, "o").replace(/ai/g, "éi").replace(/ei/g, "é").replace(/ph/g, "f");
    },

    cleanWord: function (sWord) {
        // word clean for the user who make commun and preditive error help suggest
        // remove letters repeated more than 2 times



        return sWord.replace(/(.)\1{2,}/ig,'$1$1');
    },

    _xTransNumbersToExponent: new Map([
        ["0", "⁰"], ["1", "¹"], ["2", "²"], ["3", "³"], ["4", "⁴"], ["5", "⁵"], ["6", "⁶"], ["7", "⁷"], ["8", "⁸"], ["9", "⁹"]
    ]),

    numbersToExponent: function (sWord) {