From 712310482c3dbef91c3eb6458d1bff82a275fa52 Mon Sep 17 00:00:00 2001 From: Christian Krinitsin Date: Fri, 30 May 2025 15:56:00 +0200 Subject: add test script for the classifier --- classification/test.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 classification/test.py (limited to 'classification/test.py') 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("") -- cgit 1.4.1