Grammalecte  Check-in [261ec1c90b]

Overview
Comment:[build][core][fr] rename function
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | fr | core | build
Files: files | file ages | folders
SHA3-256: 261ec1c90bb719b1049b51d84b7c5393c7069d5d829971d470c5d39d9b84b8ee
User & Date: olr on 2020-11-26 12:30:38
Other Links: manifest | tags
Context
2020-11-27
09:52
[core] tests: extend neutralization for spellchecker check-in: f667bcada7 user: olr tags: core, trunk
2020-11-26
12:30
[build][core][fr] rename function check-in: 261ec1c90b user: olr tags: build, core, fr, trunk
07:12
[build][core][fr][doc] rename functions check-in: b316995bfc user: olr tags: build, core, doc, fr, trunk
Changes

Modified compile_rules_graph.py from [7091a2b5a1] to [ae796c907e].

    42     42       sCode = re.sub(r"\b(morph0?|morphVC|value|tag|meta|info)[(]\\-(\d+)", 'g_\\1(lToken[nLastToken-\\2+1]', sCode)
    43     43       sCode = re.sub(r"\b(select|exclude|define|definefrom|rewrite|addmorph|setmeta)[(][\\](\d+)", 'g_\\1(lToken[nTokenOffset+\\2]', sCode)
    44     44       sCode = re.sub(r"\b(select|exclude|define|definefrom|rewrite|addmorph|setmeta)[(][\\]-(\d+)", 'g_\\1(lToken[nLastToken-\\2+1]', sCode)
    45     45       sCode = re.sub(r"\b(tagbefore|tagafter)[(][\\](\d+)", 'g_\\1(lToken[nTokenOffset+\\2], dTags', sCode)
    46     46       sCode = re.sub(r"\b(tagbefore|tagafter)[(][\\]-(\d+)", 'g_\\1(lToken[nLastToken-\\2+1], dTags', sCode)
    47     47       sCode = re.sub(r"\bspace[(][\\](\d+)", 'g_space(lToken[nTokenOffset+\\1], lToken[nTokenOffset+\\1+1]', sCode)
    48     48       sCode = re.sub(r"\bspace[(][\\]-(\d+)", 'g_space(lToken[nLastToken-\\1+1], lToken[nLastToken-\\1+2]', sCode)
    49         -    sCode = re.sub(r"\banalyse_with_next[(][\\](\d+)", 'g_merged_analyse(lToken[nTokenOffset+\\1], lToken[nTokenOffset+\\1+1]', sCode)
    50         -    sCode = re.sub(r"\banalyse_with_next[(][\\]-(\d+)", 'g_merged_analyse(lToken[nLastToken-\\1+1], lToken[nLastToken-\\1+2]', sCode)
           49  +    sCode = re.sub(r"\bmorph2[(][\\](\d+)", 'g_morph2(lToken[nTokenOffset+\\1], lToken[nTokenOffset+\\1+1]', sCode)
           50  +    sCode = re.sub(r"\bmorph2[(][\\]-(\d+)", 'g_morph2(lToken[nLastToken-\\1+1], lToken[nLastToken-\\1+2]', sCode)
    51     51       sCode = re.sub(r"\b(morph0?|tag|meta|value)\(>1", 'g_\\1(lToken[nLastToken+1]', sCode)                      # next token
    52     52       sCode = re.sub(r"\b(morph0?|tag|meta|value)\(<1", 'g_\\1(lToken[nTokenOffset]', sCode)                      # previous token
    53     53       sCode = re.sub(r"\b(morph0?|tag|meta|value)\(>(\d+)", 'g_\\1(g_token(lToken, nLastToken+\\2)', sCode)       # next token
    54     54       sCode = re.sub(r"\b(morph0?|tag|meta|value)\(<(\d+)", 'g_\\1(g_token(lToken, nTokenOffset+1-\\2)', sCode)   # previous token
    55     55       sCode = re.sub(r"\bspace[(](>1)", 'g_space(lToken[nLastToken+1], g_token(lToken, nLastToken+2)', sCode)     # next token
    56     56       sCode = re.sub(r"\bspace[(](<1)", 'g_space(lToken[nTokenOffset], lToken[nTokenOffset+1]', sCode)            # previous token
    57     57       sCode = re.sub(r"\bspell *[(]", '_oSpellChecker.isValid(', sCode)

Modified gc_core/js/lang_core/gc_functions.js from [56e86460e7] to [1f04b155c5].

   265    265               }
   266    266           }
   267    267       }
   268    268       // search sPattern
   269    269       return lMorph.some(sMorph  =>  (sMorph.search(sPattern) !== -1));
   270    270   }
   271    271   
   272         -function g_merged_analyse (oToken1, oToken2, cMerger, sPattern, sNegPattern="", bSetMorph=true) {
          272  +function g_morph2 (oToken1, oToken2, cMerger, sPattern, sNegPattern="", bSetMorph=true) {
   273    273       // merge two token values, return True if <sNegPattern> not in morphologies and <sPattern> in morphologies (disambiguation off)
   274    274       let lMorph = gc_engine.oSpellChecker.getMorph(oToken1["sValue"] + cMerger + oToken2["sValue"]);
   275    275       if (lMorph.length == 0) {
   276    276           return false;
   277    277       }
   278    278       // check negative condition
   279    279       if (sNegPattern) {

Modified gc_core/py/lang_core/gc_functions.py from [5fef80fdf0] to [fb2b86ce70].

   219    219           if any(zNegPattern.search(sMorph)  for sMorph in lMorph):
   220    220               return False
   221    221       # search sPattern
   222    222       zPattern = re.compile(sPattern)
   223    223       return any(zPattern.search(sMorph)  for sMorph in lMorph)
   224    224   
   225    225   
   226         -def g_merged_analyse (dToken1, dToken2, cMerger, sPattern, sNegPattern="", bSetMorph=True):
          226  +def g_morph2 (dToken1, dToken2, cMerger, sPattern, sNegPattern="", bSetMorph=True):
   227    227       "merge two token values, return True if <sNegPattern> not in morphologies and <sPattern> in morphologies (disambiguation off)"
   228    228       lMorph = _oSpellChecker.getMorph(dToken1["sValue"] + cMerger + dToken2["sValue"])
   229    229       if not lMorph:
   230    230           return False
   231    231       # check negative condition
   232    232       if sNegPattern:
   233    233           if sNegPattern == "*":

Modified gc_lang/fr/rules.grx from [5ff861bc84] to [bcfa5485c2].

  2764   2764           <<- =>> define(\1, ":N:e:i")
  2765   2765   
  2766   2766       Mai 68
  2767   2767           <<- ~>> ␣
  2768   2768           <<- =>> define(\1, ":MP:m:i")
  2769   2769   
  2770   2770       ~^[A-ZÀÂÉÈÊÎÔ].  ~^[A-ZÀÂÉÈÊÎÔ].
  2771         -        <<- analyse_with_next(\1, " ", ":") ~>> ␣
         2771  +        <<- morph2(\1, " ", ":") ~>> ␣
  2772   2772           <<- __else__ and morph(\1, ":M") and morph(\2, ":V", ":[GM]") =>> define(\2, ":M2")
  2773   2773   
  2774   2774       Me  ~^[A-ZÀÂÉÈÊÎÔ].
  2775   2775           <<- =>> define(\1, ":T")
  2776   2776           <<- ~1>> *
  2777   2777   
  2778   2778       [la|cette|the]  ~^[A-ZÀÂÉÈÊÎÔ].  ?~^[A-ZÀÂÉÈÊÎÔ].¿  ?~^[A-ZÀÂÉÈÊÎÔ].¿  [Administration|Area|Army|Assocation|Avenue|Chamber|Church|City|Community|Court|Company|Corporation|Cup|Enterprise|Foundation|Fraternity|Gallery|Highway|House|Initiative|League|Library|Mansion|Nation|Navy|Organization|Reserve|Road|River|Sea|Society|Station|Sorority|Tavern|Tower|University|Valley]
................................................................................
  5083   5083   TEST: des {{franco américains}}
  5084   5084   TEST: {{franco américaine}}                             ->> franco-américaine
  5085   5085   TEST: l’{{israélo belge}}
  5086   5086   
  5087   5087   
  5088   5088   __tu_préfixe_xxxo__
  5089   5089       [macro|magnéto|micro|paléo|rétro|rhino|stéréo]  *WORD
  5090         -        <<- /tu/ analyse_with_next(\1, "-", ":")
         5090  +        <<- /tu/ morph2(\1, "-", ":")
  5091   5091           ->> \1-\2                                                                                   && S’il s’agit d’un seul mot, il manque un trait d’union.
  5092   5092   
  5093   5093       [électro|ferro|hydro|labio|médico|nano|néo|neuro|physico|politico|sino|socio]  *WORD
  5094         -        <<- /tu/ space(\1, 1, 1) and (morph(\2, ":N") or analyse_with_next(\1, "-", ":"))
         5094  +        <<- /tu/ space(\1, 1, 1) and (morph(\2, ":N") or morph2(\1, "-", ":"))
  5095   5095           ->> \1-\2                                                                                   && S’il s’agit d’un seul mot, il manque un trait d’union.
  5096   5096   
  5097   5097   TEST: {{ferro électrique}}                              ->> ferro-électrique
  5098   5098   TEST: {{rétro ingénierie}}.                             ->> rétro-ingénierie
  5099   5099   
  5100   5100   
  5101   5101   __tu_préfixe_divers__
  5102   5102       [anti|auto|arrière|avant|demi|extra|intra|multi|post]  *WORD
  5103         -        <<- /tu/ morph(<1, ":D|<start>|>,") and analyse_with_next(\1, "-", ":")
         5103  +        <<- /tu/ morph(<1, ":D|<start>|>,") and morph2(\1, "-", ":")
  5104   5104           ->> \1-\2                                                                                   && Il manque probablement un trait d’union.
  5105   5105   
  5106   5106       [non|sans]  *WORD
  5107         -        <<- /tu/ morph(<1, ":D") and analyse_with_next(\1, "-", ":")
         5107  +        <<- /tu/ morph(<1, ":D") and morph2(\1, "-", ":")
  5108   5108           ->> \1-\2                                                                                   && Il manque probablement un trait d’union.
  5109   5109   
  5110   5110       sous  *WORD
  5111         -        <<- /tu/ not(\2 == "forme" and value(>1, "|de|d’|")) and morph(<1, ":D") and analyse_with_next(\1, "-", ":")
         5111  +        <<- /tu/ not(\2 == "forme" and value(>1, "|de|d’|")) and morph(<1, ":D") and morph2(\1, "-", ":")
  5112   5112           ->> \1-\2                                                                                   && Il manque probablement un trait d’union.
  5113   5113   
  5114   5114   TEST: il a pris une balle dans l’{{arrière train}}.
  5115   5115   TEST: Ce {{sans gêne}} mérite une bonne leçon
  5116   5116   TEST: une {{sous culture}} passée de mode
  5117   5117   TEST: l’{{avant train}}
  5118   5118   TEST: l’{{arrière pensée}}
................................................................................
  5134   5134   TEST: il n’avait contracté qu’un {{pseudo mariage}}.
  5135   5135   TEST: elle connaissait de {{cet}} pseudo-prêtresse uniquement de nom.
  5136   5136   TEST: la {{pseudo taxe}} carbone
  5137   5137   
  5138   5138   
  5139   5139   __tu_mots_composés_verbe_nom__
  5140   5140       [contre|entre]  *WORD
  5141         -        <<- /tu/ not morph(\2, ":[GYB]") and morph(<1, ":(?:D|V0e)|<start>|>,") and analyse_with_next(\1, "-", ":N")
         5141  +        <<- /tu/ not morph(\2, ":[GYB]") and morph(<1, ":(?:D|V0e)|<start>|>,") and morph2(\1, "-", ":N")
  5142   5142           ->> \1-\2                                                                                   && Il manque probablement un trait d’union.
  5143   5143   
  5144   5144       [m’|t’|s’] entre *WORD
  5145         -        <<- /tu/ morph(\3, ":V") and analyse_with_next(\2, "-", ":V")
         5145  +        <<- /tu/ morph(\3, ":V") and morph2(\2, "-", ":V")
  5146   5146           -2:3>> \2-\3                                                                                && Il manque probablement un trait d’union.
  5147   5147   
  5148   5148       nous nous entre ~on[ts]$
  5149   5149       vous vous entre ~e[zr]$
  5150         -        <<- /tu/ morph(\4, ":V") and analyse_with_next(\3, "-", ":V") and not morph(<1, ":R")
         5150  +        <<- /tu/ morph(\4, ":V") and morph2(\3, "-", ":V") and not morph(<1, ":R")
  5151   5151           -3:4>> \3-\4                                                                                && Il manque probablement un trait d’union.
  5152   5152   
  5153   5153       [attrape|garde|porte|brise|cache|casse|chauffe|coupe|cure|croque|essuie|lance|lave|lève|marque|pare|passe|perce|pèse|porte|poste|pousse|presse|protège|ramasse|serre|taille|tire|tourne|traîne|traine|vide]  *WORD
  5154         -        <<- /tu/ morph(<1, ":(?:D|V0e)|<start>|>,") and analyse_with_next(\1, "-", ":N")
         5154  +        <<- /tu/ morph(<1, ":(?:D|V0e)|<start>|>,") and morph2(\1, "-", ":N")
  5155   5155           ->> \1-\2                                                                                   && Il manque probablement un trait d’union.
  5156   5156   
  5157   5157   TEST: c’est le {{contre exemple}} parfait
  5158   5158   TEST: une {{entre voie}}
  5159   5159   TEST: s’{{entre regarder}}
  5160   5160   TEST: ce sont des {{lève tard}}.
  5161   5161   TEST: nous nous {{entre tuions}}

Modified misc/grammalecte.sublime-syntax from [575daf5fb0] to [215e477290].

    56     56       # other.
    57     57       - match: '\b(?:if|else|and|or|not|in)\b'
    58     58         scope: keyword.python
    59     59   
    60     60       - match: '\b(?:True|False|None)\b'
    61     61         scope: constant.language
    62     62   
    63         -    - match: '\b(?:spell|morph(?:VC|)|stem|tag|value|space|textarea0?\w*|before0?\w*|after0?\w*|word|option|define(?:from|)|select|exclude|setmeta|analyse|tag(?:after|before)|apposition|is[A-Z]\w+|agreement|rewrite|checkD\w+|getD\w+|has[A-Z]\w+|sugg[A-Z]\w+|switch[A-Z]\w+|ceOrCet|formatN\w+|mbUnit)\b'
           63  +    - match: '\b(?:spell|morph(?:VC|0|2|)|stem|tag|value|space|textarea0?\w*|before0?\w*|after0?\w*|word|option|define(?:from|)|select|exclude|setmeta|analyse|tag(?:after|before)|apposition|is[A-Z]\w+|agreement|rewrite|checkD\w+|getD\w+|has[A-Z]\w+|sugg[A-Z]\w+|switch[A-Z]\w+|ceOrCet|formatN\w+|mbUnit)\b'
    64     64         scope: entity.name.function
    65     65   
    66     66       - match: '\b(?:replace|endswith|startswith|search|upper|lower|capitalize|strip|rstrip|is(?:alpha|upper|lower|digit|title))\b'
    67     67         scope: support.function
    68     68   
    69     69       - match: '\becho\b'
    70     70         scope: support.function.debug