Read Ethnologue webpages into usable form.
Authors: Rachel Wicks; updated by Arya D. McCarthy
You can build a new Ethnologue:
import ethnologer
ethnologer.save_model(save_dest, typological_rules_json, ethnologue_globbable)
# for example:
ethnologer.save_model('ETHNOLOGUE', 'typ-rules.json', "ethnologue/*")You can import ethnologer, and then load a saved model:
import ethnologer
from ethnologer import *
ethnologue = ethnologer.load_model(model_path)Then you can get a language:
ethnologue.languages['eng']From the language, you can get the parent family, or the typological features:
eng = ethnologue.languages['eng']
eng.typological_features # {'SVO', 'CAUSATIVES', ... }
eng.parent_family # 'ENGLISH' <-- LanguageFamily ClassYou can also find a language family (provided it is the most senior language family in its family:
ethnologue.families['Indo-European'] # correct!
ethnologue.families['Germanic'] # throws errorYou can find a daughter family, by accessing the daughter family list:
indo_eur = ethnologue.families['Indo-European']
indo_eur.daughter_families # ['Albanian', 'Germanic', ....] <--each is a LanguageFamily
indo_eur.common_typological_features # {'SVO'}