Grammalecte  Diff

Differences From Artifact [9439cc3700]:

To Artifact [03aa2c6aa7]:


85
86
87
88
89
90
91
92

93

94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139


140


141

142
143
144
145
146
147
148
149
150
        // returns raw informations about sVerb
        if (!this._dVerb.hasOwnProperty(sVerb)) {
            return null;
        }
        return this._lVtyp[this._dVerb[sVerb][0]];
    },

    getSimil: function (sWord, sMorph, bSubst=false) {

        if (!sMorph.includes(":V")) {

            return new Set();
        }
        let sInfi = sMorph.slice(1, sMorph.indexOf("/"));
        let aSugg = new Set();
        let tTags = this._getTags(sInfi);
        if (tTags) {
            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"));
                    aSugg.add(this._getConjWithTags(sInfi, tTags, ":Iq", ":3p"));
                } else if (sMorph.includes(":V2")) {
                    aSugg.add(this._getConjWithTags(sInfi, tTags, ":Ip", ":1s"));
                    aSugg.add(this._getConjWithTags(sInfi, tTags, ":Ip", ":3s"));
                } else if (sMorph.includes(":V3")) {
                    aSugg.add(this._getConjWithTags(sInfi, tTags, ":Ip", ":1s"));
                    aSugg.add(this._getConjWithTags(sInfi, tTags, ":Ip", ":3s"));
                    aSugg.add(this._getConjWithTags(sInfi, tTags, ":Is", ":1s"));
                    aSugg.add(this._getConjWithTags(sInfi, tTags, ":Is", ":3s"));
                } else if (sMorph.includes(":V0a")) {
                    aSugg.add("eus");
                    aSugg.add("eut");
                } else {
                    aSugg.add("étais");
                    aSugg.add("était");
                }
                aSugg.delete("");
            } else {
                if (this._dVerbNames.hasOwnProperty(sInfi)) {
                    // there are names derivated from the verb
                    aSugg.gl_update(this._dVerbNames[sInfi]);
                } else {
                    // we suggest past participles
                    aSugg.add(this._getConjWithTags(sInfi, tTags, ":PQ", ":Q1"));
                    aSugg.add(this._getConjWithTags(sInfi, tTags, ":PQ", ":Q2"));
                    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();
                    }


                }


            }

        }
        return aSugg;
    },

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







|
>
|
>
|
|
<
|
|
|
<
<
<
<
|
|
<
<
<
<
<
<
<
<
<
<
<
<
|
<
<
<
<

<
<
<
<
<
<
<
<
<
|
|
<
<
<
<
|
>
>

>
>

>

<







85
86
87
88
89
90
91
92
93
94
95
96
97

98
99
100




101
102












103




104









105
106




107
108
109
110
111
112
113
114
115

116
117
118
119
120
121
122
        // returns raw informations about sVerb
        if (!this._dVerb.hasOwnProperty(sVerb)) {
            return null;
        }
        return this._lVtyp[this._dVerb[sVerb][0]];
    },

    getNamesFrom: function (sVerb) {
        // returns a list of names derivating from <sVerb>
        if (this._dVerbNames.hasOwnProperty(sVerb)) {
            // there are names derivated from the verb
            return this._dVerbNames[sVerb];
        } else {

            // we suggest past participles
            let tTags = this._getTags(sVerb);
            if (tTags) {




                let aSugg = [ this._getConjWithTags(sVerb, tTags, ":PQ", ":Q1") ];
                if (this._hasConjWithTags(tTags, ":PQ", ":Q2")) {












                    aSugg.push(this._getConjWithTags(sVerb, tTags, ":PQ", ":Q2"));




                }









                if (this._hasConjWithTags(tTags, ":PQ", ":Q3")) {
                    aSugg.push(this._getConjWithTags(sVerb, tTags, ":PQ", ":Q3"));




                }
                if (this._hasConjWithTags(tTags, ":PQ", ":Q4")) {
                    aSugg.push(this._getConjWithTags(sVerb, tTags, ":PQ", ":Q4"));
                }
                // if there is only one past participle (epi inv), unreliable.
                return (aSugg.length > 1) ? aSugg : [];
            }
            return [];
        }

    },

    _getTags: function (sVerb) {
        // returns tuple of tags (usable with functions _getConjWithTags and _hasConjWithTags)
        if (!this._dVerb.hasOwnProperty(sVerb)) {
            return null;
        }
634
635
636
637
638
639
640
641
642
643
644
645
646
647
    exports._dImpeProNegEn = conj._dImpeProNegEn;
    exports._dGroup = conj._dGroup;
    exports._dTenseIdx = conj._dTenseIdx;
    exports.isVerb = conj.isVerb;
    exports.getConj = conj.getConj;
    exports.hasConj = conj.hasConj;
    exports.getVtyp = conj.getVtyp;
    exports.getSimil = conj.getSimil;
    exports._getTags = conj._getTags;
    exports._getConjWithTags = conj._getConjWithTags;
    exports._hasConjWithTags = conj._hasConjWithTags;
    exports._modifyStringWithSuffixCode = conj._modifyStringWithSuffixCode;
    exports.Verb = Verb;
}







|






606
607
608
609
610
611
612
613
614
615
616
617
618
619
    exports._dImpeProNegEn = conj._dImpeProNegEn;
    exports._dGroup = conj._dGroup;
    exports._dTenseIdx = conj._dTenseIdx;
    exports.isVerb = conj.isVerb;
    exports.getConj = conj.getConj;
    exports.hasConj = conj.hasConj;
    exports.getVtyp = conj.getVtyp;
    exports.getNamesFrom = conj.getNamesFrom;
    exports._getTags = conj._getTags;
    exports._getConjWithTags = conj._getConjWithTags;
    exports._hasConjWithTags = conj._hasConjWithTags;
    exports._modifyStringWithSuffixCode = conj._modifyStringWithSuffixCode;
    exports.Verb = Verb;
}