def compress_dictionaries(folder_path): file_names = [ 'drug.dic', 'disorder.dic', 'device.dic', 'procedure.dic' ] file_paths = [os.path.join(folder_path, file) for file in file_names] for file in file_paths: print('Compresing {}...'.format(file)) compress(file)
def setUpClass(self): self._arguments = Arguments() dictionary = self._arguments["dic"] kwargs = {} kwargs["output"] = None kwargs["flip"] = False kwargs["semitic"] = False kwargs["version"] = UnitexConstants.DICTIONARY_VERSION_1 ret = compress(dictionary, **kwargs) grammar = self._arguments["grf"] alphabet = self._arguments["alphabet"] kwargs = {} kwargs["loop_check"] = False kwargs["char_by_char"] = False kwargs["pkgdir"] = None kwargs["no_empty_graph_warning"] = False kwargs["tfst_check"] = False kwargs["silent_grf_name"] = False kwargs["named_repositories"] = None kwargs["debug"] = False kwargs["check_variables"] = False ret = grf2fst2(grammar, alphabet, **kwargs)
def test_01_load_dictionary(self): kwargs = {} kwargs["output"] = None kwargs["flip"] = False kwargs["semitic"] = False kwargs["version"] = UnitexConstants.DICTIONARY_VERSION_1 ret = compress(self._arguments["dic"], **kwargs) path = self._arguments["bin"] output = load_persistent_dictionary(path) self._arguments["persistent-dictionary"] = output ok = is_persistent_dictionary(output) self.assertTrue(ok, "Dictionary loading failed!")