def init_ppdb_model(dict_path, force_reload=False): # Load model once at runtime global PPDB_MODEL if PPDB_MODEL and not force_reload: return PPDB_MODEL ppdb_model = nmw.Ppdb(dict_path) PPDB_MODEL = ppdb_model return PPDB_MODEL
def init_ppdb_model(dict_path, force_reload=False): # Load model once at runtime global PPDB_MODEL model_name = os.path.basename(dict_path) if model_name in PPDB_MODEL and not force_reload: return PPDB_MODEL[model_name] model = nmw.Ppdb(dict_path) PPDB_MODEL[model_name] = model return model