Index: gc_lang/fr/modules-js/conj.js ================================================================== --- gc_lang/fr/modules-js/conj.js +++ gc_lang/fr/modules-js/conj.js @@ -178,33 +178,40 @@ }; 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ś")], @@ -332,22 +339,22 @@ } 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); @@ -467,19 +474,19 @@ 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 Index: gc_lang/fr/modules/conj.py ================================================================== --- gc_lang/fr/modules/conj.py +++ gc_lang/fr/modules/conj.py @@ -145,36 +145,43 @@ return "## erreur, code : " + str(sSfx) + " ##" class Verb (): - def __init__ (self, sVerb): + def __init__ (self, sVerb, sVerbPattern=""): + # conjugate a unknown verb with rules from sVerbPattern if not isinstance(sVerb, str): raise TypeError if not sVerb: raise ValueError + if sVerbPattern == "": + sVerbPattern = sVerb + self.sVerb = sVerb self.sVerbAux = "" - self._sRawInfo = getVtyp(self.sVerb) + self._sRawInfo = getVtyp(sVerbPattern) self.sInfo = self._readableInfo() self.bProWithEn = (self._sRawInfo[5] == "e") - self._tTags = _getTags(sVerb) + self._tTags = _getTags(sVerbPattern) self._tTagsAux = _getTags(self.sVerbAux) self.dConj = { ":Y": { "label": "Infinitif", - ":Y": sVerb, + ":": sVerb, + }, + ":P": { + "label": "Participe présent", + ":": _getConjWithTags(sVerb, self._tTags, ":PQ", ":P"), }, - ":PQ": { - "label": "Participes passés et présent", + ":Q": { + "label": "Participes passés", ":Q1": _getConjWithTags(sVerb, self._tTags, ":PQ", ":Q1"), ":Q2": _getConjWithTags(sVerb, self._tTags, ":PQ", ":Q2"), ":Q3": _getConjWithTags(sVerb, self._tTags, ":PQ", ":Q3"), ":Q4": _getConjWithTags(sVerb, self._tTags, ":PQ", ":Q4"), - ":P": _getConjWithTags(sVerb, self._tTags, ":PQ", ":P"), }, ":Ip": { "label": "Présent", ":1s": _getConjWithTags(sVerb, self._tTags, ":Ip", ":1s"), ":1ś": _getConjWithTags(sVerb, self._tTags, ":Ip", ":1ś"), @@ -302,23 +309,23 @@ traceback.print_exc() return "# erreur" def participePasse (self, sWho): try: - return self.dConj[":PQ"][sWho] + return self.dConj[":Q"][sWho] except: traceback.print_exc() return "# erreur" def participePresent (self, bPro, bNeg, bTpsCo, bInt, bFem): try: - if not self.dConj[":PQ"][":P"]: + if not self.dConj[":P"][":"]: return "" if bTpsCo: sPartPre = _getConjWithTags(self.sVerbAux, self._tTagsAux, ":PQ", ":P") if not bPro else getConj("être", ":PQ", ":P") else: - sPartPre = self.dConj[":PQ"][":P"] + sPartPre = self.dConj[":P"][":"] if not sPartPre: return "" bEli = True if _zStartVoy.search(sPartPre) else False if bPro: if self.bProWithEn: @@ -425,14 +432,14 @@ return "# erreur" def _seekPpas (self, bPro, bFem, bPlur): try: if not bPro and self.sVerbAux == "avoir": - return self.dConj[":PQ"][":Q1"] + return self.dConj[":Q"][":Q1"] if not bFem: - return self.dConj[":PQ"][":Q2"] if bPlur and self.dConj[":PQ"][":Q2"] else self.dConj[":PQ"][":Q1"] + return self.dConj[":Q"][":Q2"] if bPlur and self.dConj[":Q"][":Q2"] else self.dConj[":Q"][":Q1"] if not bPlur: - return self.dConj[":PQ"][":Q3"] if self.dConj[":PQ"][":Q3"] else self.dConj[":PQ"][":Q1"] - return self.dConj[":PQ"][":Q4"] if self.dConj[":PQ"][":Q4"] else self.dConj[":PQ"][":Q1"] + return self.dConj[":Q"][":Q3"] if self.dConj[":Q"][":Q3"] else self.dConj[":Q"][":Q1"] + return self.dConj[":Q"][":Q4"] if self.dConj[":Q"][":Q4"] else self.dConj[":Q"][":Q1"] except: traceback.print_exc() return "# erreur" Index: gc_lang/fr/webext/panel/lex_conj_data.js ================================================================== --- gc_lang/fr/webext/panel/lex_conj_data.js +++ gc_lang/fr/webext/panel/lex_conj_data.js @@ -1,8 +1,8 @@ // JavaScript -"use script"; +"use strict"; // beta stage, unfinished, may be useless or the root for a new way to generate flexions… /* Règles de conjugaison Index: gc_lang/fr/webext/panel/lex_editor.css ================================================================== --- gc_lang/fr/webext/panel/lex_editor.css +++ gc_lang/fr/webext/panel/lex_editor.css @@ -146,10 +146,13 @@ color: hsl(0, 10%, 50%); font-size: 14px; border-radius: 3px; } +ul { + margin-left: 30px; +} input[type=text] { display: inline-block; width: 250px; margin-left: 5px; Index: gc_lang/fr/webext/panel/lex_editor.html ================================================================== --- gc_lang/fr/webext/panel/lex_editor.html +++ gc_lang/fr/webext/panel/lex_editor.html @@ -16,12 +16,12 @@
@@ -165,26 +165,26 @@
Indiquez ici le verbe qui doit servir de modèle pour la conjugaison.
+Ce n’est pas nécessaire pour la très grande majorité des verbes du 1ᵉʳ groupe et du 2ᵉ groupe. Si les formes fléchies engendrées automatiquement ne vous satisfont pas, vous pouvez indiquer le verbe qui doit servir de modèle pour la conjugaison.
Il est fortement recommandé d’appliquer les règles d’un verbe du même groupe que celui que vous créez. Mais aucune restriction n’est imposée.
+Classification des groupes :
Indiquez les étiquettes grammaticales que vous voulez appliquer au mot. À utiliser seulement si vous savez ce que vous faites. Dans le cas contraire, tant pis pour vous.
-Indiquez les étiquettes grammaticales que vous voulez appliquer au mot. À utiliser seulement si vous savez ce que vous faites.
+