Grammalecte  Check-in [02901ad6ae]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:[core][fr] morphVC() update
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | fr | core
Files: files | file ages | folders
SHA3-256:02901ad6aeec7975655be24057fb5e056072219c49d86384558027b1dff9d819
User & Date: olr 2019-07-22 20:00:20
Context
2019-07-22
20:29
[core][fr][js][bug] no count method in JS (pfff) check-in: 88574d8f98 user: olr tags: core, fr, trunk
20:00
[core][fr] morphVC() update check-in: 02901ad6ae user: olr tags: core, fr, trunk
11:47
[fr] fix tests.py check-in: e39cca00d3 user: olr tags: fr, trunk
Changes

Changes to gc_lang/fr/modules-js/gce_analyseur.js.

     1      1   // GRAMMAR CHECKING ENGINE PLUGIN: Parsing functions for French language
     2      2   
     3      3   /* jshint esversion:6 */
     4      4   /* jslint esversion:6 */
     5      5   
     6         -function g_morphVC (dToken, sPattern, sNegPattern="") {
     7         -    let nEnd = dToken["sValue"].lastIndexOf("-");
     8         -    if (dToken["sValue"].includes("-t-")) {
     9         -        nEnd = nEnd - 2;
            6  +function g_morphVC (oToken, sPattern, sNegPattern="") {
            7  +    let nEnd = oToken["sValue"].lastIndexOf("-");
            8  +    if (oToken["sValue"].count("-") > 1) {
            9  +        if (oToken["sValue"].includes("-t-")) {
           10  +            nEnd = nEnd - 2;
           11  +        }
           12  +        else if (oToken["sValue"].search(/-l(?:es?|a)-(?:[mt]oi|nous|leur)$|(?:[nv]ous|lui|leur)-en$/) != -1) {
           13  +            nEnd = oToken["sValue"].slice(0,nEnd).lastIndexOf("-");
           14  +        }
    10     15       }
    11         -    return g_morph(dToken, sPattern, sNegPattern, 0, nEnd, false);
           16  +    return g_morph(oToken, sPattern, sNegPattern, 0, nEnd, false);
    12     17   }
    13     18   
    14     19   function rewriteSubject (s1, s2) {
    15     20       // s1 is supposed to be prn/patr/npr (M[12P])
    16     21       if (s2 == "lui") {
    17     22           return "ils";
    18     23       }

Changes to gc_lang/fr/modules/gce_analyseur.py.

     2      2   
     3      3   from . import cregex as cr
     4      4   
     5      5   
     6      6   def g_morphVC (dToken, sPattern, sNegPattern=""):
     7      7       "lance la fonction g_morph() sur la première partie d’un verbe composé (ex: vient-il)"
     8      8       nEnd = dToken["sValue"].rfind("-")
     9         -    if "-t-" in dToken["sValue"]:
    10         -        nEnd = nEnd - 2
            9  +    if dToken["sValue"].count("-") > 1:
           10  +        if "-t-" in dToken["sValue"]:
           11  +            nEnd = nEnd - 2
           12  +        elif re.search("-l(?:es?|a)-(?:[mt]oi|nous|leur)$|(?:[nv]ous|lui|leur)-en$", dToken["sValue"]):
           13  +            nEnd = dToken["sValue"][0:nEnd].rfind("-")
    11     14       return g_morph(dToken, sPattern, sNegPattern, 0, nEnd, False)
    12     15   
    13     16   
    14     17   def rewriteSubject (s1, s2):
    15     18       "rewrite complex subject: <s1> a prn/patr/npr (M[12P]) followed by “et” and <s2>"
    16     19       if s2 == "lui":
    17     20           return "ils"