| OLD | NEW |
| (Empty) | |
| 1 #!/usr/bin/python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. |
| 5 |
| 6 """A simple script for downloading latest dictionaries.""" |
| 7 |
| 8 import glob |
| 9 import os |
| 10 import sys |
| 11 import urllib |
| 12 from zipfile import ZipFile |
| 13 |
| 14 |
| 15 def main(): |
| 16 if not os.getcwd().endswith("hunspell_dictionaries"): |
| 17 print "Please run this file from the hunspell_dictionaries directory" |
| 18 dictionaries = ( |
| 19 ("http://downloads.sourceforge.net/project/wordlist/speller/2016.01.19/" |
| 20 "hunspell-en_US-2016.01.19.zip", |
| 21 "en_US.zip"), |
| 22 ("http://downloads.sourceforge.net/project/wordlist/speller/2016.01.19/" |
| 23 "hunspell-en_CA-2016.01.19.zip", |
| 24 "en_CA.zip"), |
| 25 ("http://downloads.sourceforge.net/project/wordlist/speller/2016.01.19/" |
| 26 "hunspell-en_GB-ise-2016.01.19.zip", |
| 27 "en_GB.zip"), |
| 28 ("http://downloads.sourceforge.net/lilak/" |
| 29 "lilak_fa-IR_2-1.zip", |
| 30 "fa_IR.zip") |
| 31 ) |
| 32 for pair in dictionaries: |
| 33 urllib.urlretrieve(pair[0], pair[1]) |
| 34 ZipFile(pair[1]).extractall() |
| 35 for name in glob.glob("*en_GB-ise*"): |
| 36 os.rename(name, name.replace("-ise", "")) |
| 37 os.remove(pair[1]) |
| 38 return 0 |
| 39 |
| 40 if __name__ == "__main__": |
| 41 sys.exit(main()) |
| OLD | NEW |