Skip to content

Commit

Permalink
Merge pull request #4 from INGEOTEC/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
mgraffg authored Jun 5, 2024
2 parents 736da47 + 8e114c4 commit 23e4cff
Show file tree
Hide file tree
Showing 21 changed files with 612 additions and 2,243 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: test
auto-update-conda: true
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,5 @@ cython_debug/
#.idea/

/.quarto/
/_site/
/_site/
.vscode/settings.json
2 changes: 1 addition & 1 deletion dialectid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

version = '0.0.1'
__version__ = '0.0.1'
21 changes: 21 additions & 0 deletions dialectid/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# MIT License

# Copyright (c) 2024 Eric Sadit Tellez Avila, Daniela Alejandra Moctezuma Ochoa, Luis Guillermo Ruiz Velazquez, Mario Graff Guerrero

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
56 changes: 56 additions & 0 deletions dialectid/tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# MIT License

# Copyright (c) 2024 Eric Sadit Tellez Avila, Daniela Alejandra Moctezuma Ochoa, Luis Guillermo Ruiz Velazquez, Mario Graff Guerrero

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# https://www.cia.gov/the-world-factbook/about/archives/2021/field/languages/

from dialectid import utils


def test_countries():
"""Test countries"""

es = utils.COUNTRIES['es']
assert 'es' in es and 'mx' in es
en = utils.COUNTRIES['en']
assert 'us' in en and 'zw' in en
ar = utils.COUNTRIES['ar']
assert 'ye' in ar and 'so' in ar
de = utils.COUNTRIES['de']
assert 'de' in de and 'ch' in de
for lang in ['ca', 'hi', 'in',
'it', 'ja', 'ko',
'pl', 'tl']:
assert lang in utils.COUNTRIES
_ = utils.COUNTRIES[lang]
assert len(_) == 1
pt = utils.COUNTRIES['pt']
assert 'br' in pt and 'pt' in pt
ru = utils.COUNTRIES['ru']
assert 'ru' in ru and 'kz' in ru
tr = utils.COUNTRIES['tr']
assert 'cy' in tr
zh = utils.COUNTRIES['zh']
assert 'cn' in zh and 'tw' in zh
for k, v in utils.COUNTRIES.items():
assert len(k) == 2
for i in v:
assert len(i) == 2

95 changes: 95 additions & 0 deletions dialectid/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# MIT License

# Copyright (c) 2024 Eric Sadit Tellez Avila, Daniela Alejandra Moctezuma Ochoa, Luis Guillermo Ruiz Velazquez, Mario Graff Guerrero

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# https://www.cia.gov/the-world-factbook/about/archives/2021/field/languages/


COUNTRIES = {'es':['mx', 'cl', 'es', # Mexico (MX), Chile (CL), Spain (ES)
'ar', 'co', 'pe', # Argentina (AR), Colombia (CO), Peru (PE)
've', 'do', 'py', # Venezuela (VE), Dominican Republic (DO), Paraguay (PY)
'ec', 'uy', 'cr', # Ecuador (EC), Uruguay (UY), Costa Rica (CR)
'sv', 'pa', 'gt', # El Salvador (SV), Panama (PA), Guatemala (GT)
'hn', 'ni', 'bo', # Honduras (HN), Nicaragua (NI), Bolivia (BO)
'cu', 'gq', # Cuba (CU), Equatorial Guinea
],
'en':['ai', 'ag', 'au', # Anguilla, Antigua and Barbuda, Australia
'bs', 'bb', 'bz', # Bahamas, Barbados, Belize
'bm', 'vg', 'cm', # Bermuda, British Virgin Islands, Cameroon
'ca', 'ky', 'ck', # Canada, Cayman Islands, Cook Islands
'dm', 'sz', 'fk', # Dominica, Eswatini, Falkland Islands
'fj', 'gm', 'gh', # Fiji, Gambia, Ghana
'gi', 'gd', 'gu', # Gibraltar, Grenada, Guam
'gg', 'gy', 'in', # Guernsey, Guyana, India
'ie', 'im', 'jm', # Ireland, Isle of Man, Jamaica
'ke', 'ls', 'lr', # Kenya, Lesotho, Liberia
'mw', 'mt', 'mu', # Malawi, Malta, Mauritius
'fm', 'na', 'nz', # Micronesia, Namibia, New Zealand
'ng', 'mp', 'pk', # Nigeria, Northern Mariana Islands, Pakistan
'pw', 'pg', 'ph', # Palau, Papua New Guinea, Philippines
'rw', 'sh', 'kn', # Rwanda, Saint Helena, Ascension, and Tristan da Cunha, Saint Kitts and Nevis
'lc', 'vc', 'sl', # Saint Lucia, Saint Vincent and the Grenadines, Sierra Leone
'sg', 'sx', 'sb', # Singapore, Sint Maarten, Solomon Islands
'za', 'sd', 'to', # South Africa, Sudan, Tonga
'tt', 'tc', 'ug', # Trinidad y Tobago, Turks and Caicos Islands, Uganda
'gb', 'us', 'vu', # United Kingdom, United States, Vanuatu
'vg', 'vi', 'zm', # Virgin Islands (GB), Virgin Islands (US), Zambia
'zw' # Zimbabwe
],
'ar':['dz', 'bh', 'td', # Algeria, Bahrain, Chad
'dj', 'eg', 'iq', # Djibouti, Egypt, Iraq
'jo', 'kw', 'lb', # Jordan, Kuwait, Lebanon,
'ly', 'mr', 'ma', # Libya, Mauritania, Morocco
'om', 'qa', 'sa', # Oman, Qatar, Saudi Arabia
'so', 'sd', 'sy', # Somalia, Sudan, Syria
'tn', 'ae', 'ye' # Tunisia, United Arab Emirates, Yemen
],
'ca':['es'], # Spain
'de':['at', 'de', 'ch'], # Austria, Germany, Switzerland
'fr':['be', 'bj', 'bf', # Belgium, Benin, Burkina Faso
'cm', 'ca', 'cf', # Cameroon, Canada, Central African Republic
'td', 'km', 'cd', # Chad, Comoros, Congo (Republic)
'cg', 'cl', 'dj', # Congo, Cote d'lvoire, Djibouti
'fr', 'pf', 'ga', # France, French Polynesia, Gabon
'gn', 'ht', 'lu', # Guinea, Haiti, Luxembourg
'ml', 'mc', 'nc', # Mali, Monaco, New Caledonia
'ne', 'rw', 'sn', # Niger, Rwanda, Senegal
'ch', 'tg' # Switzerland, Togo
],
'hi':['in'], # India
'in':['id'], # Indonesia
'it':['it'], # Italy
'ja':['jp'], # Japan
'ko':['kr'], # Korea
'nl':['be', 'nl'], # Belgium, Netherlands
'pl':['pl'], # Poland
'pt':['ao', 'br', 'cv', # Angola, Brazil, Cabo Verde
'mz', 'pt' # Mozambique, Portugal
],
'ru':['by', 'kz', 'kg', # Belarus, Kazakhstan, Kyrgyzstan
'ru' # Russian
],
'tl':['ph'], # Philippines
'tr':['cy', 'tr'], # Cyprus, Turkey
'zh':['cn', 'sg', 'hk', # China, Singapore, Hong Kong
'tw' # Taiwan
]
}

5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ dependencies = [
dynamic = ['version']

[tool.setuptools.dynamic]
version = {attr = 'dialectid.__version__'}
version = {attr = 'dialectid.__version__'}

[tool.setuptools]
packages = ['dialectid', 'dialectid.tests']
Loading

0 comments on commit 23e4cff

Please sign in to comment.