Grammalecte  Check-in [3e14557ae0]

Overview
Comment:[build][core][lo] update minimal requirements: Python 3.7, LO 6.4
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | core | build | lo
Files: files | file ages | folders
SHA3-256: 3e14557ae03c3b524a628217614f7f6e4c04c12a2bcfd67fdcd0c00bd90edab6
User & Date: olr on 2025-09-14 13:10:49
Other Links: manifest | tags
Context
2025-09-14
14:31
[graphspell] new suggestion mechanism for Javascript too check-in: ec295f726f user: olr tags: trunk, graphspell
13:10
[build][core][lo] update minimal requirements: Python 3.7, LO 6.4 check-in: 3e14557ae0 user: olr tags: trunk, core, build, lo
12:42
[graphspell] suggestion mechanism update check-in: 6d2e9dc4cb user: olr tags: trunk, graphspell
Changes

Modified gc_core/py/oxt/description.xml from [2fa576c71a] to [ddb2e532c5].

12
13
14
15
16
17
18
19
20
21
22
23
24
25
    <publisher>
        <name lang="en" xlink:href="${link}">${provider}</name>
    </publisher>
    <icon>
        <default xlink:href="${logo}" />
    </icon>
    <dependencies>
        <l:LibreOffice-minimal-version value="5.3" l:name="LibreOffice 5.3" />
        <!--<d:OpenOffice.org-minimal-version value="4.0" d:name="OpenOffice.org 4.0" />-->
    </dependencies>
    <update-information>
        <src xlink:href="${oxt_update_info_URL}" />
    </update-information>
</description>







|






12
13
14
15
16
17
18
19
20
21
22
23
24
25
    <publisher>
        <name lang="en" xlink:href="${link}">${provider}</name>
    </publisher>
    <icon>
        <default xlink:href="${logo}" />
    </icon>
    <dependencies>
        <l:LibreOffice-minimal-version value="6.4" l:name="LibreOffice 6.4" />
        <!--<d:OpenOffice.org-minimal-version value="4.0" d:name="OpenOffice.org 4.0" />-->
    </dependencies>
    <update-information>
        <src xlink:href="${oxt_update_info_URL}" />
    </update-information>
</description>

Modified grammalecte-cli.py from [be081db1ae] to [885831172a].

128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
            else:
                vSugg = m.group(2)[1:]
            return (nError, cAction, vSugg)


def main ():
    "launch the CLI (command line interface)"
    if sys.version_info < (3, 5):
        print("Python 3.5+ required")
        return

    xParser = argparse.ArgumentParser()
    xParser.add_argument("-f", "--file", help="parse file (UTF-8 required!) [on Windows, -f is similar to -ff]", type=str)
    xParser.add_argument("-ff", "--file_to_file", help="parse file (UTF-8 required!) and create a result file (*.res.txt)", type=str)
    xParser.add_argument("-iff", "--interactive_file_to_file", help="parse file (UTF-8 required!) and create a result file (*.res.txt)", type=str)
    xParser.add_argument("-owe", "--only_when_errors", help="display results only when there are errors", action="store_true")







|
|







128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
            else:
                vSugg = m.group(2)[1:]
            return (nError, cAction, vSugg)


def main ():
    "launch the CLI (command line interface)"
    if sys.version_info < (3, 7):
        print("Python 3.7+ required")
        return

    xParser = argparse.ArgumentParser()
    xParser.add_argument("-f", "--file", help="parse file (UTF-8 required!) [on Windows, -f is similar to -ff]", type=str)
    xParser.add_argument("-ff", "--file_to_file", help="parse file (UTF-8 required!) and create a result file (*.res.txt)", type=str)
    xParser.add_argument("-iff", "--interactive_file_to_file", help="parse file (UTF-8 required!) and create a result file (*.res.txt)", type=str)
    xParser.add_argument("-owe", "--only_when_errors", help="display results only when there are errors", action="store_true")

Modified graphspell/ibdawg.py from [58e076d75b] to [979c697260].

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import pkgutil
import re
from functools import wraps
import time
import json
import binascii
import importlib
from collections import OrderedDict
from math import floor

#import logging
#logging.basicConfig(filename="suggestions.log", level=logging.DEBUG)

from . import str_transform as st
from . import char_player as cp







<







10
11
12
13
14
15
16

17
18
19
20
21
22
23
import pkgutil
import re
from functools import wraps
import time
import json
import binascii
import importlib

from math import floor

#import logging
#logging.basicConfig(filename="suggestions.log", level=logging.DEBUG)

from . import str_transform as st
from . import char_player as cp
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
            self.dAccSugg[sSugg] = min(nDist, nSimDist+1)
            if len(self.dAccSugg) > self.nTempSuggLimit:
                self.nDistLimit = -1  # suggest() ends searching when this variable = -1
        self.nDistLimit = min(self.nDistLimit, self.nMinDist+1)

    def getSuggestions (self):
        "return a list of suggestions"
        # we sort the better results with the original word
        lRes = []
        # sort only with simplified words
        lResTmp = sorted(self.dAccSugg.items(), key=lambda x: (x[1], x[0]))
        for i in range(min(self.nSuggLimit, len(lResTmp))):
            lRes.append(lResTmp[i][0])
            #st.showDistance(self.sWord, lResTmp[i][0])
        # casing
        if self.sWord.isupper():
            lRes = list(OrderedDict.fromkeys(map(lambda sSugg: sSugg.upper(), lRes))) # use dict, when Python 3.6+
        elif self.sWord[0:1].isupper():
            # don’t use <.istitle>
            lRes = list(OrderedDict.fromkeys(map(lambda sSugg: sSugg[0:1].upper()+sSugg[1:], lRes))) # use dict, when Python 3.6+
        return lRes[:self.nSuggLimit]


class IBDAWG:
    """INDEXABLE BINARY DIRECT ACYCLIC WORD GRAPH"""

    def __init__ (self, source):







|

<






|


|







68
69
70
71
72
73
74
75
76

77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
            self.dAccSugg[sSugg] = min(nDist, nSimDist+1)
            if len(self.dAccSugg) > self.nTempSuggLimit:
                self.nDistLimit = -1  # suggest() ends searching when this variable = -1
        self.nDistLimit = min(self.nDistLimit, self.nMinDist+1)

    def getSuggestions (self):
        "return a list of suggestions"
        # sort according to distance
        lRes = []

        lResTmp = sorted(self.dAccSugg.items(), key=lambda x: (x[1], x[0]))
        for i in range(min(self.nSuggLimit, len(lResTmp))):
            lRes.append(lResTmp[i][0])
            #st.showDistance(self.sWord, lResTmp[i][0])
        # casing
        if self.sWord.isupper():
            lRes = list(dict.fromkeys(map(lambda sSugg: sSugg.upper(), lRes)))
        elif self.sWord[0:1].isupper():
            # don’t use <.istitle>
            lRes = list(dict.fromkeys(map(lambda sSugg: sSugg[0:1].upper()+sSugg[1:], lRes)))
        return lRes[:self.nSuggLimit]


class IBDAWG:
    """INDEXABLE BINARY DIRECT ACYCLIC WORD GRAPH"""

    def __init__ (self, source):