summary refs log tree commit diff stats
path: root/classification/test.py
diff options
context:
space:
mode:
Diffstat (limited to 'classification/test.py')
-rw-r--r--classification/test.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/classification/test.py b/classification/test.py
new file mode 100644
index 00000000..e0db0031
--- /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("")