예제 #1
0
def test_analyze_concatenation(english_ipa_fst: FST):
    """
    Test that concatenation of the analysis works as expected when all
    elements include epsilons.
    """
    result, = english_ipa_fst.analyze('rough')
    assert result == ('ɹʌf', )
예제 #2
0
def test_cree_hfstol_analysis(cree_hfstol_analyzer: FST, surface_form,
                              analyses):
    """
    Test that cree hfstol work
    """
    assert set(cree_hfstol_analyzer.analyze(surface_form)) == {
        ''.join(x)
        for x in analyses
    }
예제 #3
0
def test_analyze_form_outside_of_alphabet(eat_fst: FST):
    """
    Analyzing forms with characters outside of the lower alphabet should
    reject instantly.
    """
    assert set(eat_fst.analyze('mîcisow')) == set()
예제 #4
0
def test_unacceptable_forms_in_flag_fst(unacceptable_form: str,
                                        english_flags_fst: FST):
    """
    Analyze forms that should not transduce on an FST **WITH** simple flag diacritics.
    """
    assert set(english_flags_fst.analyze(unacceptable_form)) == set()
예제 #5
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}
예제 #6
0
def test_analyze_eat_fst(surface_form: str, analyses: set, eat_fst: FST):
    """
    Apply up (analyze) on an FST **WITHOUT** flag diacritics.
    """
    assert set(eat_fst.analyze(surface_form)) == analyses
예제 #7
0
def test_cree_foma_analysis(cree_foma_analyzer: FST, surface_form, analyses):
    """
    Test that cree fomabin work
    """
    assert set(cree_foma_analyzer.analyze(surface_form)) == set(analyses)