def unpack(dicts, dest_dir, verbose): # dict_ext = os.path.splitext(dict_file)[1].upper() # if dict_ext != '.LSD': # raise LsdError("Need Lingvo lsd dictionary.") count = len(dicts) if count == 1: print("Unpacking dict: %s" % dicts[0]) for i in range(count): dict_file = dicts[i] start = timer() try: if count > 1: print("Unpacking dict (%d from %d): %s" % (i + 1, count, dict_file)) m = LsdFile(dict_file, verbose) m.parse() m.dump() m.write(dest_dir) except ValueError as e: print("Error: %s" % e) return 1 end = timer() print("Unpack OK (%s)" % tools.display_time(end - start)) return 0
def header(dicts): # dict_ext = os.path.splitext(dict_file)[1].upper() # if dict_ext != '.LSD': # raise LsdError("Need Lingvo lsd dictionary.") count = len(dicts) if count == 1: print("Unpacking dict: %s" % dicts[0]) for i in range(count): dict_file = dicts[i] try: if count > 1: print("Unpacking dict (%d from %d): %s" % (i + 1, count, dict_file)) m = LsdFile(dict_file, True) m.dump() # print("Header %s OK" % dict_file) except ValueError, e: print("Error: %s" % e) return 1