void dictionary_delete(Dictionary dict) { if (!dict) return; if (verbosity > 0) { prt_error("Info: Freeing dictionary %s", dict->name); } #ifdef USE_CORPUS lg_corpus_delete(dict->corpus); #endif if (dict->affix_table != NULL) { affix_list_delete(dict->affix_table); dictionary_delete(dict->affix_table); } spellcheck_destroy(dict->spell_checker); connector_set_delete(dict->unlimited_connector_set); if (dict->close) dict->close(dict); pp_knowledge_close(dict->base_knowledge); pp_knowledge_close(dict->hpsg_knowledge); string_set_delete(dict->string_set); free_regexs(dict->regex_root); #ifdef USE_ANYSPLIT free_anysplit(dict); #endif free_dictionary(dict); xfree(dict, sizeof(struct Dictionary_s)); object_open(NULL, NULL, NULL); /* Free the directory path cache */ }
int dictionary_delete(Dictionary dict) { if (verbosity > 0) { fprintf(stderr, "Freeing dictionary %s\n", dict->name); } if (dict->affix_table != NULL) { dictionary_delete(dict->affix_table); } connector_set_delete(dict->andable_connector_set); connector_set_delete(dict->unlimited_connector_set); post_process_close(dict->postprocessor); post_process_close(dict->constituent_pp); string_set_delete(dict->string_set); free_dictionary(dict); xfree(dict, sizeof(struct Dictionary_s)); return 0; }