Grammalecte  Check-in [5e7ea4059b]

Overview
Comment:[core] morph0: remove useless parameter
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core | mtok
Files: files | file ages | folders
SHA3-256: 5e7ea4059b183cf2bf3253b63e087e1aed6f1cc747aa8a3b8d911a00f99cd8e2
User & Date: olr on 2021-03-12 16:01:18
Other Links: branch diff | manifest | tags
Context
2021-03-12
16:10
[core] morph(): remove useless parameter check-in: 97c50dbb15 user: olr tags: core, mtok
16:01
[core] morph0: remove useless parameter check-in: 5e7ea4059b user: olr tags: core, mtok
15:49
[core] function morphx for multi-token check-in: 5b8ec019ea user: olr tags: core, mtok
Changes

Modified gc_core/js/lang_core/gc_functions.js from [a39656dcfa] to [e16b0a8f41].

259
260
261
262
263
264
265
266

267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
259
260
261
262
263
264
265

266
267
268
269
270
271



272
273
274
275
276
277
278







-
+





-
-
-







            }
        }
    }
    // search sPattern
    return lMorph.some(sMorph  =>  (sMorph.search(sPattern) !== -1));
}

function g_morph0 (oToken, sPattern, sNegPattern="", nLeft=null, nRight=null, bMemorizeMorph=true) {
function g_morph0 (oToken, sPattern, sNegPattern="", nLeft=null, nRight=null) {
    // analyse a token, return True if <sNegPattern> not in morphologies and <sPattern> in morphologies
    let lMorph;
    if (nLeft !== null) {
        let sValue = (nRight !== null) ? oToken["sValue"].slice(nLeft, nRight) : oToken["sValue"].slice(nLeft);
        lMorph = gc_engine.oSpellChecker.getMorph(sValue);
        if (bMemorizeMorph) {
            oToken["lMorph"] = lMorph;
        }
    } else {
        lMorph = gc_engine.oSpellChecker.getMorph(oToken["sValue"]);
    }
    if (lMorph.length == 0) {
        return false;
    }
    // check negative condition

Modified gc_core/py/lang_core/gc_functions.py from [f3b5d69c50] to [e166fca95c].

232
233
234
235
236
237
238
239

240
241
242
243
244
245
246
247
248
249
250
251
232
233
234
235
236
237
238

239
240
241
242


243
244
245
246
247
248
249







-
+



-
-







        if any(zNegPattern.search(sMorph)  for sMorph in lMorph):
            return False
    # search sPattern
    zPattern = re.compile(sPattern)
    return any(zPattern.search(sMorph)  for sMorph in lMorph)


def g_morph0 (dToken, sPattern, sNegPattern="", nLeft=None, nRight=None, bMemorizeMorph=True):
def g_morph0 (dToken, sPattern, sNegPattern="", nLeft=None, nRight=None):
    "analyse a token, return True if <sNegPattern> not in morphologies and <sPattern> in morphologies (disambiguation off)"
    if nLeft is not None:
        lMorph = _oSpellChecker.getMorph(dToken["sValue"][slice(nLeft, nRight)])
        if bMemorizeMorph:
            dToken["lMorph"] = lMorph
    else:
        lMorph = _oSpellChecker.getMorph(dToken["sValue"])
    if not lMorph:
        return False
    # check negative condition
    if sNegPattern:
        if sNegPattern == "*":