Added support for 25k freq wordlist for dictionary as an HTML page. v0.21
authorOleksandr Gavenko <gavenkoa@gmail.com>
Sat, 22 Jul 2023 00:13:47 +0300
changeset 1351 ae963ee79b49
parent 1350 b9e4703092df
child 1352 78b3be4447cc
Added support for 25k freq wordlist for dictionary as an HTML page.
py/gadict_c5.py
py/gadict_html.py
--- a/py/gadict_html.py	Fri Jul 21 23:35:18 2023 +0300
+++ b/py/gadict_html.py	Sat Jul 22 00:13:47 2023 +0300
@@ -20,6 +20,8 @@
 ARG_LANG_RE = re.compile("-lang:(.+)")
 # -freq:var:TAG=FILE or -freq:freq:TAG=FILE
 ARG_FREQ_RE = re.compile("-freq:(freq|var):([^=]+)=(.+)")
+# -grp:GLOB
+ARG_GRP_RE = re.compile("-grp:(.+)")
 
 look_for_files = False
 for idx in range(1, len(sys.argv)):
@@ -50,6 +52,13 @@
                 wlist = parser.parse()
             FREQ_SOURCES.append((tag, set(wlist)))
             continue
+        m = ARG_GRP_RE.match(arg)
+        if m:
+            patt = m.group(1)
+            parser = gadict_freq.WordformGroupParser(patt)
+            for (tag, wset) in parser.parse().items():
+                FREQ_SOURCES.append((tag, wset))
+            continue
         if arg.startswith("-"):
             raise Exception("Unsupported option format: '{:s}'".format(arg))
     if not FINAME: