db/dic2csv.py
changeset 1417 3507e785e538
parent 121 dcefb3741425
child 1513 e7f7e42385b5
     1.1 --- a/db/dic2csv.py	Mon Nov 21 22:27:25 2016 +0100
     1.2 +++ b/db/dic2csv.py	Tue Nov 22 22:27:33 2016 +0100
     1.3 @@ -21,8 +21,8 @@
     1.4      help='use dictionary for language LANG (default: en_US)')
     1.5  p.add_argument('--encoding', '-e', type=str, default="utf-8",
     1.6      help='file encoding (default: utf-8)')
     1.7 -p.add_argument('--full', '-f', action='store_true',
     1.8 -    help="full list - don't reduce to 65536 words")
     1.9 +p.add_argument('--cut', '-c', action='store_true',
    1.10 +    help="cut list - reduce to 65536 words")
    1.11  
    1.12  args = p.parse_args()
    1.13  
    1.14 @@ -50,12 +50,12 @@
    1.15  _words.sort()
    1.16  _words = [w for w, g in itertools.groupby(_words)]
    1.17  
    1.18 -if not args.full:
    1.19 +if args.cut:
    1.20      while len(_words) > 65536 * 2:
    1.21          _words = _words[::2]
    1.22  
    1.23  if len(_words) > 65536:
    1.24 -    if not args.full:
    1.25 +    if args.cut:
    1.26          _words = _words[:65536]
    1.27  elif len(_words) < 65536:
    1.28      sys.stderr.write(
    1.29 @@ -67,7 +67,7 @@
    1.30          )
    1.31      _words.extend(_words[:65536-len(_words)])
    1.32  
    1.33 -if not args.full:
    1.34 +if args.cut:
    1.35      assert len(_words) == 65536, "lenght is {}".format(len(_words))
    1.36  
    1.37  for i, w in enumerate(_words):