def test_check_grammar(): g = [g for g in ag.get_grammar_files() if 'Colloc0_aesp' in g][0] assert ag.check_grammar(g, 'Colloc0') with pytest.raises(RuntimeError): ag.check_grammar(g, 'Phonemes') with pytest.raises(RuntimeError): ag.check_grammar(g + 'nonexistingfile', '')
def test_grammar_files(): assert ag.get_grammar_files()
# 'token_fscore': 0.2642, # 'token_precision': 0.238, # 'token_recall': 0.2969, # 'boundary_fscore': 0.5361, # 'boundary_precision': 0.4754, # 'boundary_recall': 0.6145} # # Because we use so few data and iterations, the results are # # not stable, we limit the precision to 0.3 # for k, v in score.items(): # assert expected[k] == pytest.approx(v, abs=0.3), k TEST_ARGUMENTS = ('-E -P -R -1 -n 10 -a 0.0001 -b 10000.0 ' '-e 1.0 -f 1.0 -g 100.0 -h 0.01 -x 2') GRAMMAR_DIR = os.path.dirname(ag.get_grammar_files()[0]) GRAMMARS = [('Coll3syllfnc_enFestival.lt', 'Word'), ('Colloc0_enFestival.lt', 'Colloc0')] def test_grammar_files(): assert ag.get_grammar_files() def test_check_grammar(): g = [g for g in ag.get_grammar_files() if 'Colloc0_aesp' in g][0] assert ag.check_grammar(g, 'Colloc0') with pytest.raises(RuntimeError): ag.check_grammar(g, 'Phonemes')