Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove language restrictions in tydiqa + add arabic prompts #763

Merged
merged 22 commits into from Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
208 changes: 207 additions & 1 deletion promptsource/templates.py
Expand Up @@ -235,6 +235,212 @@
"zu": "Zulu",
}

# These are the metrics with which templates can be tagged
METRICS = {
"BLEU",
"ROUGE",
"Squad",
"Trivia QA",
"Accuracy",
"Pearson Correlation",
"Spearman Correlation",
"MultiRC",
"AUC",
"COQA F1",
"Edit Distance",
"Mean Reciprocal Rank",
"Other",
}

# These are the languages with which templates can be tagged. Keys are ISO 639-1
# tags, which are the actual tags we use. Values are English names shown in the
# UI for convenience.
LANGUAGES = {
"ab": "Abkhazian",
"aa": "Afar",
"af": "Afrikaans",
"ak": "Akan",
"sq": "Albanian",
"am": "Amharic",
"ar": "Arabic",
"an": "Aragonese",
"hy": "Armenian",
"as": "Assamese",
"av": "Avaric",
"ae": "Avestan",
"ay": "Aymara",
"az": "Azerbaijani",
"bm": "Bambara",
"ba": "Bashkir",
"eu": "Basque",
"be": "Belarusian",
"bn": "Bengali",
"bi": "Bislama",
"bs": "Bosnian",
"br": "Breton",
"bg": "Bulgarian",
"my": "Burmese",
"ca": "Catalan, Valencian",
"ch": "Chamorro",
"ce": "Chechen",
"ny": "Chichewa, Chewa, Nyanja",
"zh": "Chinese",
"cu": "Church Slavic, Old Slavonic, Church Slavonic, Old Bulgarian, Old Church Slavonic",
"cv": "Chuvash",
"kw": "Cornish",
"co": "Corsican",
"cr": "Cree",
"hr": "Croatian",
"cs": "Czech",
"da": "Danish",
"dv": "Divehi, Dhivehi, Maldivian",
"nl": "Dutch, Flemish",
"dz": "Dzongkha",
"en": "English",
"eo": "Esperanto",
"et": "Estonian",
"ee": "Ewe",
"fo": "Faroese",
"fj": "Fijian",
"fi": "Finnish",
"fr": "French",
"fy": "Western Frisian",
"ff": "Fulah",
"gd": "Gaelic, Scottish Gaelic",
"gl": "Galician",
"lg": "Ganda",
"ka": "Georgian",
"de": "German",
"el": "Greek, Modern (1453–)",
"kl": "Kalaallisut, Greenlandic",
"gn": "Guarani",
"gu": "Gujarati",
"ht": "Haitian, Haitian Creole",
"ha": "Hausa",
"he": "Hebrew",
"hz": "Herero",
"hi": "Hindi",
"ho": "Hiri Motu",
"hu": "Hungarian",
"is": "Icelandic",
"io": "Ido",
"ig": "Igbo",
"id": "Indonesian",
"ia": "Interlingua (International Auxiliary Language Association)",
"ie": "Interlingue, Occidental",
"iu": "Inuktitut",
"ik": "Inupiaq",
"ga": "Irish",
"it": "Italian",
"ja": "Japanese",
"jv": "Javanese",
"kn": "Kannada",
"kr": "Kanuri",
"ks": "Kashmiri",
"kk": "Kazakh",
"km": "Central Khmer",
"ki": "Kikuyu, Gikuyu",
"rw": "Kinyarwanda",
"ky": "Kirghiz, Kyrgyz",
"kv": "Komi",
"kg": "Kongo",
"ko": "Korean",
"kj": "Kuanyama, Kwanyama",
"ku": "Kurdish",
"lo": "Lao",
"la": "Latin",
"lv": "Latvian",
"li": "Limburgan, Limburger, Limburgish",
"ln": "Lingala",
"lt": "Lithuanian",
"lu": "Luba-Katanga",
"lb": "Luxembourgish, Letzeburgesch",
"mk": "Macedonian",
"mg": "Malagasy",
"ms": "Malay",
"ml": "Malayalam",
"mt": "Maltese",
"gv": "Manx",
"mi": "Maori",
"mr": "Marathi",
"mh": "Marshallese",
"mn": "Mongolian",
"na": "Nauru",
"nv": "Navajo, Navaho",
"nd": "North Ndebele",
"nr": "South Ndebele",
"ng": "Ndonga",
"ne": "Nepali",
"no": "Norwegian",
"nb": "Norwegian Bokmål",
"nn": "Norwegian Nynorsk",
"ii": "Sichuan Yi, Nuosu",
"oc": "Occitan",
"oj": "Ojibwa",
"or": "Oriya",
"om": "Oromo",
"os": "Ossetian, Ossetic",
"pi": "Pali",
"ps": "Pashto, Pushto",
"fa": "Persian",
"pl": "Polish",
"pt": "Portuguese",
"pa": "Punjabi, Panjabi",
"qu": "Quechua",
"ro": "Romanian, Moldavian, Moldovan",
"rm": "Romansh",
"rn": "Rundi",
"ru": "Russian",
"se": "Northern Sami",
"sm": "Samoan",
"sg": "Sango",
"sa": "Sanskrit",
"sc": "Sardinian",
"sr": "Serbian",
"sn": "Shona",
"sd": "Sindhi",
"si": "Sinhala, Sinhalese",
"sk": "Slovak",
"sl": "Slovenian",
"so": "Somali",
"st": "Southern Sotho",
"es": "Spanish, Castilian",
"su": "Sundanese",
"sw": "Swahili",
"ss": "Swati",
"sv": "Swedish",
"tl": "Tagalog",
"ty": "Tahitian",
"tg": "Tajik",
"ta": "Tamil",
"tt": "Tatar",
"te": "Telugu",
"th": "Thai",
"bo": "Tibetan",
"ti": "Tigrinya",
"to": "Tonga (Tonga Islands)",
"ts": "Tsonga",
"tn": "Tswana",
"tr": "Turkish",
"tk": "Turkmen",
"tw": "Twi",
"ug": "Uighur, Uyghur",
"uk": "Ukrainian",
"ur": "Urdu",
"uz": "Uzbek",
"ve": "Venda",
"vi": "Vietnamese",
"vo": "Volapük",
"wa": "Walloon",
"cy": "Welsh",
"wo": "Wolof",
"xh": "Xhosa",
"yi": "Yiddish",
"yo": "Yoruba",
"za": "Zhuang, Chuang",
"zu": "Zulu",
}


def highlight(input):
return "<span style='color: #F08080'>" + input + "</span>"
Expand Down Expand Up @@ -617,7 +823,7 @@ def write_to_file(self) -> None:
# We only create the folder if a template is written
if not os.path.exists(self.folder_path):
os.makedirs(self.folder_path)
yaml.dump(self.format_for_dump(), open(self.yaml_path, "w"))
yaml.dump(self.format_for_dump(), open(self.yaml_path, "w"), allow_unicode=True)

def add_template(self, template: "Template") -> None:
"""
Expand Down