forked from learningequality/sushi-chef-khan-academy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstants.py
164 lines (146 loc) · 14.3 KB
/
constants.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
from le_utils.constants.languages import getlang
from ricecooker.classes.licenses import CC_BYLicense
from ricecooker.classes.licenses import CC_BY_NCLicense
from ricecooker.classes.licenses import CC_BY_NC_NDLicense
from ricecooker.classes.licenses import CC_BY_NC_SALicense
from ricecooker.classes.licenses import CC_BY_SALicense
from ricecooker.classes.licenses import SpecialPermissionsLicense
# These KA channels are supported on the KA website and topic trees for them are
# availables as TSV exports. The list contains internal le-utils language codes.
SUPPORTED_LANGS = [
'az', 'bg', 'bn', 'cs', 'da', 'de', 'el', 'en', 'es', 'fr', 'gu', 'hi', 'hu',
'hy', 'id', 'it', 'ja', 'ka', 'km', 'kn', 'ko', 'ky', 'lt', 'my', 'nb', 'nl', 'pl',
'pt-BR', # note kalang for Brasilian Portuguese is `pt`
'pt-PT', # note kalang for Brasilian Portuguese is `pt-pt`
'ru', 'sr', 'sv', 'ta', 'tr', 'uz',
'zh-CN', # note kalang for Simplified Chinese is `zh-hans`
]
# These KA channels are not fully supported on the KA website, but content may
# be available as YouTube playlists and via exercise translations from Crowdin.
UNSUPPORTED_LANGS = [
'zul', # note KA kalang is `zu`
'fuv', # note KA kalang is `fv`
'ur',
]
CROWDIN_URL = "https://api.crowdin.com/api/project/khanacademy/download/{lang_code}.zip?login={username}&account-key={account_key}"
COMMON_CORE_SPREADSHEET = "https://storage.googleapis.com/ka_uploads/share/Common_Core_Spreadsheet.csv"
CHANNEL_TITLE_LOOKUP = {
("en", "us-cc"): "Khan Academy (English - US curriculum)",
("en", "in-in"): "Khan Academy (English - CBSE India Curriculum)",
"pt-BR": "Khan Academy (Português - Brasil)",
}
def get_channel_title(lang=None, variant=None):
"""
Return KA channel title for le-utils code `lang` and variant `variant`.
"""
if variant and (lang, variant) in CHANNEL_TITLE_LOOKUP:
return CHANNEL_TITLE_LOOKUP[(lang, variant)]
elif lang in CHANNEL_TITLE_LOOKUP:
return CHANNEL_TITLE_LOOKUP[lang]
else:
lang_obj = getlang(lang)
title = "Khan Academy ({})".format(lang_obj.first_native_name)
return title
CHANNEL_DESCRIPTION_LOOKUP = {
"en": "Khan Academy provides videos and exercises on math, physics, chemistry, biology, and history, aligned to U.S. and India curricular standards. Each topic is covered through intuitive video explanations and provides numerous practice exercises to help students achieve mastery of the subjects. Appropriate for middle and secondary students, as well as adult learners.",
("en", "us-cc"): "Khan Academy provides videos and exercises on math, physics, chemistry, biology, and history, aligned to the U.S. curriculum. Each topic is covered through intuitive video explanations and provides numerous practice exercises to help students achieve mastery of the subjects. Appropriate for middle and secondary students, as well as adult learners.",
("en", "in-in"): "Khan Academy provides videos and exercises on math, physics, chemistry, biology, and history, aligned to the CBSE India curriculum. Each topic is covered through intuitive video explanations and provides numerous practice exercises to help students achieve mastery of the subjects. Appropriate for middle and secondary students, as well as adult learners.",
"fr": "Khan Academy propose des vidéos et des exercices sur les maths, la physique, la chimie, la biologie et l'histoire. Chaque sujet est couvert par des explications vidéo intuitives et comprend de nombreux exercices de pratique pour aider les étudiants à maîtriser les sujets. Convient aux élèves des niveaux primaire et secondaire ainsi qu'aux adultes.",
"fuv": "Nder Kaan Akademi, bee Fulfulde, a taway wideyo e kuuɗe ngam ekkitaago lissaafi. Bee ɗemle feere, a foti jannga kemestiri, fisiks, e bayoloji fuu. Kala ekkitinol fuu e woodi wideyo ngam janngingo pukaraajo, bee kuuɗe ɗuɗɗe ɗe pukaraajo huwata ngam ɗiggingo ko mo ekkiti. Ekkitinki kin nafay fukaraaɓe diga fuɗɗoode janngirde haa janngirde suudu 12 e yeeso. Mawɓe maa njanngay.",
"es": "Khan Academy ofrece videos y ejercicios sobre matemáticas, ciencias, y finanzas para estudiantes de nivel medio y secundario, así para los adultos. También se encuentran los materiales de Khan Academy Perú, los cuales están alineados al Currículo Nacional de Educación Básica, así como materiales preparatorios para la educación superior, y también Khan Academy México, enfocado en matemáticas.",
"pt-BR": "Khan Academy oferece cursos em matemática, física, química, biologia e história. Cada matéria contém vídeos explicativos e exercícios para para a prática e revisão. Próprio para alunos do ensino médio e secundário, bem como para adultos.",
"pt-PT": "Khan Academy oferece cursos em matemática, física, química e biologia. Cada matéria contém vídeos explicativos e exercícios para para a prática e revisão. Próprio para alunos do ensino médio e secundário, bem como para adultos.",
"zh-CN": "可汗学院提供与美国课程一致的视频和习题,涵盖数学、物理、化学、生物和历史。每一个主题都包括了直观的视频解释和大量的练习题目以帮助学生掌握这些学科。这些内容适合初中生、高中生和成年人学习。",
"it": "Khan Academy offre i video e gli esercizi di matematica, allineati al curriculum degli Stati Uniti. Ogni argomento è trattato in modo intuitivo attraverso spiegazioni video, e fornisce numerosi esercizi pratici per aiutare gli studenti raggiungere la competenza sulla materia. Adatto agli studenti di scuola elementare, media e secondaria, nonché agli adulti.",
"bn": "খান একাডেমিতে বাংলাদেশের শিক্ষাক্রম অনুযায়ী গণিতের ভিডিও এবং অনুশীলনী রয়েছে। প্রতিটি অধ্যায়ে বিষয়ভিত্তিক মূল ধারণার ভিডিও এবং অসংখ্য অনুশীলনী রয়েছে যা নিয়মিত চর্চার মাধ্যমে শিক্ষার্থীরা ঐ বিষয়ে দক্ষতা অর্জন করতে পারে। প্রাথমিক ও মাধ্যমিক শিক্ষার্থীদের জন্য উপযোগী, সেইসাথে বয়স্ক শিক্ষার্থীরাও এটি ব্যবহার করতে পারবে।",
"bg": "Khan Academy предоставя видео уроци и упражнения по математика, физика, химия и биология, съобразени с българските учебни стандарти. Темите са представени чрез лесно разбираеми обяснения и многобройни упражнения за самооценка на наученото. Материалите са подходящи както за ученици от началните и стредните класове, така и за студенти.",
"hi": "खान अकादमी गणित वीडियो और अभ्यास प्रदान करता है। प्रत्येक विषय सहज वीडियो और कई अभ्यासों के साथ कवर किया गया है। वे विषयों में निपुण होने में मदद करते हैं।",
"km": "Khan Academy ផ្តល់ជូននូវវីដេអូ និងលំហាត់គណិតវិទ្យាជាច្រើន។ គ្រប់មុខវិជ្ជាទាំងអស់ត្រូវបានផ្សព្វផ្សាយតាមរយៈវីដេអូវិចារណញាណ និងមានលំហាត់ជាច្រើនទៀតដើម្បីជួយឱ្យសិស្សមានគន្លឹះក្នុងការដោះស្រាយលំហាត់កាន់តែងាយស្រួល។",
"gu": "ખાન એકેડેમી ગણિત અને વિજ્ઞાન ના વિડિયો અને સ્વાધ્યાય પ્રદાન કરે છે. દરેક વિષય સાહજિક વિડિયો અને અસંખ્ય સ્વાધ્યાયના સાથે આવરી લેવામાં આવે છે. તેઓ વિષયોને માસ્ટર બનાવવામાં મદદ કરે છે.",
"my": "Khan Academy မှဗွီဒီယိုများနှင့်သင်္ချာဆိုင်ရာလေ့ကျင့်ခန်းများကိုတင်ဆက်သည်။ ဘာသာရပ်တိုင်းကိုထိုးထွင်းသိမြင်နိုင်သောဗီဒီယိုများဖြင့်ဖော်ပြပြီးကျောင်းသားများကိုသဘောတရားများကိုကျွမ်းကျင်အောင်ကူညီရန်လေ့ကျင့်ခန်းများစွာပါ ၀ င်သည်။", # via google transalte
"uk": "Khan Academy пропонує практичні вправи a пояснювальні відео. У нас є матеріали з математики, природничих наук, програмування, історії, історії мистецтв, економіки та багатьох інших предметів.",
}
def get_channel_description(lang=None, variant=None):
"""
Find KA channel description for le-utils code `lang` and variant `variant`.
"""
if variant and (lang, variant) in CHANNEL_DESCRIPTION_LOOKUP:
return CHANNEL_DESCRIPTION_LOOKUP[(lang, variant)]
elif lang in CHANNEL_DESCRIPTION_LOOKUP:
return CHANNEL_DESCRIPTION_LOOKUP[lang]
else:
lang_obj = getlang(lang)
description = "Khan Academy content for {}.".format(lang_obj.name)
return description
# map from le-utils codes to language codes used in the Khan Academy TSV exports
KHAN_ACADEMY_LANGUAGE_MAPPING = {
"pt-BR": 'pt',
"pt-PT": 'pt-pt',
"zh-CN": 'zh-hans',
"fuv": "fv",
"zul": "zu",
}
# Videos with misleading translatedYoutubeLang organized by le-utils lang code.
# Use this list to override the should-be-included logic and include the videos.
# TODO: read the `sourceLanguage` property from the future KA API insead of list
DUBBED_VIDEOS_BY_LANG = {
'pt-BR': [
'UnPpFw3natI', 'LYUmHD__MRg', 'N8qRX_7po9U', 'VjhbocJYyOI', 'awyS59G8uZA',
'DfBjGvdUMVM', '39m4SSfP2Y0', 'rsoMED7zHME', 'fFRvZI0K4wQ', 'mO4senTBFbc',
'uikYPJw0tnE', '50q4iKwnLe8', 'R--9PJ355jY', 'CPhXo-7Qilk', 'TSZ4H5Hd9-M',
'VdIlzUigamE', 'dGZTQxyfwPI', '9HZz32sBAvA', 'pliaCSX-B4I', 'NSZ8oGkfO14',
'5rkJ4Ve_2gc', 'iheXqmtLhts', 'WzHBBfxl6zo', '19G_f9oHIeg', 'Bvq4pfmP03s',
'7sp1--UsVoY', 'eviU0iRKcck', 'v_joLaJ-cfM', 'kfikcE4eJMI', '9_o8Lw9BU_U',
'N0IO9b-xnzc', 'GCTea37THw0', 'FllpnWMCeCw', 'seR3m7RNRRA', 'QM13R2YhyD0',
'P4n36FnlQ18', '5j7QWssTZTM', 'C7Uw4g8GCkU', 'Y3qLdwRY5RY', 'rp1E8idtvJY',
'bDxYr6LWL5A', 'v1RBFkoLD0w', 'L2Z-1EeXAjo', 'x5j19Dd5jWU', 'OLkz5WfQHG4',
'cQT8ZZAbrow', 'XCaw6TxgLoQ', 'Z7nh2e5dVY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c', 'm0tdMIz_UHA', 'Qd2n_vZdXuA', 'Z5GoBku8hUo',
'MyEFnkuxViU', 'eRN2gy-Je18', 'c2-kabi2_ao', 'FS3FSxG_Am0', 'h2NKJK8wjU0',
'KpK5GVXtF8g', 'YhzH8iVMHl0', '1XlW-7WdHfA', '1U6Aqc0U3OM', 'GMLP5jOnqAI',
'tYP_e2IitEA', 'JVOU_sh0qpA', 'z7hVq6OdwOg', 'BTudzgYleUI', 'CYJ5sq8AZFI',
'JeuaB4iryqU', 'H51OAPifRiw', 'TPqE9qP7aHU', 'J2reLNBqoK0', 'HkZ7y05ycEo',
'_1RUYZ8Ic0E', '1l2yttNDYtc', '402Irx3SMRc',
]
}
# To add to this list, look for ERROR message in the logs after a complete chef
# like "Untranslated video {youtube_id} and no subs available. Skipping." and
# add the `{youtube_id}` to the above list if the video is actually transalted.
LICENSE_MAPPING = {
# OLD KEYS
"CC BY": CC_BYLicense(copyright_holder="Khan Academy"),
"CC BY-NC": CC_BY_NCLicense(copyright_holder="Khan Academy"),
"CC BY-NC-ND": CC_BY_NC_NDLicense(copyright_holder="Khan Academy"),
"CC BY-NC-SA (KA default)": CC_BY_NC_SALicense(copyright_holder="Khan Academy"),
"CC BY-SA": CC_BY_SALicense(copyright_holder="Khan Academy"),
"Non-commercial/non-Creative Commons (College Board)": SpecialPermissionsLicense(
copyright_holder="Khan Academy",
description="Non-commercial/non-Creative Commons (College Board)",
),
# "Standard Youtube": licenses.ALL_RIGHTS_RESERVED, # warn and skip these
#
#
#
# NEW KEYS
'cc-by-nc-nd': CC_BY_NC_NDLicense(copyright_holder="Khan Academy"),
'cc-by-nc-sa': CC_BY_NC_SALicense(copyright_holder="Khan Academy"),
'cb-ka-copyright': SpecialPermissionsLicense(
copyright_holder="Khan Academy",
description="Non-commercial/non-Creative Commons (College Board)",
),
# 'yt-standard': licenses.ALL_RIGHTS_RESERVED, # warn and skip these
}