py/gadict_freq.py
changeset 645 6d4a074cea27
parent 643 c2c32f45dde6
child 646 2d488cfc4c0c
--- a/py/gadict_freq.py	Tue Nov 08 18:08:02 2016 +0200
+++ b/py/gadict_freq.py	Tue Nov 08 18:12:50 2016 +0200
@@ -19,11 +19,11 @@
             wlist.append(line)
         return wlist
 
-class BasewordParser:
+class HeadVarParser:
 
-    BASEWORD_RE = regex.compile(u"^(\t)?(.*)$")
+    BASEVAR_RE = regex.compile(u"^(\t)?(.*)$")
 
-    def __init__(self, stream, limit):
+    def __init__(self, stream, limit = None):
         self.stream = stream
         self.limit = limit
         self.lineno = 0
@@ -36,7 +36,7 @@
             if len(line) == 0:
                 break
             self.lineno += 1
-            m = self.BASEWORD_RE.match(line)
+            m = self.BASEVAR_RE.match(line)
             if not m:
                 raise Exception("Line {:d}: '{:s}' wrong format\n".format(self.lineno, line))
             tab = m.group(1)
@@ -52,7 +52,7 @@
 
     FREQ_RE = regex.compile(u"^([0-9]+) (.*)$")
 
-    def __init__(self, stream, limit):
+    def __init__(self, stream, limit = None):
         self.stream = stream
         self.limit = limit
         self.lineno = 0
@@ -102,7 +102,7 @@
             limit = int(limit)
         with io.open(fname, mode='r', buffering=1, encoding="utf-8") as stream:
             if mode == "b":
-                parser = BasewordParser(stream, limit)
+                parser = HeadVarParser(stream, limit)
             elif mode == "f":
                 parser = FreqlistParser(stream, limit)
             else: