Aidan Phillips
commited on
Commit
·
c2756e2
1
Parent(s):
707614a
updated accuracy scaling function
Browse files- accuracy_scores.csv +99 -99
- categories/accuracy.py +9 -3
accuracy_scores.csv
CHANGED
@@ -1,100 +1,100 @@
|
|
1 |
German,English,Accuracy Score
|
2 |
-
Ich bin müde.,I am tired.,
|
3 |
-
Das ist mein Buch.,That is my book.,
|
4 |
-
Er hat einen Hund.,He has a dog.,
|
5 |
-
Wir gehen nach Hause.,We are going home.,
|
6 |
-
Sie liest ein Buch.,She is reading a book.,
|
7 |
-
Ich liebe Schokolade.,I love chocolate.,
|
8 |
-
Hast du Geschwister?,Do you have siblings?,
|
9 |
-
Heute ist es kalt.,It is cold today.,
|
10 |
-
Wo ist der Bahnhof?,Where is the train station?,
|
11 |
-
Das Wetter ist schön.,The weather is nice.,
|
12 |
-
Er arbeitet im Büro.,He works in the office.,
|
13 |
-
Ich trinke Wasser.,I am drinking water.,
|
14 |
-
Sie tanzt gerne.,She likes dancing.,
|
15 |
-
Kannst du mir helfen?,Can you help me?,
|
16 |
-
Wir spielen Fußball.,We are playing soccer.,
|
17 |
-
Das Auto ist neu.,The car is new.,
|
18 |
-
Ich habe Hunger.,I am hungry.,
|
19 |
-
Guten Morgen!,Good morning!,
|
20 |
-
Er spricht Deutsch.,He speaks German.,
|
21 |
-
Ich mag Katzen.,I like cats.,
|
22 |
-
Sie kocht gern.,She likes cooking.,
|
23 |
-
Der Apfel ist rot.,The apple is red.,
|
24 |
-
Das Fenster ist offen.,The window is open.,
|
25 |
-
Ich wohne in Berlin.,I live in Berlin.,
|
26 |
-
Was machst du?,What are you doing?,
|
27 |
-
Er spielt Gitarre.,He plays guitar.,
|
28 |
-
Wir fahren morgen.,We are leaving tomorrow.,
|
29 |
-
Ich verstehe nicht.,I don't understand.,
|
30 |
-
Die Katze schläft.,The cat is sleeping.,
|
31 |
-
Sie ist meine Freundin.,She is my friend.,
|
32 |
-
Ich höre Musik.,I am listening to music.,
|
33 |
-
Das Haus ist groß.,The house is big.,
|
34 |
-
Er geht zur Schule.,He goes to school.,
|
35 |
-
Hast du Zeit?,Do you have time?,
|
36 |
-
Ich schreibe einen Brief.,I am writing a letter.,
|
37 |
-
Die Tür ist geschlossen.,The door is closed.,
|
38 |
-
Sie arbeitet viel.,She works a lot.,
|
39 |
-
Ich sehe einen Vogel.,I see a bird.,
|
40 |
-
Das Kind lacht.,The child is laughing.,
|
41 |
-
Wo wohnst du?,Where do you live?,
|
42 |
-
Ich lerne Deutsch.,I am learning German.,
|
43 |
-
Kann ich helfen?,Can I help?,
|
44 |
-
Das ist mein Bruder.,That is my brother.,
|
45 |
-
Sie hat lange Haare.,She has long hair.,
|
46 |
-
Wir sind müde.,We are tired.,
|
47 |
-
Der Hund bellt.,The dog is barking.,
|
48 |
-
Ich esse einen Apfel.,I am eating an apple.,
|
49 |
-
Wie heißt du?,What is your name?,
|
50 |
-
Mein Name ist Anna.,My name is Anna.,
|
51 |
-
Ich liebe dich.,I love you.,
|
52 |
-
Es ist sehr spät.,It is very late.,
|
53 |
-
Ich habe keine Zeit.,I have no time.,
|
54 |
-
Er liest die Zeitung.,He is reading the newspaper.,
|
55 |
-
Sie singt ein Lied.,She is singing a song.,
|
56 |
-
Ich sehe fern.,I am watching TV.,
|
57 |
-
Das ist einfach.,That is easy.,
|
58 |
-
Ich gehe einkaufen.,I am going shopping.,
|
59 |
-
Wo arbeitest du?,Where do you work?,
|
60 |
-
Ich arbeite im Krankenhaus.,I work at the hospital.,
|
61 |
-
Sie hat blaue Augen.,She has blue eyes.,
|
62 |
-
Wir essen zu Abend.,We are having dinner.,
|
63 |
-
Der Himmel ist blau.,The sky is blue.,
|
64 |
-
Was kostet das?,How much does that cost?,
|
65 |
-
Ich nehme das.,I'll take that.,
|
66 |
-
Ich bin krank.,I am sick.,
|
67 |
-
Es tut mir leid.,I'm sorry.,
|
68 |
-
Ich verstehe dich.,I understand you.,
|
69 |
-
Mach das Fenster zu.,Close the window.,
|
70 |
-
Wie spät ist es?,What time is it?,
|
71 |
-
Ich bin zu Hause.,I am at home.,
|
72 |
-
Gute Nacht!,Good night!,
|
73 |
-
Sie tanzen gern.,They like to dance.,
|
74 |
-
Ich gehe spazieren.,I am going for a walk.,
|
75 |
-
Der Kaffee ist heiß.,The coffee is hot.,
|
76 |
-
Woher kommst du?,Where are you from?,
|
77 |
-
Ich komme aus Deutschland.,I am from Germany.,
|
78 |
-
Sie hat ein schönes Lächeln.,She has a beautiful smile.,
|
79 |
-
Ich brauche Hilfe.,I need help.,
|
80 |
-
Das ist mein Vater.,That is my father.,
|
81 |
-
Sie ist meine Mutter.,She is my mother.,
|
82 |
-
Ich liebe meine Familie.,I love my family.,
|
83 |
-
Heute ist Montag.,Today is Monday.,
|
84 |
-
Ich bin glücklich.,I am happy.,
|
85 |
-
Er ist traurig.,He is sad.,
|
86 |
-
Wir lernen zusammen.,We are learning together.,
|
87 |
-
Das ist interessant.,That is interesting.,
|
88 |
-
Ich bin bereit.,I am ready.,
|
89 |
-
Er ist mein Lehrer.,He is my teacher.,
|
90 |
-
Der Ball ist rund.,The ball is round.,
|
91 |
-
Ich gehe zur Arbeit.,I am going to work.,
|
92 |
-
Sie trägt ein rotes Kleid.,She is wearing a red dress.,
|
93 |
-
Ich mag deinen Stil.,I like your style.,
|
94 |
-
Er lacht laut.,He is laughing loudly.,
|
95 |
-
Wir sehen uns morgen.,See you tomorrow.,
|
96 |
-
Ich wünsche dir viel Glück.,I wish you good luck.,
|
97 |
-
Bitte sei leise.,Please be quiet.,
|
98 |
-
Ich habe es vergessen.,I forgot it.,
|
99 |
-
Es ist nicht wichtig.,It is not important.,
|
100 |
-
Können wir reden?,Can we talk?,
|
|
|
1 |
German,English,Accuracy Score
|
2 |
+
Ich bin müde.,I am tired.,0.93
|
3 |
+
Das ist mein Buch.,That is my book.,0.97
|
4 |
+
Er hat einen Hund.,He has a dog.,0.97
|
5 |
+
Wir gehen nach Hause.,We are going home.,0.95
|
6 |
+
Sie liest ein Buch.,She is reading a book.,0.88
|
7 |
+
Ich liebe Schokolade.,I love chocolate.,0.97
|
8 |
+
Hast du Geschwister?,Do you have siblings?,0.89
|
9 |
+
Heute ist es kalt.,It is cold today.,0.96
|
10 |
+
Wo ist der Bahnhof?,Where is the train station?,0.93
|
11 |
+
Das Wetter ist schön.,The weather is nice.,0.95
|
12 |
+
Er arbeitet im Büro.,He works in the office.,0.97
|
13 |
+
Ich trinke Wasser.,I am drinking water.,0.94
|
14 |
+
Sie tanzt gerne.,She likes dancing.,0.9
|
15 |
+
Kannst du mir helfen?,Can you help me?,0.97
|
16 |
+
Wir spielen Fußball.,We are playing soccer.,0.94
|
17 |
+
Das Auto ist neu.,The car is new.,0.95
|
18 |
+
Ich habe Hunger.,I am hungry.,0.96
|
19 |
+
Guten Morgen!,Good morning!,0.99
|
20 |
+
Er spricht Deutsch.,He speaks German.,0.95
|
21 |
+
Ich mag Katzen.,I like cats.,0.95
|
22 |
+
Sie kocht gern.,She likes cooking.,0.83
|
23 |
+
Der Apfel ist rot.,The apple is red.,0.94
|
24 |
+
Das Fenster ist offen.,The window is open.,0.95
|
25 |
+
Ich wohne in Berlin.,I live in Berlin.,0.97
|
26 |
+
Was machst du?,What are you doing?,0.95
|
27 |
+
Er spielt Gitarre.,He plays guitar.,0.96
|
28 |
+
Wir fahren morgen.,We are leaving tomorrow.,0.87
|
29 |
+
Ich verstehe nicht.,I don't understand.,0.76
|
30 |
+
Die Katze schläft.,The cat is sleeping.,0.95
|
31 |
+
Sie ist meine Freundin.,She is my friend.,0.96
|
32 |
+
Ich höre Musik.,I am listening to music.,0.89
|
33 |
+
Das Haus ist groß.,The house is big.,0.95
|
34 |
+
Er geht zur Schule.,He goes to school.,0.98
|
35 |
+
Hast du Zeit?,Do you have time?,0.94
|
36 |
+
Ich schreibe einen Brief.,I am writing a letter.,0.93
|
37 |
+
Die Tür ist geschlossen.,The door is closed.,0.97
|
38 |
+
Sie arbeitet viel.,She works a lot.,0.94
|
39 |
+
Ich sehe einen Vogel.,I see a bird.,0.97
|
40 |
+
Das Kind lacht.,The child is laughing.,0.96
|
41 |
+
Wo wohnst du?,Where do you live?,0.94
|
42 |
+
Ich lerne Deutsch.,I am learning German.,0.9
|
43 |
+
Kann ich helfen?,Can I help?,0.96
|
44 |
+
Das ist mein Bruder.,That is my brother.,0.98
|
45 |
+
Sie hat lange Haare.,She has long hair.,0.97
|
46 |
+
Wir sind müde.,We are tired.,0.93
|
47 |
+
Der Hund bellt.,The dog is barking.,0.86
|
48 |
+
Ich esse einen Apfel.,I am eating an apple.,0.94
|
49 |
+
Wie heißt du?,What is your name?,0.91
|
50 |
+
Mein Name ist Anna.,My name is Anna.,0.99
|
51 |
+
Ich liebe dich.,I love you.,0.97
|
52 |
+
Es ist sehr spät.,It is very late.,0.98
|
53 |
+
Ich habe keine Zeit.,I have no time.,0.95
|
54 |
+
Er liest die Zeitung.,He is reading the newspaper.,0.94
|
55 |
+
Sie singt ein Lied.,She is singing a song.,0.95
|
56 |
+
Ich sehe fern.,I am watching TV.,0.74
|
57 |
+
Das ist einfach.,That is easy.,0.93
|
58 |
+
Ich gehe einkaufen.,I am going shopping.,0.91
|
59 |
+
Wo arbeitest du?,Where do you work?,0.94
|
60 |
+
Ich arbeite im Krankenhaus.,I work at the hospital.,0.96
|
61 |
+
Sie hat blaue Augen.,She has blue eyes.,0.97
|
62 |
+
Wir essen zu Abend.,We are having dinner.,0.89
|
63 |
+
Der Himmel ist blau.,The sky is blue.,0.96
|
64 |
+
Was kostet das?,How much does that cost?,0.84
|
65 |
+
Ich nehme das.,I'll take that.,0.69
|
66 |
+
Ich bin krank.,I am sick.,0.92
|
67 |
+
Es tut mir leid.,I'm sorry.,0.94
|
68 |
+
Ich verstehe dich.,I understand you.,0.95
|
69 |
+
Mach das Fenster zu.,Close the window.,0.88
|
70 |
+
Wie spät ist es?,What time is it?,0.89
|
71 |
+
Ich bin zu Hause.,I am at home.,0.95
|
72 |
+
Gute Nacht!,Good night!,0.98
|
73 |
+
Sie tanzen gern.,They like to dance.,0.9
|
74 |
+
Ich gehe spazieren.,I am going for a walk.,0.9
|
75 |
+
Der Kaffee ist heiß.,The coffee is hot.,0.97
|
76 |
+
Woher kommst du?,Where are you from?,0.89
|
77 |
+
Ich komme aus Deutschland.,I am from Germany.,0.95
|
78 |
+
Sie hat ein schönes Lächeln.,She has a beautiful smile.,0.96
|
79 |
+
Ich brauche Hilfe.,I need help.,0.94
|
80 |
+
Das ist mein Vater.,That is my father.,0.97
|
81 |
+
Sie ist meine Mutter.,She is my mother.,0.98
|
82 |
+
Ich liebe meine Familie.,I love my family.,0.98
|
83 |
+
Heute ist Montag.,Today is Monday.,0.97
|
84 |
+
Ich bin glücklich.,I am happy.,0.96
|
85 |
+
Er ist traurig.,He is sad.,0.93
|
86 |
+
Wir lernen zusammen.,We are learning together.,0.92
|
87 |
+
Das ist interessant.,That is interesting.,0.97
|
88 |
+
Ich bin bereit.,I am ready.,0.96
|
89 |
+
Er ist mein Lehrer.,He is my teacher.,0.98
|
90 |
+
Der Ball ist rund.,The ball is round.,0.95
|
91 |
+
Ich gehe zur Arbeit.,I am going to work.,0.89
|
92 |
+
Sie trägt ein rotes Kleid.,She is wearing a red dress.,0.96
|
93 |
+
Ich mag deinen Stil.,I like your style.,0.9
|
94 |
+
Er lacht laut.,He is laughing loudly.,0.88
|
95 |
+
Wir sehen uns morgen.,See you tomorrow.,0.95
|
96 |
+
Ich wünsche dir viel Glück.,I wish you good luck.,0.96
|
97 |
+
Bitte sei leise.,Please be quiet.,0.94
|
98 |
+
Ich habe es vergessen.,I forgot it.,0.96
|
99 |
+
Es ist nicht wichtig.,It is not important.,0.97
|
100 |
+
Können wir reden?,Can we talk?,0.96
|
categories/accuracy.py
CHANGED
@@ -77,7 +77,7 @@ def __get_bertscore(src_sentence: str, trg_sentence: str) -> float:
|
|
77 |
return similarity
|
78 |
|
79 |
|
80 |
-
def __bertscore_to_percentage(similarity: float) -> float:
|
81 |
"""
|
82 |
Convert the BERTScore cosine similarity to a percentage score (0-100).
|
83 |
|
@@ -89,8 +89,14 @@ def __bertscore_to_percentage(similarity: float) -> float:
|
|
89 |
"""
|
90 |
# Scale the similarity score from [-1, 1] range to [0, 100] (rarely negative)
|
91 |
# Logistic function: 100 / (1 + exp(-k * (x - 0.5))), where k controls steepness
|
92 |
-
k = 35 # Steepness parameter - higher values create a sharper transition
|
93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
return round(scaled_score, 2)
|
95 |
|
96 |
|
|
|
77 |
return similarity
|
78 |
|
79 |
|
80 |
+
def __bertscore_to_percentage(similarity: float, debug: bool = False) -> float:
|
81 |
"""
|
82 |
Convert the BERTScore cosine similarity to a percentage score (0-100).
|
83 |
|
|
|
89 |
"""
|
90 |
# Scale the similarity score from [-1, 1] range to [0, 100] (rarely negative)
|
91 |
# Logistic function: 100 / (1 + exp(-k * (x - 0.5))), where k controls steepness
|
92 |
+
# k = 35 # Steepness parameter - higher values create a sharper transition
|
93 |
+
|
94 |
+
if debug:
|
95 |
+
scaled_score = similarity
|
96 |
+
else:
|
97 |
+
scaled_score = max(100 / (1 + np.exp(-11 * (similarity - 0.60))), 100 / (1 + np.exp(-5 * (similarity - 0.60))))
|
98 |
+
|
99 |
+
# scaled_score = similarity
|
100 |
return round(scaled_score, 2)
|
101 |
|
102 |
|