def test_postagger_on_conll(test_file, model_path, out_file, delimeter='/'): test_temp_path = NamedTemporaryFile('w', encoding='utf-8', delete=False) test_temp_path.close() conll_to_slashtags([test_file], test_temp_path.name) test_postagger(test_temp_path.name, model_path, out_file, delimeter)
def train_postagger_on_conll(train_file, model_path, delimeter = '/'): temp_path = NamedTemporaryFile('w', encoding='utf-8', delete=False) temp_path.close() conll_to_slashtags([train_file], temp_path.name) train_postagger(temp_path.name, model_path, delimeter=delimeter) os.remove(temp_path.name)