Grammalecte  Check-in [0d6362e947]

Overview
Comment:[graphspell][js] char_player: simplifyWord -> code clarification
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | graphspell
Files: files | file ages | folders
SHA3-256: 0d6362e9476e6dd8ab09df3a6473844b48cbb888c3a174a4d7c37e7ead58d495
User & Date: olr on 2018-06-09 13:25:37
Other Links: manifest | tags
Context
2018-06-09
13:30
[graphspell] char_player: don’t remove double <e> in simplifyWord check-in: 496180aadf user: olr tags: trunk, graphspell
13:25
[graphspell][js] char_player: simplifyWord -> code clarification check-in: 0d6362e947 user: olr tags: trunk, graphspell
2018-06-08
09:40
[fr] faux positifs: mission impossible check-in: b4a483f6ec user: olr tags: trunk, fr
Changes

Modified graphspell-js/char_player.js from [c2f75d3e03] to [ee4109e576].

28
29
30
31
32
33
34

35
36
37
38
39
40
41
42
43
44
45
46
47
48
        ['œ', 'oe'], ['æ', 'ae'], 
        ['ſ', 's'],  ['ffi', 'ffi'],  ['ffl', 'ffl'],  ['ff', 'ff'],  ['ſt', 'ft'],  ['fi', 'fi'],  ['fl', 'fl'],  ['st', 'st']
    ]),

    simplifyWord: function (sWord) {
        // word simplication before calculating distance between words
        sWord = sWord.toLowerCase();

        let sNewWord = "";
        let i = 1;
        for (let c of sWord) {
            let cNew = this._xTransCharsForSimplification.gl_get(c, c);
            let cNext = sWord.slice(i, i+1)
            if (cNew != this._xTransCharsForSimplification.gl_get(cNext, cNext)) {
                sNewWord += cNew;
            }
            i++;
        }
        return sNewWord.replace(/eau/g, "o").replace(/au/g, "o").replace(/ai/g, "e").replace(/ei/g, "e").replace(/ph/g, "f");
    },

    aVowel: new Set("aáàâäāeéèêëēiíìîïīoóòôöōuúùûüūyýỳŷÿȳœæAÁÀÂÄĀEÉÈÊËĒIÍÌÎÏĪOÓÒÔÖŌUÚÙÛÜŪYÝỲŶŸȲŒÆ"),







>



<
|
<
|







28
29
30
31
32
33
34
35
36
37
38

39

40
41
42
43
44
45
46
47
        ['œ', 'oe'], ['æ', 'ae'], 
        ['ſ', 's'],  ['ffi', 'ffi'],  ['ffl', 'ffl'],  ['ff', 'ff'],  ['ſt', 'ft'],  ['fi', 'fi'],  ['fl', 'fl'],  ['st', 'st']
    ]),

    simplifyWord: function (sWord) {
        // word simplication before calculating distance between words
        sWord = sWord.toLowerCase();
        sWord = ([...sWord].map(c => this._xTransCharsForSimplification.gl_get(c, c))).join('')
        let sNewWord = "";
        let i = 1;
        for (let c of sWord) {

            if (c != sWord.slice(i, i+1)) {

                sNewWord += c;
            }
            i++;
        }
        return sNewWord.replace(/eau/g, "o").replace(/au/g, "o").replace(/ai/g, "e").replace(/ei/g, "e").replace(/ph/g, "f");
    },

    aVowel: new Set("aáàâäāeéèêëēiíìîïīoóòôöōuúùûüūyýỳŷÿȳœæAÁÀÂÄĀEÉÈÊËĒIÍÌÎÏĪOÓÒÔÖŌUÚÙÛÜŪYÝỲŶŸȲŒÆ"),