├── LICENSE ├── README.md ├── SECURITY.md ├── dist ├── pyetho-0.0.1-py3-none-any.whl └── pyetho-0.0.1.tar.gz ├── logo.svg ├── pyproject.toml ├── setup.cfg └── src ├── Ethnologue.egg-info ├── PKG-INFO ├── SOURCES.txt ├── dependency_links.txt └── top_level.txt └── etho ├── __init__.py ├── data └── etho.json └── pyetho.py /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 I18nsolutions 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 | ## Pyetho: A library for Python to all the country languages in the world 6 | This is a Language and Country Information Package. In order to know the details of all the languages in the world, **i18n Solutions Salem**, have developed this package based on the interest of integrating the languages of the world to python developers. 7 | 8 | 9 | 10 | > Developers : Bhuvaneshwara Ragavendra.S Roseline Santhiya.M Archana.K.T Vinoth Kumar 11 | 12 | 13 | > Contributors : Varsha A, JayaShree S, Kaviya V, Abinaya V, Janani S, Karthika P, Anandhi P, Hemalatha R, Sri Sakthi Priya T, Nisha Basreen M, Anu R, Megan V, Mogana Priya S 14 | 15 | 16 | 17 | Installation 18 | ============ 19 | ```python 20 | pip install pyetho 21 | ``` 22 | 23 | 24 | Usage 25 | ===== 26 | ```python 27 | from etho import pyetho 28 | ``` 29 | 30 | About 31 | ===== 32 | Pyetho is a Python package that provides information about languages and countries. It offers a range of functionalities to retrieve data such as country names, summaries, official names, language details, populations, language families, and much more. This package follows ISO Standards for Country code and Language code. 33 | 34 | Features 35 | ======== 36 | -> Retrieve details about countries and their attributes such as continent, area, commencement year, and more. 37 | 38 | -> Access language-specific information, including summaries, language codes, populations, and families. 39 | 40 | -> Explore language families and their associated languages across various countries. 41 | 42 | ```python 43 | 1 44 | country_list() 45 | Get a list of all country names in the dataset. 46 | 47 | 2 48 | country_summary(country_name="India") 49 | Get a summary of the specified country. 50 | 51 | 3 52 | country_officialname(country_name="India") 53 | Get the official name of the specified country. 54 | 55 | 4 56 | country_code(country_name="IN") 57 | Get the country code (ISO3166) of the specified country. 58 | 59 | 5 60 | country_area(country_name="India") 61 | Get the area of the specified country. 62 | 63 | 6 64 | country_commencement(country_name="India") 65 | Get the commencement year of the specified country. 66 | 67 | 7 68 | country_continent(country_name="India") 69 | Get the continent of the specified country. 70 | 71 | 8 72 | country_families(country_name) 73 | Get the language families present in the specified country. 74 | 75 | 9 76 | country_vitality(country_name="India") 77 | Get the vitality of languages in the specified country. 78 | 79 | 10 80 | continent_countries(continent="Asia") 81 | Get a list of countries in the specified continent. 82 | 83 | 11 84 | total_countries() 85 | Print the total number of countries in the dataset. 86 | 87 | 12 88 | continent_length(continent="Asia") 89 | Get the total number of countries in the specified continent. 90 | 91 | 13 92 | country_languages(country_name="India") 93 | Get a list of languages spoken in the specified country. 94 | 95 | 14 96 | language_summary( country_name="India", lang="Tamil") 97 | Get the summary of the specified language spoken in the country. 98 | 99 | 15 100 | language_code(country_name="India", lang="Tamil") 101 | Get the language code (ISO639) of the specified language spoken in the country. 102 | 103 | 16 104 | language_population(country_name="India", lang="Tamil") 105 | Get the population estimate of speakers for the specified language in the country. 106 | 107 | 17 108 | language_family(country_name="India", lang="Tamil") 109 | Get the language family to which the specified language belongs in the country. 110 | 111 | 18 112 | lang_to_country(lang="Tamil") 113 | Get the names of countries where a specific language is spoken and its language family. 114 | 115 | 19 116 | languagecode_to_country(code) 117 | Get the names of countries where a specific language code (ISO 639) is associated. 118 | 119 | 20 120 | country_family_languages(country_name,family_name) 121 | Retrieve the languages associated with a specific language family in a given country. 122 | 123 | 21 124 | language_to_family(language_name) 125 | Retrieve the family name associated with a specific language. 126 | 127 | 22 128 | all_families_list() 129 | Retrieve all the family names associated with all the countries. 130 | 131 | 23 132 | total_families() 133 | Retrieve the number of unique family names associated with all the countries. 134 | 135 | 24 136 | family_to_country(family_name) 137 | Retrieve the country names associated with a specific family_name. 138 | 139 | 25 140 | all_family_languages(family) 141 | Retrieve all languages within a specific language family across all countries. 142 | ``` 143 | 144 | REFERENCES: 145 | ========== 146 | https://www.ethnologue.com/ 147 | 148 | https://www.worldometers.info/ 149 | 150 | https://www.worlddata.info/ 151 | 152 | https://www.wikipedia.org/ 153 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Use this section to tell people about which versions of your project are 6 | currently being supported with security updates. 7 | 8 | | Version | Supported | 9 | | ------- | ------------------ | 10 | | 5.1.x | :white_check_mark: | 11 | | 5.0.x | :x: | 12 | | 4.0.x | :white_check_mark: | 13 | | < 4.0 | :x: | 14 | 15 | ## Reporting a Vulnerability 16 | 17 | Use this section to tell people how to report a vulnerability. 18 | 19 | Tell them where to go, how often they can expect to get an update on a 20 | reported vulnerability, what to expect if the vulnerability is accepted or 21 | declined, etc. 22 | -------------------------------------------------------------------------------- /dist/pyetho-0.0.1-py3-none-any.whl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i18nsolutionspy/Pyetho/fb48d1226e55cb417394489e0f3bcad6a71a4031/dist/pyetho-0.0.1-py3-none-any.whl -------------------------------------------------------------------------------- /dist/pyetho-0.0.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i18nsolutionspy/Pyetho/fb48d1226e55cb417394489e0f3bcad6a71a4031/dist/pyetho-0.0.1.tar.gz -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = [ 3 | "setuptools>=42", 4 | "wheel" 5 | ] 6 | build-backend = "setuptools.build_meta" -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [metadata] 2 | name = pyetho 3 | version = 0.0.1 4 | author = SathishKumar paramasivam Et al. 5 | author_email = i18nsolutionspy@gmail.com 6 | description = Exploration of World Languages 7 | long_description = file: README.md 8 | long_description_content_type = text/markdown 9 | url = https://github.com/i18nsolutionspy/Ethnologue 10 | project_urls = 11 | Bug Tracker = https://github.com/i18nsolutionspy/Ethnologue/issues 12 | classifiers = 13 | Programming Language :: Python :: 3 14 | License :: OSI Approved :: MIT License 15 | Operating System :: OS Independent 16 | 17 | [options] 18 | package_dir = 19 | = src 20 | packages = find: 21 | python_requires = >=3.6 22 | 23 | [options.packages.find] 24 | where = src 25 | 26 | [options.package_data] 27 | etho = data/etho.json 28 | 29 | [options.data_files] 30 | data/etho.json = src/etho/data/etho.json -------------------------------------------------------------------------------- /src/Ethnologue.egg-info/PKG-INFO: -------------------------------------------------------------------------------- 1 | Metadata-Version: 2.1 2 | Name: Ethnologue 3 | Version: 0.1.0 4 | Summary: Exploration of World Languages 5 | Home-page: https://github.com/i18nsolutionspy/Ethnologue 6 | Author: SathishKumar paramasivam Et al. 7 | Author-email: i18nsolutionspy@gmail.com 8 | Project-URL: Bug Tracker, https://github.com/i18nsolutionspy/Ethnologue/issues 9 | Classifier: Programming Language :: Python :: 3 10 | Classifier: License :: OSI Approved :: MIT License 11 | Classifier: Operating System :: OS Independent 12 | Requires-Python: >=3.6 13 | Description-Content-Type: text/markdown 14 | 15 |
16 |
17 |
18 | 19 | ## Ethnologue: A library for Python to all the country languages in the world 20 | This is a Language and Country Information Package. In order to know the details of all the languages in the world, **i18n Solutions Salem**, have developed this package based on the interest of integrating the languages of the world to python developers. 21 | 22 | 23 | 24 | > Developers : Bhuvaneshwara Ragavendra.S Roseline Santhiya.M Archana.K.T Vinoth Kumar 25 | 26 | 27 | > Contributors : Varsha A, JayaShree S, Kaviya V, Abinaya V, Janani S, Karthika P, Anandhi P, Hemalatha R, Sri Sakthi Priya T, Nisha Basreen M, Anu R, Megan V, Mogana Priya S 28 | 29 | 30 | 31 | Installation 32 | ============ 33 | ```python 34 | pip install ethnologue 35 | ``` 36 | 37 | 38 | Usage 39 | ===== 40 | ```python 41 | from ethnologue import Ethnologue 42 | ``` 43 | Example: Get a list of all country families 44 | country_families = country_families('Australia') 45 | 46 | Example: Get a summary of a specific country 47 | country_summary = country_summary('China') 48 | 49 | About 50 | ===== 51 | Ethnologue is a Python package that provides information about languages and countries. It offers a range of functionalities to retrieve data such as country names, summaries, official names, language details, populations, language families, and much more. 52 | 53 | Features 54 | ======== 55 | -> Retrieve details about countries and their attributes such as continent, area, commencement year, and more. 56 | 57 | -> Access language-specific information, including summaries, language codes, populations, and families. 58 | 59 | -> Explore language families and their associated languages across various countries. 60 | 61 | ```python 62 | 1 63 | country_list() 64 | Get a list of all country names in the dataset. 65 | 66 | 2 67 | country_summary(country_name="India") 68 | Get a summary of the specified country. 69 | 70 | 3 71 | country_officialname(country_name="India") 72 | Get the official name of the specified country. 73 | 74 | 4 75 | country_code(country_name="IN") 76 | Get the country code (ISO3166) of the specified country. 77 | 78 | 5 79 | country_area(country_name="India") 80 | Get the area of the specified country. 81 | 82 | 6 83 | country_commencement(country_name="India") 84 | Get the commencement year of the specified country. 85 | 86 | 7 87 | country_continent(country_name="India") 88 | Get the continent of the specified country. 89 | 90 | 8 91 | country_families(country_name) 92 | Get the language families present in the specified country. 93 | 94 | 9 95 | country_vitality(country_name="India") 96 | Get the vitality of languages in the specified country. 97 | 98 | 10 99 | continent_countries(continent="Asia") 100 | Get a list of countries in the specified continent. 101 | 102 | 11 103 | total_countries() 104 | Print the total number of countries in the dataset. 105 | 106 | 12 107 | continent_length(continent="Asia") 108 | Get the total number of countries in the specified continent. 109 | 110 | 13 111 | country_languages(country_name="India") 112 | Get a list of languages spoken in the specified country. 113 | 114 | 14 115 | language_summary( country_name="India", lang="Tamil") 116 | Get the summary of the specified language spoken in the country. 117 | 118 | 15 119 | language_code(country_name="India", lang="Tamil" 120 | Get the language code (ISO639) of the specified language spoken in the country. 121 | 122 | 16 123 | language_population(country_name="India", lang="Tamil") 124 | Get the population estimate of speakers for the specified language in the country. 125 | 126 | 17 127 | language_family(country_name="India", lang="Tamil") 128 | Get the language family to which the specified language belongs in the country. 129 | 130 | 18 131 | lang_to_country(lang="Tamil") 132 | Get the names of countries where a specific language is spoken and its language family. 133 | 134 | 19 135 | languagecode_to_country(code) 136 | Get the names of countries where a specific language code (ISO 639) is associated. 137 | 138 | 20 139 | country_family_languages(country_name,family_name) 140 | Retrieve the languages associated with a specific language family in a given country. 141 | 142 | 21 143 | language_to_family(language_name) 144 | Retrieve the family name associated with a specific language. 145 | 146 | 21 147 | all_families_list() 148 | Retrieve all the family names associated with all the countries. 149 | 150 | 22 151 | total_families() 152 | Retrieve the number of unique family names associated with all the countries. 153 | 154 | 23 155 | family_to_country(family_name) 156 | Retrieve the country names associated with a specific family_name. 157 | 158 | 24 159 | all_family_languages(family) 160 | Retrieve all languages within a specific language family across all countries. 161 | ``` 162 | 163 | REFERENCES: 164 | ========== 165 | https://www.com/ 166 | 167 | https://www.worldometers.info/ 168 | 169 | https://www.worlddata.info/ 170 | -------------------------------------------------------------------------------- /src/Ethnologue.egg-info/SOURCES.txt: -------------------------------------------------------------------------------- 1 | README.md 2 | pyproject.toml 3 | setup.cfg 4 | src/Ethnologue.egg-info/PKG-INFO 5 | src/Ethnologue.egg-info/SOURCES.txt 6 | src/Ethnologue.egg-info/dependency_links.txt 7 | src/Ethnologue.egg-info/top_level.txt 8 | src/etho/__init__.py 9 | src/etho/pyetho.py 10 | src/etho/data/etho.json -------------------------------------------------------------------------------- /src/Ethnologue.egg-info/dependency_links.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/Ethnologue.egg-info/top_level.txt: -------------------------------------------------------------------------------- 1 | etho 2 | -------------------------------------------------------------------------------- /src/etho/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/i18nsolutionspy/Pyetho/fb48d1226e55cb417394489e0f3bcad6a71a4031/src/etho/__init__.py -------------------------------------------------------------------------------- /src/etho/pyetho.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | 4 | module_path = os.path.dirname(__file__) 5 | data = json.load(open(os.path.join(module_path, "data", "etho.json"), "r", encoding="utf-8")) 6 | #@staticmethod 7 | def country_list(): 8 | """ 9 | Get a list of all country names in the dataset. 10 | 11 | Returns: 12 | list: A list of country names. 13 | 14 | Examples 15 | -------- 16 | >>> pyetho.country_list() 17 | ['Afghanistan', 18 | 'Albania', 19 | 'Algeria', 20 | 'Andorra', 21 | 'Angola', 22 | 'Antigua_and_Barbuda', 23 | 'Argentina', 24 | 'Armenia', 25 | 'Australia', 26 | 'Austria', 27 | 'Azerbaijan', 28 | 'Bahamas', 29 | 'Bahrain', 30 | 'Bangladesh', 31 | 'Barbados', 32 | etc'] 33 | """ 34 | a=[] 35 | for i in data.keys(): 36 | a.append(i) 37 | return(a) 38 | 39 | def country_summary(country_name="India"): 40 | """ 41 | Get a summary of the specified country. 42 | 43 | Parameters: 44 | country_name : str, optional 45 | The name of the country will be given to retrieve the summary. Default choice is "India". 46 | 47 | Returns: 48 | str: A summary of the specified country will be returned in a string format. 49 | 50 | Examples 51 | -------- 52 | >>> pyetho.country_summary('Sri_Lanka') 53 | 'Sri Lanka is a country in Asia that is home to 22,156,000 people. It is also home to 5 living indigenous languages. Two of these, Sinhala and Tamil, are the official languages of the country. In addition, 2 living non-indigenous languages are established within the country. In formal education, 2 indigenous languages are used as languages of instruction.' 54 | 55 | >>> pyetho.country_summary('China') 56 | 'China is a country in Asia that is home to 1,412,600,000 people. It is also home to 281 living indigenous languages. One of these, Mandarin Chinese, is the official language of the country. Others—Central Tibetan, Kyrgyz, and Uyghur—are official languages in parts of the country. China was also home to 2 indigenous languages that are now extinct. In addition, 25 living non-indigenous languages are established within the country. In formal education, 7 indigenous languages are used as languages of instruction.' 57 | 58 | """ 59 | return(data[country_name]['summary']) 60 | 61 | def country_officialname(country_name="India"): 62 | """ 63 | Get the official name of the specified country. 64 | 65 | Parameters: 66 | country_name : str, optional 67 | The name of the country will be given to retrieve the official name. Default choice is "India". 68 | 69 | Returns: 70 | str: The official name of the specified country will be returned in a string format. 71 | 72 | Examples 73 | -------- 74 | >>> pyetho.country_officialname('Thailand') 75 | 'Kingdom of Thailand' 76 | 77 | >>> pyetho.country_officialname('Algeria') 78 | 'Democratic and Popular Republic of Algeria' 79 | 80 | """ 81 | return(data[country_name]['official_name']) 82 | 83 | def country_code(country_name="IN"): 84 | """ 85 | Get the country code (ISO3166) of the specified country. 86 | 87 | Parameters: 88 | country_name : str, optional 89 | The name of the country will be given to retrieve the country code. Default choice is "IN". 90 | 91 | Returns: 92 | str: The country code (ISO3166) of the specified country will be returned in a string format. 93 | 94 | Examples: 95 | -------- 96 | >>> pyetho.country_code("Algeria") 97 | DZ 98 | 99 | >>> pyetho.country_code("Japan") 100 | JP 101 | """ 102 | return(data[country_name]['country_code(ISO3166)']) 103 | 104 | def country_area(country_name="India"): 105 | """ 106 | Get the area of the specified country. 107 | 108 | Parameters: 109 | country_name : str, optional 110 | The name of the country will be given to retrieve the area. Default choice is "India". 111 | 112 | Returns: 113 | str: The area of the specified country will be returned in string format as 'square kilometers'. 114 | 115 | Examples: 116 | -------- 117 | >>> pyetho.country_area("Bangladesh") 118 | '130170 Square Kilometer' 119 | 120 | >>> pyetho.country_area("Argentina") 121 | '2736690 Square Kilometer' 122 | """ 123 | return(str(data[country_name]['area(sq_km)'])+" Square Kilometer") 124 | 125 | def country_commencement(country_name="India"): 126 | """ 127 | Get the commencement year of the specified country. 128 | 129 | Parameters: 130 | country_name : str, optional 131 | The name of the country will be given to retrieve the commencement year. Default choice is "India". 132 | 133 | Returns: 134 | int: The commencement year of the specified country will be returned in integer format. 135 | 136 | Examples: 137 | -------- 138 | >>> pyetho.country_commencement('Pakistan') 139 | 1947 140 | 141 | >>> pyetho.country_commencement('Japan') 142 | 1956 143 | 144 | >>> pyetho.country_commencement('Mexico') 145 | 1945 146 | """ 147 | return(data[country_name]['commencement']) 148 | 149 | def country_continent(country_name="India"): 150 | """ 151 | Get the continent of the specified country. 152 | 153 | Parameters: 154 | country_name : str, optional 155 | The name of the country will be given to retrieve the continent. Default choice is "India". 156 | 157 | Returns: 158 | str: The continent of the specified country will be returned in a string format. 159 | 160 | Examples: 161 | -------- 162 | >>> pyetho.country_continent('Sri_Lanka') 163 | 'Asia' 164 | 165 | >>> pyetho.country_continent('New_Zealand') 166 | 'Australia' 167 | 168 | """ 169 | return(data[country_name]['continent']) 170 | 171 | def country_families(country_name="India"): 172 | """ 173 | Get the language families present in the specified country. 174 | 175 | Parameters: 176 | country_name : str, optional 177 | The name of the country will be given to retrieve the language families. Default choice is "India". 178 | 179 | Returns: 180 | dict: The language families present in the specified country will be returned in a dict format. 181 | 182 | Examples: 183 | -------- 184 | >>> pyetho.country_families('China') 185 | dict_keys(['Sino-Tibetan', 'Kra-Dai', 'Hmong-Mien', 'Austro-Asiatic', 'Mongolic', 'Turkic', 'Tungusic', 'Mixed language', 'Sign language', 'Austronesian', 'Indo-European', 'Unclassified']) 186 | 187 | >>> pyetho.country_families('Thailand') 188 | dict_keys(['Austro-Asiatic', 'Kra-Dai', 'Sino-Tibetan', 'Austronesian', 'Sign language', 'Hmong-Mien']) 189 | """ 190 | 191 | return(data[country_name]['families'].keys()) 192 | 193 | def country_vitality(country_name="India"): 194 | """ 195 | Get the vitality of languages in the specified country. 196 | 197 | Parameters: 198 | country_name : str, optional 199 | The name of the country will be given to retrieve the language vitality. Default choice is "India". 200 | 201 | Returns: 202 | list: The vitality of languages in the specified country will be returned as a list format. 203 | 204 | Examples: 205 | -------- 206 | >>> pyetho.country_vitality("Mexico") 207 | ['Institutional', '0', 'Stable', '155', 'Endangered', '129', 'Extinct', '13'] 208 | 209 | >>> pyetho.country_vitality("Switzerland") 210 | ['Institutional', '3', 'Stable', '5', 'Endangered', '2', 'Extinct', '0'] 211 | 212 | >>> pyetho.country_vitality("Thailand") 213 | ['Institutional', '3', 'Stable', '25', 'Endangered', '23', 'Extinct', '0'] 214 | 215 | """ 216 | return(data[country_name]['vitality']) 217 | 218 | def continent_countries(continent="Asia"): 219 | """ 220 | Get a list of countries in the specified continent. 221 | 222 | Parameters: 223 | continent_name : str, optional 224 | The name of the continent will be given to retrieve the list of countries. Default choice is "Asia". 225 | 226 | Returns: 227 | list: A list of country names in the specified continent will be returned in list format. 228 | 229 | Examples: 230 | -------- 231 | >>> pyetho.continent_countries('Australia') 232 | 233 | ['Australia', 234 | 'Fiji', 235 | 'Kiribati', 236 | 'Marshall_Islands', 237 | 'Micronesia', 238 | 'Nauru', 239 | 'Netherlands', 240 | 'New_Zealand', 241 | 'Palau', 242 | 'Papua_New_Guinea', 243 | 'Samoa', 244 | 'Solomon_Islands', 245 | 'Tonga', 246 | 'Tuvalu', 247 | 'Vanuatu'] 248 | 249 | >>> pyetho.continent_countries('Africa') 250 | 251 | ['Algeria', 252 | 'Angola', 253 | 'Benin', 254 | 'Botswana', 255 | 'Burkina_Faso', 256 | 'Burundi', 257 | 'Côte_dIvoire', 258 | 'Cape_Verde_Islands', 259 | 'Cameroon', 260 | 'Central_African_Republic', 261 | 'Chad', 262 | 'Comoros', 263 | 'Congo', 264 | 'Democratic_Repulic_of_the_Congo', 265 | 'Djibouti', 266 | 'Egypt', 267 | 'Equatorial_Guinea', 268 | 'Eritrea', 269 | 'Eswatini', 270 | 'Ethiopia', 271 | 'Gabon', 272 | 'Gambia', 273 | 'Ghana', 274 | 'Guinea', 275 | 'Guinea-Bissau', 276 | 'Kenya', 277 | 'Lesotho', 278 | 'Liberia', 279 | 'Libya', 280 | 'Madagascar', 281 | 'Malawi', 282 | 'Mali', 283 | 'Mauritania', 284 | 'Mauritius', 285 | 'Morocco', 286 | 'Mozambique', 287 | 'Namibia', 288 | 'Niger', 289 | 'Nigeria', 290 | 'Rwanda', 291 | 'São_Tomé e_Príncipe', 292 | 'Senegal', 293 | 'Seychelles', 294 | 'Sierra_Leone', 295 | 'Somalia', 296 | 'South_Africa', 297 | 'South_Sudan', 298 | 'Sudan', 299 | 'Tanzania', 300 | 'Togo', 301 | 'Tunisia', 302 | 'Zambia', 303 | 'Zimbabwe'] 304 | """ 305 | conti=[] 306 | for i in data.keys(): 307 | if(data[i]['continent'] == continent): 308 | conti.append(i) 309 | return(conti) 310 | 311 | def total_countries(): 312 | """ 313 | Print the total number of countries in the dataset. 314 | 315 | Examples: 316 | -------- 317 | >>> pyetho.total_countries() 318 | 195 319 | 320 | """ 321 | print(len(data.keys())) 322 | 323 | def continent_length(continent="Asia"): 324 | """ 325 | Get the total number of countries in the specified continent. 326 | 327 | Parameters: 328 | continent_name : str, optional 329 | The name of the continent will be given to retrieve the number of countries. Default choice is "Asia". 330 | 331 | Returns: 332 | int: The total number of countries in the specified continent will be returned in integer format. 333 | 334 | Examples: 335 | -------- 336 | >>> pyetho.continent_length("Africa") 337 | 53 338 | 339 | >>> pyetho.continent_length("Australia") 340 | 15 341 | 342 | """ 343 | conti=[] 344 | for i in data.keys(): 345 | if(data[i]['continent'] == continent): 346 | conti.append(i) 347 | return(len(conti)) 348 | 349 | def country_languages(country_name="India"): 350 | """ 351 | Get a list of languages spoken in the specified country. 352 | 353 | Parameters: 354 | country_name : str, mandatory 355 | The name of the country will be given to retrieve the list of languages. 356 | 357 | Returns: 358 | list: A list of languages spoken in the specified country will be returned in a list format. 359 | 360 | Examples: 361 | -------- 362 | >>> pyetho.country_languages('Namibia') 363 | 364 | ['!Xóõ', 365 | 'Fwe', 366 | 'Gciriku', 367 | 'Hai|ǁom', 368 | 'Herero', 369 | 'Ju hoansi', 370 | 'Khoekhoe', 371 | 'Khwedam', 372 | 'Kuhane', 373 | 'Kung-Ekoka', 374 | 'Kwambi', 375 | 'Kwangali', 376 | 'Kwanyama', 377 | 'Mbalanhu', 378 | 'Mbukushu', 379 | 'Namibian_Sign_Language', 380 | 'Naro', 381 | 'Ndonga', 382 | 'Ngandjera', 383 | 'Northwestern_!Kung', 384 | 'Setswana', 385 | 'Yeyi', 386 | 'Zemba'] 387 | 388 | >>> pyetho.country_languages('Japan') 389 | 390 | ['Ainu', 391 | 'Amami_Koniya_Sign_Language', 392 | 'Central_Okinawan', 393 | 'Japanese', 394 | 'Japanese_Sign_Language', 395 | 'Kikai', 396 | 'Kunigami', 397 | 'Miyako', 398 | 'Miyakubo_Sign_Language', 399 | 'Northern_Amami-Oshima', 400 | 'Oki-No-Erabu', 401 | 'Southern_Amami-Oshima', 402 | 'Toku-No-Shima', 403 | 'Yaeyama', 404 | 'Yonaguni', 405 | 'Yoron'] 406 | """ 407 | 408 | x = [] 409 | for i in data[country_name]['languages']: 410 | x.append(i) 411 | return x 412 | 413 | def language_summary( country_name="India", lang="Tamil"): 414 | """ 415 | Get the summary of the specified language spoken in the country. 416 | 417 | Parameters: 418 | country_name : str, mandatory 419 | The name of the country will be given to retrive the specified country's language. 420 | 421 | lang : str, mandatory 422 | The name of the language will be given to retrieve the specified language's summary. 423 | 424 | Returns: 425 | str: A summary of the specified language spoken in the country will be returned in a string format. 426 | 427 | Examples: 428 | -------- 429 | >>> pyetho.language_summary('India','Tamil') 430 | 'Tamil is an official language in the parts of India where it is spoken. It belongs to the Dravidian language family. Direct evidence is lacking, but the language is thought to be used as a first language by all in the ethnic community. It is used as a language of instruction in education.' 431 | 432 | >>> pyetho.language_summary('Namibia','Fwe') 433 | 'Fwe is a stable indigenous language of Namibia and Zambia. It belongs to the Niger-Congo language family. The language is used as a first language by all in the ethnic community. It is not known to be taught in schools.' 434 | """ 435 | return (data[country_name]['languages'][lang]['summary']) 436 | 437 | def language_code(country_name="India", lang="Tamil"): 438 | """ 439 | Get the language code (ISO639) of the specified language spoken in the country. 440 | 441 | Parameters: 442 | country_name : str, mandatory 443 | The name of the country will be given to retrive the specified country's language. 444 | 445 | lang : str, mandatory 446 | The name of the language will be given to retrieve the specified language's code. 447 | 448 | Returns: 449 | str: The language code (ISO639) of the specified language spoken in the country will be returned in a string format. 450 | 451 | Examples: 452 | -------- 453 | >>> pyetho.language_code('India','Tamil') 454 | 'tam' 455 | 456 | >>> pyetho.language_code('Argentina','Lule') 457 | 'ule' 458 | """ 459 | return (data[country_name]['languages'][lang]['language_code(ISO639)']) 460 | 461 | def language_population(country_name="India", lang="Tamil"): 462 | """ 463 | Get the population estimate of speakers for the specified language in the country. 464 | 465 | Parameters: 466 | country_name : str, mandatory 467 | The name of the country will be given to retrive the specified country's language. 468 | 469 | lang : str, mandatory 470 | The name of the language will be given to retrieve the specified language's population. 471 | 472 | Returns: 473 | str: The population estimate of speakers for the specified language in the country will be returned in a string format. 474 | 475 | Examples: 476 | -------- 477 | >>> pyetho.language_population('India','Tamil') 478 | '1M to 1B' 479 | 480 | >>> pyetho.language_population('Mexico','Yaqui') 481 | '10K to 1M' 482 | """ 483 | return (data[country_name]['languages'][lang]['population']) 484 | 485 | def language_family(country_name="India", lang="Tamil"): 486 | """ 487 | Get the language family to which the specified language belongs in the country. 488 | 489 | Parameters: 490 | country_name : str, mandatory 491 | The name of the country will be given to retrive the specified country's language. 492 | 493 | lang : str, mandatory 494 | The name of the language will be given to retrieve the specified language's family. 495 | 496 | Returns: 497 | str: The language family to which the specified language belongs in the country will be returned in a string format. 498 | 499 | Examples: 500 | -------- 501 | >>> pyetho.language_family('India','Tamil') 502 | 'It belongs to the Dravidian language family.' 503 | 504 | >>> pyetho.language_family('China','Zhaba') 505 | 'It belongs to the Sino-Tibetan language family.' 506 | 507 | >>> pyetho.language_family('Mexico','Yaqui') 508 | 'It belongs to the Uto-Aztecan language family.' 509 | """ 510 | return (data[country_name]['languages'][lang]['family']) 511 | 512 | def lang_to_country(lang="Tamil"): 513 | 514 | """ 515 | Get the names of countries where a specific language is spoken and its language family. 516 | 517 | Parameters: 518 | lang : str, optional 519 | The name of the language for which you want to find countries. Default is "Tamil". 520 | 521 | Returns: 522 | list: A list of country names where the specified language is spoken. 523 | 524 | Examples: 525 | -------- 526 | >>> pyetho.lang_to_country('Tamil') 527 | India 528 | Sri_Lanka 529 | 530 | >>> pyetho.lang_to_country('Spanish') 531 | Andorra 532 | Spain 533 | """ 534 | 535 | for i in data.keys(): 536 | a=[] 537 | for j in data[i]['languages'].keys(): 538 | a.append(j) 539 | for k in a: 540 | l=str(lang).capitalize() 541 | if(l == k): 542 | print(i) 543 | break 544 | def languagecode_to_country(code): 545 | """ 546 | Get the names of countries where a specific language code (ISO 639) is associated. 547 | 548 | Parameters: 549 | code : str, mandatory 550 | The ISO 639 language code for which you want to find countries. 551 | 552 | Returns: 553 | list: A list of country names where the specified language_code is associated. 554 | 555 | Examples: 556 | -------- 557 | >>> pyetho.languagecode_to_country('eng') 558 | Ireland 559 | United_Kingdom 560 | 561 | >>> pyetho.languagecode_to_country('spa') 562 | Andorra 563 | Spain 564 | """ 565 | for i in data.keys(): 566 | for j in data[i]["languages"]: 567 | a=[] 568 | a.append(data[i]["languages"][j]["language_code(ISO639)"]) 569 | for k in a: 570 | if (code == k): 571 | print(i) 572 | 573 | def country_family_languages(country_name="India",family_name="Dravidian"): 574 | """ 575 | Retrieve the languages associated with a specific language family in a given country. 576 | 577 | Parameters: 578 | country_name : str, mandatory 579 | The name of the country to search for the specified family. 580 | family_name : str, mandatory 581 | The name of the language family to get the list of languages inside that specific family. 582 | 583 | 584 | Returns: 585 | - list : A list of languages and its language code associated with the provided 'country_name' in the specified 'family_name'. 586 | 587 | Examples: 588 | -------- 589 | >>> pyetho.country_family_languages('Japan','Japonic') 590 | ["Japanese 'Language Code':jpn", 591 | "Amami-Oshima, Southern 'Language Code':ams", 592 | "Kikai 'Language Code':kzg", 593 | "Amami-Oshima, Northern 'Language Code':ryn", 594 | "Toku-No-Shima 'Language Code':tkn", 595 | "Oki-No-Erabu 'Language Code':okn", 596 | "Okinawan, Central 'Language Code':ryu", 597 | "Kunigami 'Language Code':xug", 598 | "Yoron 'Language Code':yox", 599 | "Miyako 'Language Code':mvi", 600 | "Yaeyama 'Language Code':rys", 601 | "Yonaguni 'Language Code':yoi"] 602 | 603 | >>> pyetho.country_family_languages('India','Dravidian') 604 | ["Kolami, Northwestern 'Language Code':kfb", 605 | "Kolami, Southeastern 'Language Code':nit", 606 | "Gadaba, Mudhili 'Language Code':gau", 607 | "Gadaba, Pottangi Ollar 'Language Code':gdb", 608 | "Duruwa 'Language Code':pci", 609 | "Kumarbhag Paharia 'Language Code':kmj", 610 | "Kurux 'Language Code':kru", 611 | "Sauria Paharia 'Language Code':mjt", 612 | "Kisan 'Language Code':xis", 613 | "Maria, Dandami 'Language Code':daq", 614 | "Muria, Eastern 'Language Code':emu", 615 | "Gondi, Aheri 'Language Code':esg", 616 | "Muria, Far Western 'Language Code':fmu", 617 | "Gondi, Northern 'Language Code':gno", 618 | "Khirwar 'Language Code':kwx", 619 | "Maria 'Language Code':mrr", 620 | "Muria, Western 'Language Code':mut", 621 | "Nagarchal 'Language Code':nbg", 622 | "Pardhan 'Language Code':pch", 623 | "Gondi, Adilabad 'Language Code':wsg", 624 | "Konda-Dora 'Language Code':kfc", 625 | "Mukha-Dora 'Language Code':mmk", 626 | "Kui, Dawik 'Language Code':dwk", 627 | "Koya 'Language Code':kff", 628 | "Kuvi 'Language Code':kxv", 629 | "Kui 'Language Code':uki", 630 | "Manda 'Language Code':mha", 631 | "Pengo 'Language Code':peg", 632 | "Chenchu 'Language Code':cde", 633 | "Manna-Dora 'Language Code':mju", 634 | "Telugu 'Language Code':tel", 635 | "Waddar 'Language Code':wbq", 636 | "Kurichiya 'Language Code':kfh", 637 | "Kurumba, Attapady 'Language Code':pkr", 638 | "Pathiya 'Language Code':pty", 639 | "Muduga 'Language Code':udg", 640 | "Kumbaran 'Language Code':wkb", 641 | "Kalanadi 'Language Code':wkl", 642 | "Kunduvadi 'Language Code':wku", 643 | "Badaga 'Language Code':bfq", 644 | "Holiya 'Language Code':hoy", 645 | "Kannada 'Language Code':kan", 646 | "Urali 'Language Code':url", 647 | "Kodava 'Language Code':kfa", 648 | "Kurumba, Kannada 'Language Code':kfi", 649 | "Kurumba, Mullu 'Language Code':kpb", 650 | "Kurumba, Alu 'Language Code':xua", 651 | "Kurumba, Jennu 'Language Code':xuj", 652 | "Mannan 'Language Code':mjv", 653 | "Aranadan 'Language Code':aaf", 654 | "Kadar 'Language Code':kej", 655 | "Malayalam 'Language Code':mal", 656 | "Malapandaram 'Language Code':mjp", 657 | "Malaryan 'Language Code':mjq", 658 | "Malavedan 'Language Code':mjr", 659 | "Paliyan 'Language Code':pcf", 660 | "Paniya 'Language Code':pcg", 661 | "Ravula 'Language Code':yea", 662 | "Eravallan 'Language Code':era", 663 | "Irula 'Language Code':iru", 664 | "Kaikadi 'Language Code':kep", 665 | "Kanikkaran 'Language Code':kev", 666 | "Muthuvan 'Language Code':muv", 667 | "Sholaga 'Language Code':sle", 668 | "Tamil 'Language Code':tam", 669 | "Kurumba, Betta 'Language Code':xub", 670 | "Yerukula 'Language Code':yeu", 671 | "Kota 'Language Code':kfe", 672 | "Toda 'Language Code':tcx", 673 | "Chetti, Wayanad 'Language Code':ctt", 674 | "Bellari 'Language Code':brw", 675 | "Kudiya 'Language Code':kfg", 676 | "Tulu 'Language Code':tcy", 677 | "Koraga, Korra 'Language Code':kfd", 678 | "Koraga, Mudu 'Language Code':vmd", 679 | "Mala Malasar 'Language Code':ima", 680 | "Thachanadan 'Language Code':thn", 681 | "Ullatan 'Language Code':ull", 682 | "Malasar 'Language Code':ymr", 683 | "Allar 'Language Code':all", 684 | "Bharia 'Language Code':bha", 685 | "Malankuravan 'Language Code':mjo", 686 | "Pattapu 'Language Code':ptq", 687 | "Vishavan 'Language Code':vis"] 688 | 689 | """ 690 | 691 | b = [] 692 | for i in data[country_name]['families'][family_name]: 693 | modified_string = i[:-4] + " 'Language Code':" + i[-3:] 694 | b.append(modified_string) 695 | 696 | return b 697 | 698 | def language_to_family(language_name="Tamil"): 699 | """ 700 | Retrieve the family name associated with a specific language. 701 | 702 | Parameters: 703 | language_name : str, mandatory 704 | The name of the language given to search for the specified family. 705 | 706 | Returns: 707 | - str : The family name associated with the provided 'language_name'. 708 | 709 | Examples: 710 | -------- 711 | >>> pyetho.language_to_family('Tamil') 712 | 'Dravidian' 713 | 714 | >>> pyetho.language_to_family('Japanese') 715 | 'Japonic' 716 | 717 | >>> pyetho.language_to_family('English') 718 | 'Creole' 719 | 720 | """ 721 | a=[] 722 | for i in data.keys(): 723 | for j,k in data[i]["families"].items(): 724 | a.append(k) 725 | for l in range(len(a)): 726 | for m in range(len(a[l])): 727 | if language_name in (a[l][m][:-4:]): 728 | return j 729 | 730 | def all_families_list(): 731 | """ 732 | Retrieve all the family names associated with all the countries. 733 | 734 | Returns: 735 | - list : A list of all families associated with all the countries. 736 | 737 | Examples: 738 | -------- 739 | >>> pyetho.all_families_list() 740 | ['Eskimo-Aleut', 'Comecrudan', 'Nimboran', 'Yukian', 'Sepik', 'Uralic', 741 | 'South-Central Papuan', 'Katukinan', 'Aymaran', 'Coosan', etc.,] 742 | 743 | """ 744 | a=[] 745 | for i in data.keys(): 746 | for j in data[i]['families'].keys(): 747 | a.append(j) 748 | unique_list = list(set(a)) 749 | print (unique_list) 750 | 751 | def total_families(): 752 | """ 753 | Retrieve the number of unique family names associated with all the countries. 754 | 755 | Returns: 756 | - int : The number of unique family names associated with all the countries. 757 | 758 | Examples: 759 | -------- 760 | >>> pyetho.total_families() 761 | 153 762 | 763 | """ 764 | a=[] 765 | for i in data.keys(): 766 | for j in data[i]['families'].keys(): 767 | a.append(j) 768 | unique_list = list(set(a)) 769 | print (len(unique_list)) 770 | 771 | def family_to_country(family_name="Dravidian"): 772 | """ 773 | Retrieve the country names associated with a specific family_name. 774 | 775 | Parameters: 776 | family_name : str, mandatory 777 | The name of the family to search for the associated countries. 778 | 779 | Returns: 780 | - list or str : A list of country names associated with the provided 'family_name'. 781 | 782 | Examples: 783 | -------- 784 | >>> pyetho.family_to_country('Dravidian') 785 | Afghanistan 786 | Bangladesh 787 | India 788 | Nepal 789 | Pakistan 790 | Sri_Lanka 791 | 792 | >>> pyetho.family_to_country('Japonic') 793 | Japan 794 | """ 795 | for i in data.keys(): 796 | a=[] 797 | for j in data[i]['families'].keys(): 798 | a.append(j) 799 | for k in a: 800 | l=str(family_name).capitalize() 801 | if(l in k): 802 | print(i) 803 | break 804 | 805 | def all_family_languages(family): 806 | """ 807 | Retrieve all languages within a specific language family across all countries. 808 | 809 | Parameters: 810 | family : str 811 | The name of the language family to retrieve languages from the family name. 812 | 813 | Returns: 814 | list : A list of languages within the specified 'family' across all countries. 815 | 816 | >>> pyetho.family_to_country('Japonic') 817 | [['Japanese jpn', 818 | 'Amami-Oshima, Southern ams', 819 | 'Kikai kzg', 820 | 'Amami-Oshima, Northern ryn', 821 | 'Toku-No-Shima tkn', 822 | 'Oki-No-Erabu okn', 823 | 'Okinawan, Central ryu', 824 | 'Kunigami xug', 825 | 'Yoron yox', 826 | 'Miyako mvi', 827 | 'Yaeyama rys', 828 | 'Yonaguni yoi']] 829 | 830 | >>> pyetho.family_to_country(') 831 | [[], 832 | [], 833 | ['Kolami, Northwestern kfb', 834 | 'Kolami, Southeastern nit', 835 | 'Gadaba, Mudhili gau', 836 | 'Gadaba, Pottangi Ollar gdb', 837 | 'Duruwa pci', 838 | 'Kumarbhag Paharia kmj', 839 | 'Kurux kru', 840 | 'Sauria Paharia mjt', 841 | 'Kisan xis', 842 | 'Maria, Dandami daq', 843 | 'Muria, Eastern emu', 844 | etc.,] 845 | 846 | """ 847 | result = [] 848 | for i in data.keys(): 849 | if family in data[i]['families']: 850 | result.append(data[i]['families'][family]) 851 | return result 852 | def language_code_to_language(code="tam"): 853 | """ 854 | Get the name of the language with the specified language code (ISO639). 855 | Parameters: 856 | code : str, mandatory 857 | The ISO639 language code will be given to retrieve the language name. Default choice is "tam". 858 | Returns: 859 | str: The name of the language with the specified language code (ISO639) will be returned in a string format. 860 | 861 | Examples: 862 | -------- 863 | >>> pyetho.language_code_to_language("tam") 864 | 'Tamil' 865 | >>> pyetho.language_code_to_language("eng") 866 | 'English' 867 | """ 868 | for i in data.keys(): 869 | for j in data[i]["languages"]: 870 | a=[] 871 | a.append(data[i]["languages"][j]["language_code(ISO639)"]) 872 | for k in a: 873 | if (code == k): 874 |         return j 875 | 876 | def continent_names(): 877 | """ 878 | Returns a list of all the continents in the world. 879 | 880 | Returns: 881 | list: A continent names of all over the world in a list format. 882 | 883 | Examples 884 | -------- 885 | >>> pyetho.continent_names() 886 | Africa 887 | Asia 888 | Australia 889 | Europe 890 | North America 891 | South America 892 | Antarctica 893 | """ 894 | l = ['Africa','Asia','Australia','Europe','North America','South America','Antarctica'] 895 | for i in l: 896 | print(i) 897 | --------------------------------------------------------------------------------