Grammalecte  Check-in [418b212030]

Overview
Comment:[graphspell][py] ibdawg: select(), don’t compile pattern if empty
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | graphspell
Files: files | file ages | folders
SHA3-256: 418b212030909e89d20f21dd1a779f252825104e18e02d60d12b14c220b37fb1
User & Date: olr on 2018-02-07 15:19:01
Other Links: manifest | tags
Context
2018-02-07
15:19
[graphspell][js] ibdawg: add select() function check-in: fe54076259 user: olr tags: trunk, graphspell
15:19
[graphspell][py] ibdawg: select(), don’t compile pattern if empty check-in: 418b212030 user: olr tags: trunk, graphspell
14:49
[graphspell][js] ibdawg: constructor with data object check-in: 78b42e9b7f user: olr tags: trunk, graphspell
Changes

Modified graphspell/ibdawg.py from [0bb28ceca0] to [047a0ad4e7].

380
381
382
383
384
385
386

387
388
389
390
391
392
393
394
395
396
397
398
        if iPos >= 0:
            print("\n   "+ " " * iPos + "|")
            self.drawPath(sWord[1:], iNextNodeAddr)

    def select (self, sPattern=""):
        "generator: returns all entries which morphology fits <sPattern>"
        zPattern = None

        try:
            zPattern = re.compile(sPattern)
        except:
            print("# Error in regex pattern")
            traceback.print_exc()
        yield from self._select1(zPattern, 0, "")

    # def morph (self, sWord):
    #     is defined in __init__

    # VERSION 1
    def _select1 (self, zPattern, iAddr, sWord):







>
|
|
|
|
|







380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
        if iPos >= 0:
            print("\n   "+ " " * iPos + "|")
            self.drawPath(sWord[1:], iNextNodeAddr)

    def select (self, sPattern=""):
        "generator: returns all entries which morphology fits <sPattern>"
        zPattern = None
        if sPattern:
            try:
                zPattern = re.compile(sPattern)
            except:
                print("# Error in regex pattern")
                traceback.print_exc()
        yield from self._select1(zPattern, 0, "")

    # def morph (self, sWord):
    #     is defined in __init__

    # VERSION 1
    def _select1 (self, zPattern, iAddr, sWord):