Skip to content

Commit e5b0953

Browse files
committed
Merge branch 'more-international-support'
2 parents 34aeaeb + 30925aa commit e5b0953

File tree

3 files changed

+96
-36
lines changed

3 files changed

+96
-36
lines changed

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased] - YYYY-MM-DD
99

1010
### Added
11-
* Italian support
11+
* Bahasa Indonesia, Nederands, and Vietnamese support
12+
1213

1314
### Changed
1415

@@ -22,6 +23,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2223
### Fixed
2324

2425

26+
## [v0.1.4] - 2024-10-09
27+
28+
### Added
29+
* Bahasa Indonesia support
30+
* Nederands support
31+
* Vietnamese support
32+
33+
2534
## [v0.1.3] - 2024-10-06
2635

2736
### Added

ai_tutor.py

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,16 @@ def get_directive(explanation_in:str) -> str:
165165
d = {
166166
'Korean': '숙제 답안으로 제출한 코드가 오류를 일으킨 원인을 입문자 용어만으로 중복 없는 간결한 문장으로 설명하시오.',
167167
'English': 'Explain in beginner terms, without duplicates, the cause of the error in the code submitted as homework.',
168-
'Japanese': '宿題の回答として提出されたコードがエラーの原因を、初心者向けの用語で重複なく簡潔に説明してください。',
168+
'Bahasa Indonesia': 'Jelaskan dalam istilah pemula, tanpa duplikat, penyebab kesalahan dalam kode yang dikirim sebagai pekerjaan rumah.',
169169
'Chinese': '请用初学者术语简洁地解释作业提交的代码出错的原因,不要重复。',
170-
'Spanish': 'Explique en términos para principiantes, sin duplicados, la causa del error en el código enviado como tarea.',
171170
'French': '''Expliquez en termes de débutant, sans doublons, la cause de l'erreur dans le code soumis comme devoir.''',
172171
'German': 'Erklären Sie in Anfängerterminologie ohne Duplikate die Ursache des Fehlers im als Hausaufgabe eingereichten Code.',
173172
'Italian': 'Spiega in termini per principianti, senza duplicati, la causa dell\'errore nel codice inviato come compito.',
173+
'Japanese': '宿題の回答として提出されたコードがエラーの原因を、初心者向けの用語で重複なく簡潔に説明してください。',
174+
'Nederlands': 'Leg in beginners termen, zonder duplicaten, de oorzaak van de fout in de code die als huiswerk is ingediend uit.',
175+
'Spanish': 'Explique en términos para principiantes, sin duplicados, la causa del error en el código enviado como tarea.',
174176
'Thai': 'อธิบายด้วยภาษาของผู้เริ่มต้นโดยไม่ซ้ำซ้อนว่าสาเหตุของข้อผิดพลาดในรหัสที่ส่งเป็นการบ้านคืออะไร',
177+
'Vietnamese': 'Hãy giải thích lỗi trong đoạn mã bài tập đã nộp bằng ngôn ngữ dễ hiểu dành cho người mới bắt đầu, và đừng lặp lại thông tin.',
175178
}
176179
return f"{d[explanation_in]}\n"
177180

@@ -199,13 +202,16 @@ def get_report_header(explanation_in:str) -> str:
199202
d = {
200203
'Korean': "오류 메시지 시작",
201204
'English': "Error Message Start",
202-
'Japanese': "エラーメッセージ開始",
205+
'Bahasa Indonesia': "Pesan Kesalahan Dimulai",
203206
'Chinese': "错误消息开始",
204-
'Spanish': "Mensaje de error comienza",
205207
'French': '''Message d'erreur commence''',
206208
'German': "Fehlermeldung beginnt",
207209
'Italian': "Messaggio di errore inizia",
210+
'Japanese': "エラーメッセージ開始",
211+
'Nederlands': "Foutmelding begint",
212+
'Spanish': "Mensaje de error comienza",
208213
'Thai': "ข้อความผิดพลาดเริ่มต้น",
214+
'Vietnamese': "Thông báo lỗi bắt đầu",
209215
}
210216
return (
211217
f"## {d[explanation_in]}\n"
@@ -217,13 +223,16 @@ def get_report_footer(explanation_in:str) -> str:
217223
d = {
218224
'Korean': "오류 메시지 끝",
219225
'English': "Error Message End",
220-
'Japanese': "エラーメッセージ終わり",
226+
'Bahasa Indonesia': "Pesan Kesalahan Berakhir",
221227
'Chinese': "错误消息结束",
222-
'Spanish': "Mensaje de error termina",
223228
'French': '''Message d'erreur fin''',
224229
'German': "Fehlermeldung endet",
225230
'Italian': "Messaggio di errore finisce",
231+
'Japanese': "エラーメッセージ終わり",
232+
'Nederlands': "Foutmelding eindigt",
233+
'Spanish': "Mensaje de error termina",
226234
'Thai': "ข้อความผิดพลาดสิ้นสุด",
235+
'Vietnamese': "Thông báo lỗi kết thúc",
227236
}
228237
return (
229238
f"## {d[explanation_in]}\n"
@@ -240,49 +249,61 @@ def get_code_instruction(
240249
d_homework_start = {
241250
'Korean': "숙제 제출 코드 시작",
242251
'English': "Homework Submission Code Start",
243-
'Japanese': "宿題提出コード開始",
252+
'Bahasa Indonesia': "Kode Pengumpulan Tugas Dimulai",
244253
'Chinese': "作业提交代码开始",
245-
'Spanish': "Inicio del código de envío de tareas",
246254
'French': '''Début du code de soumission des devoirs''',
247255
'German': "Code für die Einreichung von Hausaufgaben von hier aus",
248256
'Italian': "Inizio del codice di invio dei compiti",
257+
'Japanese': "宿題提出コード開始",
258+
'Nederlands': "Huiswerk inzendcode begint",
259+
'Spanish': "Inicio del código de envío de tareas",
249260
'Thai': "การส่งงานเริ่มต้น",
261+
'Vietnamese': "Bắt đầu mã nộp bài tập",
250262
}
251263

252264
d_homework_end = {
253265
'Korean': "숙제 제출 코드 끝",
254266
'English': "Homework Submission Code End",
255-
'Japanese': "宿題提出コード終わり",
267+
'Bahasa Indonesia': "Kode Pengumpulan Tugas Berakhir",
256268
'Chinese': "作业提交代码结束",
257-
'Spanish': "Fin del código de envío de tareas",
258269
'French': '''Fin du code de soumission des devoirs''',
259270
'German': "Ende der Hausaufgaben-Einreichungscodes",
260271
'Italian': "Fine del codice di invio dei compiti",
272+
'Japanese': "宿題提出コード終わり",
273+
'Nederlands': "Huiswerk inzendcode eindigt",
274+
'Spanish': "Fin del código de envío de tareas",
261275
'Thai': "การส่งงานสิ้นสุด",
276+
'Vietnamese': "Mã nộp bài tập kết thúc",
262277
}
263278

264279
d_instruction_start = {
265280
'Korean': "과제 지침 시작",
266281
'English': "Assignment Instruction Start",
267-
'Japanese': "課題指示開始",
282+
'Bahasa Indonesia': "Instruksi Tugas Dimulai",
268283
'Chinese': "作业说明开始",
269-
'Spanish': "Inicio de la instrucción de la tarea",
270284
'French': '''Début de l'instruction de la tâche''',
271285
'German': "Start der Aufgabenanweisung",
272286
'Italian': "Inizio dell'istruzione dell'assegnazione",
287+
'Japanese': "課題指示開始",
288+
'Nederlands': "Start van de taakinstructie",
289+
'Spanish': "Inicio de la instrucción de la tarea",
273290
'Thai': "คำแนะนำการบ้านเริ่มต้น",
291+
'Vietnamese': "Bắt đầu hướng dẫn nhiệm vụ",
274292
}
275293

276294
d_instruction_end = {
277295
'Korean': "과제 지침 끝",
278296
'English': "Assignment Instruction End",
279-
'Japanese': "課題指示終わり",
297+
'Bahasa Indonesia': "Instruksi Tugas Berakhir",
280298
'Chinese': "作业说明结束",
281-
'Spanish': "Fin de la instrucción de la tarea",
282299
'French': '''Fin de l'instruction de la tâche''',
283300
'German': "Ende der Aufgabenanweisung",
284301
'Italian': "Fine dell'istruzione dell'assegnazione",
302+
'Japanese': "課題指示終わり",
303+
'Nederlands': "Einde van de taakinstructie",
304+
'Spanish': "Fin de la instrucción de la tarea",
285305
'Thai': "คำแนะนำการบ้านสิ้นสุด",
306+
'Vietnamese': "Kết thúc hướng dẫn nhiệm vụ",
286307
}
287308

288309
return (

tests/test_ai_tutor.py

Lines changed: 51 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -57,23 +57,26 @@ def test_collect_longrepr(json_dict_div_zero_try_except:Dict):
5757
assert result
5858

5959

60-
@pytest.fixture(params=('Korean', 'English', 'Japanese', 'Chinese', 'Spanish', 'French', 'German', 'Italian', 'Thai'))
60+
@pytest.fixture(params=('Korean', 'English', 'Bahasa Indonesia', 'Chinese', 'French', 'German', 'Italian', 'Japanese', 'Nederlands', 'Spanish', 'Thai', 'Vietnamese'))
6161
def explanation_in(request) -> str:
62-
return request.param.capitalize()
62+
return request.param
6363

6464

6565
@pytest.fixture
6666
def homework(explanation_in:str) -> Tuple[str]:
6767
d = {
6868
'Korean': ('숙제',),
6969
'English': ('Homework',),
70-
'Japanese': ('宿題',),
70+
'Bahasa Indonesia': ('tugas', 'pekerjaan rumah', 'PR'),
7171
'Chinese': ('作业',),
72-
'Spanish': ('Tarea',),
7372
'French': ('Devoir',),
7473
'German': ('Hausaufgabe',),
7574
'Italian': ('Compito', 'Compiti'),
75+
'Japanese': ('宿題',),
76+
'Nederlands': ('Huiswerk',),
77+
'Spanish': ('Tarea',),
7678
'Thai': ('การบ้าน',),
79+
'Vietnamese': ('Bài tập',),
7780
}
7881
return tuple(
7982
map(
@@ -88,13 +91,16 @@ def msg(explanation_in:str) -> str:
8891
d = {
8992
'Korean': '메시지',
9093
'English': 'Message',
91-
'Japanese': 'メッセ',
94+
'Bahasa Indonesia': 'Pesan',
9295
'Chinese': '消息',
93-
'Spanish': 'Mensaje',
9496
'French': 'Message',
9597
'German': 'Fehlermeldung',
9698
'Italian': 'Messaggio',
99+
'Japanese': 'メッセ',
100+
'Nederlands': 'Foutmelding', # error message
101+
'Spanish': 'Mensaje',
97102
'Thai': 'ข้อความ',
103+
'Vietnamese': 'thông báo', # notification
98104
}
99105
return d[explanation_in].lower()
100106

@@ -107,17 +113,21 @@ def test_get_directive(explanation_in:str, homework:Tuple[str]):
107113
lambda x: x in result.lower(),
108114
homework
109115
)
116+
), (
117+
f"Could not find homework: {homework} in result: {result}."
110118
)
111119

112120

113121
def test_get_instruction(explanation_in:str, homework:Tuple[str],):
114-
result = ai_tutor.get_directive(explanation_in=explanation_in)
122+
result = ai_tutor.get_directive(explanation_in=explanation_in).lower()
115123

116124
assert any(
117125
map(
118-
lambda x: x in result.lower(),
126+
lambda x: x in result,
119127
homework
120128
)
129+
), (
130+
f"Could not find homework: {homework} in result: {result}."
121131
)
122132

123133

@@ -126,7 +136,7 @@ def test_get_report__header__footer(explanation_in:str, msg:str, func:Callable):
126136

127137
result = func(explanation_in=explanation_in)
128138

129-
assert msg in result.lower()
139+
assert msg in result.lower(), f"Could not find msg: {msg} in result: {result}."
130140

131141

132142
@pytest.fixture
@@ -142,17 +152,25 @@ def sample_readme_path() -> pathlib.Path:
142152
@pytest.fixture
143153
def instruction(explanation_in:str) -> str:
144154
d = {
145-
'Korean': '지침',
146-
'English': 'Instruction',
147-
'Japanese': '指示',
148-
'Chinese': '说明',
149-
'Spanish': 'instrucción',
150-
'French': 'instruction',
151-
'German': 'Aufgabenanweisung',
152-
'Italian': 'istruzione',
153-
'Thai': 'แนะนำ',
155+
'Korean': ('지침',),
156+
'English': ('Instruction',),
157+
'Bahasa Indonesia': ('Petunjuk', 'Instruksi'),
158+
'Chinese': ('说明',),
159+
'French': ('instruction',),
160+
'German': ('Aufgabenanweisung',),
161+
'Italian': ('istruzione',),
162+
'Japanese': ('指示',),
163+
'Nederlands': ('instructie',),
164+
'Spanish': ('instrucción',),
165+
'Thai': ('แนะนำ',),
166+
'Vietnamese': ('hướng dẫn',),
154167
}
155-
return d[explanation_in].lower()
168+
return tuple(
169+
map(
170+
lambda x: x.lower(),
171+
d[explanation_in]
172+
)
173+
)
156174

157175

158176
def test_get_code_instruction(
@@ -175,7 +193,13 @@ def test_get_code_instruction(
175193
homework
176194
)
177195
)
178-
assert instruction in result
196+
197+
assert any(
198+
map(
199+
lambda x: x in result,
200+
instruction
201+
)
202+
), f"Could not find instruction: {instruction} in result: {result}."
179203

180204

181205
def test_get_the_question(
@@ -202,7 +226,13 @@ def test_get_the_question(
202226
)
203227
)
204228
assert msg in result
205-
assert instruction in result
229+
230+
assert any(
231+
map(
232+
lambda x: x in result,
233+
instruction
234+
)
235+
), f"Could not find instruction: {instruction} in result: {result}."
206236

207237

208238
if '__main__' == __name__:

0 commit comments

Comments
 (0)