def __init__(self, path, similarity_name, threshold): if not (os.path.exists(path)) or not (os.path.isdir(path)): err_msg = ( '"{}" does not exists or it is not a directory.').format(path) raise IOError(err_msg) self.db = simstring.reader( prepare_string_for_db_input(os.path.join(path, 'dup.simstring'))) self.db.measure = getattr(simstring, similarity_name) self.db.threshold = threshold
def __init__(self, path, similarity_name, threshold): if not(os.path.exists(path)) or not(os.path.isdir(path)): err_msg = ( '"{}" does not exists or it is not a directory.' ).format(path) raise IOError(err_msg) self.db = simstring.reader( prepare_string_for_db_input( os.path.join(path, 'umls-terms.simstring') ) ) self.db.measure = getattr(simstring, similarity_name) self.db.threshold = threshold