Grammalecte  Check-in [cb404dd67a]

Overview
Comment:[core] gc engine: fix morphx()
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core | mtok
Files: files | file ages | folders
SHA3-256: cb404dd67a4b3f5de292098262359109c95f3b12567c71ffaa01eb0c04f4ed95
User & Date: olr on 2021-03-13 09:53:56
Other Links: branch diff | manifest | tags
Context
2021-03-13
11:34
[fr] ajustements check-in: b62d7a4807 user: olr tags: fr, mtok
09:53
[core] gc engine: fix morphx() check-in: cb404dd67a user: olr tags: core, mtok
08:07
[core][fr] fix getLemmaOfMorph() check-in: 392ae92308 user: olr tags: core, fr, mtok
Changes

Modified gc_core/js/lang_core/gc_functions.js from [f3e99affe4] to [ed16810cd6].

   231    231               }
   232    232           }
   233    233       }
   234    234       // search sPattern
   235    235       return lMorph.some(sMorph  =>  (sMorph.search(sPattern) !== -1));
   236    236   }
   237    237   
   238         -function g_morphx (oToken, sPattern, sNegPattern="", nLeft=null, nRight=null) {
          238  +function g_morphx (oToken, sPattern, sNegPattern="") {
   239    239       // analyse a multi-token, return True if <sNegPattern> not in morphologies and <sPattern> in morphologies
   240    240       if (!oToken.hasOwnProperty("oMultiToken")) {
   241    241           return false;
   242    242       }
   243    243       let lMorph = oToken["oMultiToken"]["lMorph"];
   244    244       if (lMorph.length == 0) {
   245    245           return false;

Modified gc_core/py/lang_core/gc_engine.py from [a2c2a9d3d4] to [caa8d936e0].

   704    704                                       "lTokens": self.lTokens[nTokenStart:nTokenEnd+1],
   705    705                                       "lMorph": sAction.split("|")  if sAction else  [":HM"]
   706    706                                   }
   707    707                                   self.lTokens[nTokenStart]["nMultiStartTo"] = nTokenEnd
   708    708                                   self.lTokens[nTokenEnd]["nMultiEndFrom"] = nTokenStart
   709    709                                   self.lTokens[nTokenStart]["dMultiToken"] = dMultiToken
   710    710                                   self.lTokens[nTokenEnd]["dMultiToken"] = dMultiToken
   711         -                                print(dMultiToken)
          711  +                                if bDebug:
          712  +                                    echo("    MULTI-TOKEN: ({})  [{}:{}]".format(sAction, self.lTokens[nTokenOffset+1]["sValue"], self.lTokens[nLastToken]["sValue"]))
          713  +                                #print(dMultiToken)
   712    714                               else:
   713    715                                   echo("# error: unknown action at " + sLineId)
   714    716                           elif cActionType == ">":
   715    717                               if bDebug:
   716    718                                   echo("    COND_BREAK")
   717    719                               break
   718    720                   except Exception as e:

Modified gc_core/py/lang_core/gc_functions.py from [2a974cece8] to [8b75051fd9].

   209    209           if any(zNegPattern.search(sMorph)  for sMorph in lMorph):
   210    210               return False
   211    211       # search sPattern
   212    212       zPattern = re.compile(sPattern)
   213    213       return any(zPattern.search(sMorph)  for sMorph in lMorph)
   214    214   
   215    215   
   216         -def g_morphx (dToken, sPattern, sNegPattern):
          216  +def g_morphx (dToken, sPattern, sNegPattern=""):
   217    217       "analyse a multi-token, return True if <sNegPattern> not in morphologies and <sPattern> in morphologies"
   218    218       if not "dMultiToken" in dToken:
   219    219           return False
   220    220       lMorph = dToken["dMultiToken"]["lMorph"]
   221    221       if not lMorph:
   222    222           return False
   223    223       # check negative condition