Skip to content

Commit

Permalink
Removed unused code copied from other file
Browse files Browse the repository at this point in the history
  • Loading branch information
yanone committed Dec 8, 2023
1 parent 952cfd5 commit 87c48b8
Showing 1 changed file with 0 additions and 112 deletions.
112 changes: 0 additions & 112 deletions scripts/sg-bulk-builder-arabic.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,118 +49,6 @@ def create_file(profile_name):
return profile


def collect(lang):
exemplar_chars = lang.get("exemplarChars", {})
marks = exemplar_chars.get("marks", "").replace("◌", "").split() or []
bases = exemplar_chars.get("base", "").split() or []
auxiliary = exemplar_chars.get("auxiliary", "").split() or []
return (bases, auxiliary, marks)


def build_orthographies(bases, auxiliary):
ortho_string = ""
orth_smcp_test = []

if bases:
ortho_string = "".join(bases)
if auxiliary:
ortho_string = ortho_string.join(auxiliary)

if ortho_string:
orth_smcp_test = {
"check": "orthographies",
"input": {"text": ortho_string, "features": {"smcp": True}},
"conditions": {"features": ['smcp']},
}
return orth_smcp_test


def build_no_orphaned_marks(bases, auxiliary):
basemarks = []
nom_test = []
nom_smcp_test = []
new_basemarks = []
for base in bases:
if len(base) > 1:
unpack = base.replace("{", "").replace("}", "")
for char in unpack:
if unicodedata.combining(char):
basemarks.append(unpack)
for aux in auxiliary:
if len(aux) > 1:
unpack = aux.replace("{", "").replace("}", "")
for char in unpack:
if unicodedata.combining(char):
basemarks.append(unpack)
basemark_string = "".join(basemarks)
if basemark_string:
nom_test = {"check": "no_orphaned_marks", "input": {"text": basemark_string}}
nom_smcp_test = {
"check": "no_orphaned_marks",
"input": {"text": basemark_string, "features": {"smcp": True}},
"conditions": {"features": ['smcp']},
}
return (nom_test, nom_smcp_test)


def check_ot_tags(
tag,
): # to be used for unencoded glyph variant check may not be needed
for ot_tag in ot_tags:
if tag in ot_tag['codes']:
return True
else:
return False


def build_unencoded_variants(
record, bases, auxiliary
): # to be used for unencoded glyph variant check
uv_test = []
if record.get("exemplarChars"):
if "Ŋ" in bases or 'Ŋ' in auxiliary:
uv_test = {"check": "unencoded_variants", "input": {"text": 'Ŋ'}}
if record.get("language") == "tod":
uv_test = {"check": "unencoded_variants", "input": {"text": 'ʋ'}}
uv_test = {"check": "unencoded_variants", "input": {"text": 'Ʋ'}}
if (
record.get("language") == "xpe"
or record.get("language") == "lom"
or record.get("language") == "dnj"
):
uv_test = {"check": "unencoded_variants", "input": {"text": 'Ɓ'}}
if record.get("language") == "gaa":
uv_test = {"check": "unencoded_variants", "input": {"text": 'Ʃ'}}
uv_test = {"check": "unencoded_variants", "input": {"text": 'Ʒ'}}

return uv_test


def build_sd_smcp(bases, auxiliary):
sd_smcp_collection = []
for base in bases:
sd_smcp_test = []
if len(base) == 1 and unicodedata.category(base) == 'Ll':
sd_smcp_test = {
'check': 'shaping_differs',
'inputs': [{'text': base}, {'text': base, 'features': {'smcp': True}}],
'conditions': {'features': ['smcp']},
'rationale': "Requires Small-cap: " + base,
}
sd_smcp_collection.append(sd_smcp_test)
for aux in auxiliary:
sd_smcp_test = []
if len(aux) == 1 and unicodedata.category(aux) == 'Ll':
sd_smcp_test = {
'check': 'shaping_differs',
'inputs': [{'text': aux}, {'text': aux, 'features': {'smcp': True}}],
'conditions': {'features': ['smcp']},
'rationale': "Requires Small-cap: " + aux,
}
sd_smcp_collection.append(sd_smcp_test)
return sd_smcp_collection


def build_results(item, new_profile):
current_script = item
profile_name = '%s.yaml' % item
Expand Down

0 comments on commit 87c48b8

Please sign in to comment.