Grammalecte  Check-in [6ff5d2733a]

Overview
Comment:[fr][js] suggestion des graphies similaires
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | fr
Files: files | file ages | folders
SHA3-256: 6ff5d2733ac240ace0ed095f651f78c4d8d4e44ae411d8881e8e3cd6fe59eac1
User & Date: olr on 2017-10-10 13:40:13
Other Links: manifest | tags
Context
2017-10-10
15:51
[fr] sécurisation d’une condition check-in: 79a81f04cf user: olr tags: trunk, fr
14:30
merge trunk check-in: d25e2ed843 user: olr tags: webext3
13:40
[fr][js] suggestion des graphies similaires check-in: 6ff5d2733a user: olr tags: trunk, fr
13:09
[fr] pt: faire illusion check-in: 9680cc2a5f user: olr tags: trunk, fr
Changes

Modified gc_lang/fr/modules-js/conj.js from [57af7c3c72] to [20daa8dfaa].

79
80
81
82
83
84
85
86

87
88
89
90
91
92
93

94
95
96
97
98
99
100
79
80
81
82
83
84
85

86
87
88
89
90
91
92

93
94
95
96
97
98
99
100







-
+






-
+







        // returns raw informations about sVerb
        if (!this._dVerb.hasOwnProperty(sVerb)) {
            return null;
        }
        return this._lVtyp[this._dVerb[sVerb][0]];
    },

    getSimil: function (sWord, sMorph, sFilter=null) {
    getSimil: function (sWord, sMorph, bSubst=false) {
        if (!sMorph.includes(":V")) {
            return new Set();
        }
        let sInfi = sMorph.slice(1, sMorph.indexOf(" "));
        let tTags = this._getTags(sInfi);
        let aSugg = new Set();
        if (sMorph.includes(":Q") || sMorph.includes(":Y")) {
        if (!bSubst) {
            // we suggest conjugated forms
            if (sMorph.includes(":V1")) {
                aSugg.add(sInfi);
                aSugg.add(this._getConjWithTags(sInfi, tTags, ":Ip", ":3s"));
                aSugg.add(this._getConjWithTags(sInfi, tTags, ":Ip", ":2p"));
                aSugg.add(this._getConjWithTags(sInfi, tTags, ":Iq", ":1s"));
                aSugg.add(this._getConjWithTags(sInfi, tTags, ":Iq", ":3s"));
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
122
123
124
125
126
127
128



129
130
131
132
133
134
135







-
-
-







            aSugg.add(this._getConjWithTags(sInfi, tTags, ":PQ", ":Q3"));
            aSugg.add(this._getConjWithTags(sInfi, tTags, ":PQ", ":Q4"));
            aSugg.delete("");
            // if there is only one past participle (epi inv), unreliable.
            if (aSugg.size === 1) {
                aSugg.clear();
            }
            if (sMorph.includes(":V1")) {
                aSugg.add(sInfi);
            }
        }
        return aSugg;
    },

    _getTags: function (sVerb) {
        // returns tuple of tags (usable with functions _getConjWithTags and _hasConjWithTags)
        if (!this._dVerb.hasOwnProperty(sVerb)) {

Modified gc_lang/fr/modules-js/gce_suggestions.js from [0d3c06e52f] to [a844f36535].

486
487
488
489
490
491
492
493

494
495
496
497
498


499
500
501
502
503
504
505
486
487
488
489
490
491
492

493
494
495
496


497
498
499
500
501
502
503
504
505







-
+



-
-
+
+







    return "";
}

function hasSimil (sWord, sPattern=null) {
    return phonet.hasSimil(sWord, sPattern);
}

function suggSimil (sWord, sPattern) {
function suggSimil (sWord, sPattern=null, bSubst=false) {
    // return list of words phonetically similar to sWord and whom POS is matching sPattern
    let aSugg = phonet.selectSimil(sWord, sPattern);
    for (let sMorph of _dAnalyses.gl_get(sWord, [])) {
        for (let e of conj.getSimil(sWord, sMorph, sPattern)) {
            aSugg.add(e); 
        for (let e of conj.getSimil(sWord, sMorph, bSubst)) {
            aSugg.add(e);
        }
    }
    if (aSugg.size > 0) {
        return Array.from(aSugg).join("|");
    }
    return "";
}

Modified gc_lang/fr/modules-js/phonet.js from [b4e35b2c18] to [409fa52cbe].

62
63
64
65
66
67
68
69

70
71
72
73
74
75
76
62
63
64
65
66
67
68

69
70
71
72
73
74
75
76







-
+







                return this._lSet[this._dWord.get(sWord)];
            }
        }
        return [];
    },

    selectSimil: function (sWord, sPattern) {
        // return list of words phonetically similar to sWord and whom POS is matching sPattern
        // return a set of words phonetically similar to sWord and whom POS is matching sPattern
        if (!sPattern) {
            return new Set(this.getSimil(sWord));
        }
        let aSelect = new Set();
        for (let sSimil of this.getSimil(sWord)) {
            for (let sMorph of this._dMorph.gl_get(sSimil, [])) {
                if (sMorph.search(sPattern) >= 0) {