Aidan Phillips commited on
Commit
707614a
·
1 Parent(s): 052b859

utilities to help dial scaling function

Browse files
Files changed (2) hide show
  1. accuracy_scores.csv +100 -0
  2. test_accuracy.py +29 -0
accuracy_scores.csv ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ German,English,Accuracy Score
2
+ Ich bin müde.,I am tired.,99.99
3
+ Das ist mein Buch.,That is my book.,100.0
4
+ Er hat einen Hund.,He has a dog.,100.0
5
+ Wir gehen nach Hause.,We are going home.,100.0
6
+ Sie liest ein Buch.,She is reading a book.,99.97
7
+ Ich liebe Schokolade.,I love chocolate.,100.0
8
+ Hast du Geschwister?,Do you have siblings?,99.98
9
+ Heute ist es kalt.,It is cold today.,100.0
10
+ Wo ist der Bahnhof?,Where is the train station?,99.99
11
+ Das Wetter ist schön.,The weather is nice.,100.0
12
+ Er arbeitet im Büro.,He works in the office.,100.0
13
+ Ich trinke Wasser.,I am drinking water.,100.0
14
+ Sie tanzt gerne.,She likes dancing.,99.98
15
+ Kannst du mir helfen?,Can you help me?,100.0
16
+ Wir spielen Fußball.,We are playing soccer.,100.0
17
+ Das Auto ist neu.,The car is new.,100.0
18
+ Ich habe Hunger.,I am hungry.,100.0
19
+ Guten Morgen!,Good morning!,100.0
20
+ Er spricht Deutsch.,He speaks German.,100.0
21
+ Ich mag Katzen.,I like cats.,100.0
22
+ Sie kocht gern.,She likes cooking.,99.84
23
+ Der Apfel ist rot.,The apple is red.,100.0
24
+ Das Fenster ist offen.,The window is open.,100.0
25
+ Ich wohne in Berlin.,I live in Berlin.,100.0
26
+ Was machst du?,What are you doing?,100.0
27
+ Er spielt Gitarre.,He plays guitar.,100.0
28
+ Wir fahren morgen.,We are leaving tomorrow.,99.96
29
+ Ich verstehe nicht.,I don't understand.,97.59
30
+ Die Katze schläft.,The cat is sleeping.,100.0
31
+ Sie ist meine Freundin.,She is my friend.,100.0
32
+ Ich höre Musik.,I am listening to music.,99.98
33
+ Das Haus ist groß.,The house is big.,100.0
34
+ Er geht zur Schule.,He goes to school.,100.0
35
+ Hast du Zeit?,Do you have time?,100.0
36
+ Ich schreibe einen Brief.,I am writing a letter.,100.0
37
+ Die Tür ist geschlossen.,The door is closed.,100.0
38
+ Sie arbeitet viel.,She works a lot.,100.0
39
+ Ich sehe einen Vogel.,I see a bird.,100.0
40
+ Das Kind lacht.,The child is laughing.,100.0
41
+ Wo wohnst du?,Where do you live?,100.0
42
+ Ich lerne Deutsch.,I am learning German.,99.98
43
+ Kann ich helfen?,Can I help?,100.0
44
+ Das ist mein Bruder.,That is my brother.,100.0
45
+ Sie hat lange Haare.,She has long hair.,100.0
46
+ Wir sind müde.,We are tired.,100.0
47
+ Der Hund bellt.,The dog is barking.,99.94
48
+ Ich esse einen Apfel.,I am eating an apple.,100.0
49
+ Wie heißt du?,What is your name?,99.99
50
+ Mein Name ist Anna.,My name is Anna.,100.0
51
+ Ich liebe dich.,I love you.,100.0
52
+ Es ist sehr spät.,It is very late.,100.0
53
+ Ich habe keine Zeit.,I have no time.,100.0
54
+ Er liest die Zeitung.,He is reading the newspaper.,100.0
55
+ Sie singt ein Lied.,She is singing a song.,100.0
56
+ Ich sehe fern.,I am watching TV.,96.08
57
+ Das ist einfach.,That is easy.,99.99
58
+ Ich gehe einkaufen.,I am going shopping.,99.99
59
+ Wo arbeitest du?,Where do you work?,100.0
60
+ Ich arbeite im Krankenhaus.,I work at the hospital.,100.0
61
+ Sie hat blaue Augen.,She has blue eyes.,100.0
62
+ Wir essen zu Abend.,We are having dinner.,99.98
63
+ Der Himmel ist blau.,The sky is blue.,100.0
64
+ Was kostet das?,How much does that cost?,99.85
65
+ Ich nehme das.,I'll take that.,78.48
66
+ Ich bin krank.,I am sick.,99.99
67
+ Es tut mir leid.,I'm sorry.,100.0
68
+ Ich verstehe dich.,I understand you.,100.0
69
+ Mach das Fenster zu.,Close the window.,99.96
70
+ Wie spät ist es?,What time is it?,99.97
71
+ Ich bin zu Hause.,I am at home.,100.0
72
+ Gute Nacht!,Good night!,100.0
73
+ Sie tanzen gern.,They like to dance.,99.98
74
+ Ich gehe spazieren.,I am going for a walk.,99.98
75
+ Der Kaffee ist heiß.,The coffee is hot.,100.0
76
+ Woher kommst du?,Where are you from?,99.97
77
+ Ich komme aus Deutschland.,I am from Germany.,100.0
78
+ Sie hat ein schönes Lächeln.,She has a beautiful smile.,100.0
79
+ Ich brauche Hilfe.,I need help.,100.0
80
+ Das ist mein Vater.,That is my father.,100.0
81
+ Sie ist meine Mutter.,She is my mother.,100.0
82
+ Ich liebe meine Familie.,I love my family.,100.0
83
+ Heute ist Montag.,Today is Monday.,100.0
84
+ Ich bin glücklich.,I am happy.,100.0
85
+ Er ist traurig.,He is sad.,99.99
86
+ Wir lernen zusammen.,We are learning together.,99.99
87
+ Das ist interessant.,That is interesting.,100.0
88
+ Ich bin bereit.,I am ready.,100.0
89
+ Er ist mein Lehrer.,He is my teacher.,100.0
90
+ Der Ball ist rund.,The ball is round.,100.0
91
+ Ich gehe zur Arbeit.,I am going to work.,99.98
92
+ Sie trägt ein rotes Kleid.,She is wearing a red dress.,100.0
93
+ Ich mag deinen Stil.,I like your style.,99.99
94
+ Er lacht laut.,He is laughing loudly.,99.96
95
+ Wir sehen uns morgen.,See you tomorrow.,100.0
96
+ Ich wünsche dir viel Glück.,I wish you good luck.,100.0
97
+ Bitte sei leise.,Please be quiet.,100.0
98
+ Ich habe es vergessen.,I forgot it.,100.0
99
+ Es ist nicht wichtig.,It is not important.,100.0
100
+ Können wir reden?,Can we talk?,100.0
test_accuracy.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from categories.accuracy import *
2
+ import json
3
+ import csv
4
+ from tqdm import tqdm
5
+
6
+ try:
7
+ with open("./translations.json", "r") as f:
8
+ translations = json.loads(f.read())
9
+ except Exception as e:
10
+ print(e)
11
+ translations = None
12
+
13
+ accuracy_scores = []
14
+ print("Calculating accuracy scores...")
15
+ for t in tqdm(translations):
16
+ acc_s = accuracy(t["german"], t["english"])
17
+ accuracy_scores.append(acc_s["score"])
18
+
19
+ # Create a CSV file
20
+ with open('accuracy_scores.csv', 'w', newline='') as csvfile:
21
+ writer = csv.writer(csvfile)
22
+ # Write the header
23
+ writer.writerow(['German', 'English', 'Accuracy Score'])
24
+ # Write the data
25
+ print("\nWriting to CSV...")
26
+ for i, t in tqdm(enumerate(translations)):
27
+ writer.writerow([t['german'], t['english'], accuracy_scores[i]])
28
+
29
+ print(f"CSV file created with {len(translations)} entries.")