Grammalecte  Diff

Differences From Artifact [8bdb9ef82a]:

To Artifact [5b98fc996d]:


176
177
178
179
180
181
182
183


184
185
186



187
188
189

190
191

192
193
194
195
196
197

198




199
200


201
202
203
204
205
206
207
208
209
210
211
212
176
177
178
179
180
181
182

183
184
185
186
187
188
189
190
191
192

193
194

195
196
197
198
199
200

201
202
203
204
205
206


207
208
209
210
211
212

213
214
215
216
217
218
219







-
+
+



+
+
+


-
+

-
+





-
+

+
+
+
+
-
-
+
+




-







        }
    }
};


class Verb {

    constructor (sVerb) {
    constructor (sVerb, sVerbPattern="") {
        // conjugate a unknown verb with rules from sVerbPattern
        if (typeof sVerb !== "string" || sVerb === "") {
            throw new TypeError ("The value should be a non-empty string");
        }
        if (sVerbPattern.length == 0) {
            sVerbPattern = sVerb;
        }
        this.sVerb = sVerb;
        this.sVerbAux = "";
        this._sRawInfo = conj.getVtyp(this.sVerb);
        this._sRawInfo = conj.getVtyp(sVerbPattern);
        this.sInfo = this._readableInfo(this._sRawInfo);
        this._tTags = conj._getTags(sVerb);
        this._tTags = conj._getTags(sVerbPattern);
        this._tTagsAux = conj._getTags(this.sVerbAux);
        this.bProWithEn = (this._sRawInfo[5] === "e");
        this.dConj = new Map ([
            [":Y", new Map ([
                ["label", "Infinitif"],
                [":Y", sVerb]
                [":", sVerb]
            ])],
            [":P", new Map ([
                ["label", "Participe présent"],
                [":", conj._getConjWithTags(sVerb, this._tTags, ":PQ", ":P")]
            ])],
            [":PQ", new Map ([
                ["label", "Participes passés et présent"],
            [":Q", new Map ([
                ["label", "Participes passés"],
                [":Q1", conj._getConjWithTags(sVerb, this._tTags, ":PQ", ":Q1")],
                [":Q2", conj._getConjWithTags(sVerb, this._tTags, ":PQ", ":Q2")],
                [":Q3", conj._getConjWithTags(sVerb, this._tTags, ":PQ", ":Q3")],
                [":Q4", conj._getConjWithTags(sVerb, this._tTags, ":PQ", ":Q4")],
                [":P", conj._getConjWithTags(sVerb, this._tTags, ":PQ", ":P")]
            ])],
            [":Ip", new Map ([
                ["label", "Présent"],
                [":1s", conj._getConjWithTags(sVerb, this._tTags, ":Ip", ":1s")],
                [":1ś", conj._getConjWithTags(sVerb, this._tTags, ":Ip", ":1ś")],
                [":2s", conj._getConjWithTags(sVerb, this._tTags, ":Ip", ":2s")],
                [":3s", conj._getConjWithTags(sVerb, this._tTags, ":Ip", ":3s")],
330
331
332
333
334
335
336
337

338
339
340
341

342
343
344
345
346
347
348

349
350
351
352
353
354
355
337
338
339
340
341
342
343

344
345
346
347

348
349
350
351
352
353
354

355
356
357
358
359
360
361
362







-
+



-
+






-
+







        if (bInt) {
            sInfi += " … ?";
        }
        return sInfi;
    }

    participePasse (sWho) {
        return this.dConj.get(":PQ").get(sWho);
        return this.dConj.get(":Q").get(sWho);
    }

    participePresent (bPro, bNeg, bTpsCo, bInt, bFem) {
        if (!this.dConj.get(":PQ").get(":P")) {
        if (!this.dConj.get(":P").get(":")) {
            return "";
        }
        let sPartPre;
        if (bTpsCo) {
            sPartPre = (!bPro) ? conj._getConjWithTags(this.sVerbAux, this._tTagsAux, ":PQ", ":P") : conj.getConj("être", ":PQ", ":P");
        } else {
            sPartPre = this.dConj.get(":PQ").get(":P");
            sPartPre = this.dConj.get(":P").get(":");
        }
        if (sPartPre === "") {
            return "";
        }
        let bEli = conj._zStartVoy.test(sPartPre);
        if (bPro) {
            if (this.bProWithEn) {
465
466
467
468
469
470
471
472

473
474
475

476
477
478

479
480

481
482
483
484
485
486
487
472
473
474
475
476
477
478

479
480
481

482
483
484

485
486

487
488
489
490
491
492
493
494







-
+


-
+


-
+

-
+







            return sImpe + " " + this._seekPpas(bPro, bFem, sWho.endsWith("p") || this._sRawInfo[5] == "r");
        }
        return sImpe;
    }

    _seekPpas (bPro, bFem, bPlur) {
        if (!bPro && this.sVerbAux == "avoir") {
            return this.dConj.get(":PQ").get(":Q1");
            return this.dConj.get(":Q").get(":Q1");
        }
        if (!bFem) {
            return (bPlur && this.dConj.get(":PQ").get(":Q2")) ? this.dConj.get(":PQ").get(":Q2") : this.dConj.get(":PQ").get(":Q1");
            return (bPlur && this.dConj.get(":Q").get(":Q2")) ? this.dConj.get(":Q").get(":Q2") : this.dConj.get(":Q").get(":Q1");
        }
        if (!bPlur) {
            return (this.dConj.get(":PQ").get(":Q3")) ? this.dConj.get(":PQ").get(":Q3") : this.dConj.get(":PQ").get(":Q1");
            return (this.dConj.get(":Q").get(":Q3")) ? this.dConj.get(":Q").get(":Q3") : this.dConj.get(":Q").get(":Q1");
        }
        return (this.dConj.get(":PQ").get(":Q4")) ? this.dConj.get(":PQ").get(":Q4") : this.dConj.get(":PQ").get(":Q1");
        return (this.dConj.get(":Q").get(":Q4")) ? this.dConj.get(":Q").get(":Q4") : this.dConj.get(":Q").get(":Q1");
    }
}


// Initialization
if (!conj.bInit && typeof(browser) !== 'undefined') {
    // WebExtension Standard (but not in Worker)