コード例 #1
0
def test_generate_form_outside_of_alphabet(eat_fst: FST):
    """
    Generating forms with characters outside of the upper alphabet should
    reject instantly.
    """
    assert set(eat_fst.generate('wug' '+N' '+Pl')) == set()
コード例 #2
0
def test_flag_fst(surface_form: str, analysis, english_flags_fst: FST):
    """
    Analyze and generate on an FST **WITH** simple flag diacritics.
    """
    assert set(english_flags_fst.analyze(surface_form)) == {analysis}
    assert set(english_flags_fst.generate(''.join(analysis))) == {surface_form}
コード例 #3
0
def test_cree_hfstol_generation(cree_hfstol_generator: FST, word, analysis):
    """
    Test that cree hfstol work
    """
    assert set(cree_hfstol_generator.generate(''.join(analysis))) == set(word)
コード例 #4
0
def test_generate_eat_fst(analysis: str, surface_form: set, eat_fst: FST):
    """
    Apply down (generate) on an FST **WITHOUT** flag diacritics.
    """
    actual, = eat_fst.generate(analysis)
    assert actual == surface_form
コード例 #5
0
def test_cree_foma_generation(cree_foma_generator: FST, word, analysis):
    """
    Test that cree fomabin work
    """
    assert set(cree_foma_generator.generate(''.join(analysis))) == set(word)