Skip to content

Commit

Permalink
testing more
Browse files Browse the repository at this point in the history
  • Loading branch information
nvmbrasserie committed Jan 20, 2025
1 parent dca5483 commit f30a1b3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
3 changes: 3 additions & 0 deletions fingerprints/data/types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,7 @@ company_types:
- société anonyme
- société par actions de régime fédéral
- société par actions par loi sur les sociétés par actions
- société par actions
- spółka akcyjna
- SPÓŁKA AKCYJNA
- شركة خفية الإسم
Expand Down Expand Up @@ -1352,6 +1353,8 @@ company_types:
- государственного унитарного предприятия
- гп
- державного унітарного підприємства
- державне унітарне підприємство
- федеральне державне унітарне підприємство
- унитарное предприятие
- унітарнае прадпрыемства
- уп
Expand Down
25 changes: 15 additions & 10 deletions tools/stmt_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,25 @@ def load_replacers() -> Dict[str, Replacer]:

def transform_row(
replacers: Dict[str, Replacer], stmt: Dict[str, str]
) -> Dict[str, str]:
) -> Optional[Dict[str, str]]:
name = stmt["value"]
display_name = display_norm(name)
display_out = replacers["display"](display_name)

compare_name = compare_norm(name)
compare_out = replacers["compare"](compare_name)

return {
"name": name,
"lang": stmt["lang"],
"display": display_out,
"compare": compare_out,
"entity": stmt["entity_id"],
}
# Testing mode
if display_name == display_out and compare_name == compare_out:
# If both the display and compare outputs are the same as original, indicate that it's unadjusted
return {
"name": name,
"lang": stmt["lang"],
"display": display_out,
"compare": compare_out,
"entity": stmt["entity_id"],
}
# If there's any change, return None to indicate this row has been adjusted
return None


@click.command()
Expand Down Expand Up @@ -134,7 +138,8 @@ def parse(stmt_csv: Path, out_csv: Path):
if stmt["prop_type"] != "name":
continue
out = transform_row(replacers, stmt)
writer.writerow(out)
if out is not None:
writer.writerow(out)


if __name__ == "__main__":
Expand Down

0 comments on commit f30a1b3

Please sign in to comment.