diff options
Diffstat (limited to 'classification/test.py')
| -rw-r--r-- | classification/test.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/classification/test.py b/classification/test.py new file mode 100644 index 000000000..e0db00313 --- /dev/null +++ b/classification/test.py @@ -0,0 +1,16 @@ +from os import listdir, path + +directory : str = "./test_input" + +def test(classifier): + for name in listdir(directory): + with open(path.join(directory, name), "r") as file: + sequence_to_classify = file.read() + + candidate_labels = ['semantic', 'other', 'mistranslation', 'instruction'] + result = classifier(sequence_to_classify, candidate_labels, multi_label=True) + + print(name) + for label, score in zip(result["labels"], result["scores"]): + print(f"{label}: {score:.3f}") + print("") |