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

Fix Tanzania: add the script for the Swahili language #2421

Merged
merged 2 commits into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/languages.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
'sr': ['Cyrillic'],
'sr-Latn': [u'[A-Za-zČĆĐŠŽčćđšž]'],
'sv': ['Latin'],
'sw': ['Latin'],
'ta': ['Tamil'],
'tg': ['Arabic', 'Cyrillic'],
'th': ['Thai'],
Expand Down
19 changes: 19 additions & 0 deletions osmose_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2167,6 +2167,25 @@ def test_analysersExist(self):
f = "analyser_" + a + ".py"
assert f in analyser_files, "Not found: {0}".format(f)

def test_countrycode(self):
# Ensure country codes are uppercase and two letters (before any "-")
countries = list(map(lambda c: c.analyser_options.get("country"), config.values()))
assert [] == list(filter(lambda d: d is not None and len(d.split("-", 1)[0]) != 2, countries))
assert [] == list(filter(lambda d: d is not None and d != d.upper(), countries))

def test_languages(self):
# Ensure languages are lowercase and mapped to a script
from modules.languages import language2scripts
languages = []
for lang in list(map(lambda c: c.analyser_options.get("language"), config.values())):
if isinstance(lang, list):
languages.extend(lang)
elif lang is not None:
languages.append(lang)

assert set() == set(filter(lambda d: d[:2] != d[:2].lower(), languages))
assert set() == set(filter(lambda d: d not in language2scripts, languages))

if __name__ == "__main__":

import json
Expand Down
1 change: 1 addition & 0 deletions plugins/Name_Script.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def init(self, logger):
for language in languages:
if not self.lang[language]:
languages = None
break

# Build default regex
if languages:
Expand Down
Loading