Пример #1
0
def test_get_boundary_counts(kwik_e_mart_nlp, expected, predicted,
                             expected_counts):
    predicted_counts = taggers.get_boundary_counts(
        expected, predicted, taggers.BoundaryCounts()).to_dict()

    for key in predicted_counts.keys():
        if predicted_counts[key] != expected_counts.get(key, 0):
            print("predicted counts: {}".format(predicted_counts))
            assert False
Пример #2
0
def test_get_boundary_counts_sequential(kwik_e_mart_nlp, expected, predicted,
                                        expected_counts):
    boundary_counts = taggers.BoundaryCounts()
    for expected_sequence, predicted_sequence in zip(expected, predicted):
        boundary_counts = taggers.get_boundary_counts(expected_sequence,
                                                      predicted_sequence,
                                                      boundary_counts)
    predicted_counts = boundary_counts.to_dict()

    for key in predicted_counts.keys():
        if predicted_counts[key] != expected_counts.get(key, 0):
            assert False