Index: gc_core/py/oxt/description.xml
==================================================================
--- gc_core/py/oxt/description.xml
+++ gc_core/py/oxt/description.xml
@@ -14,11 +14,11 @@
-
+
Index: grammalecte-cli.py
==================================================================
--- grammalecte-cli.py
+++ grammalecte-cli.py
@@ -130,12 +130,12 @@
return (nError, cAction, vSugg)
def main ():
"launch the CLI (command line interface)"
- if sys.version_info < (3, 5):
- print("Python 3.5+ required")
+ 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)
Index: graphspell/ibdawg.py
==================================================================
--- graphspell/ibdawg.py
+++ graphspell/ibdawg.py
@@ -12,11 +12,10 @@
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)
@@ -71,23 +70,22 @@
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
+ # sort according to distance
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+
+ lRes = list(dict.fromkeys(map(lambda sSugg: sSugg.upper(), lRes)))
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+
+ 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"""