Skip to content

Conversation

@anqixxx
Copy link
Contributor

@anqixxx anqixxx commented Aug 13, 2025

Refactoring of nominatim_api to integrate transliteration, whilst refactoring localization, and adding optional dependencies for said transliteration.

  • Refactored code for better readability and modularity, adding a new ABC for locales that encapsulates the old logic (localizer) and new transliteration logic (transliterator)
  • Added transliteration support, including Latin transliteration, and integrated it into the library through transliterator
  • Transliteration library is "plug and play", allowing users to add their customized transliteration to a non-latin language through class functions
  • Migrated country and language data to the nominatim_api for improved localization, with additional language information contained in data/languages.yaml
  • Wrote unit tests with actual result objects for testing of new TransliterateLocales
  • Integrated YAML configuration for language normalization and updated dependency management
  • Improved handling of optional dependencies and added GitHub workflows for testing them.

@anqixxx anqixxx force-pushed the transliterate-refactor branch from 9c231c1 to 67457fc Compare August 13, 2025 13:46
@anqixxx
Copy link
Contributor Author

anqixxx commented Aug 14, 2025

Is there a way to add the new Python libraries as dependencies to github? I.e. https://pypi.org/project/cantonese-romanisation/ and https://pypi.org/project/Unidecode/ and https://pypi.org/project/OpenCC/

@lonvia
Copy link
Member

lonvia commented Aug 14, 2025

You need to add them in the package description.

Copy link
Member

@lonvia lonvia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added comments for the changes we discussed at the last meeting so that they are not forgotten and added some small nitpicking style comments.


# Nothing? Return any of the other names as a default.
return next(iter(names.values()))
return (next(iter(names.values())), "default")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to do the same partition trick here. The random choice of names can still contain a name tag.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code I believe is what is currently in the master branch! This was the logic used before, so I thought that this avoided the name tag issue, since the default is normally tag-less

def display_name(self, names: Optional[Mapping[str, str]]) -> str:

@anqixxx anqixxx force-pushed the transliterate-refactor branch 2 times, most recently from 431b6f2 to ea2efca Compare August 27, 2025 16:04
@anqixxx anqixxx changed the title Transliterate refactor WIP Refactoring Locales to Include Transliteration Aug 27, 2025
@anqixxx anqixxx changed the title Refactoring Locales to Include Transliteration Transliteration Locales Refactor Aug 27, 2025
@anqixxx anqixxx force-pushed the transliterate-refactor branch 2 times, most recently from 31891d4 to 4687d92 Compare August 27, 2025 16:14
@anqixxx anqixxx changed the title Transliteration Locales Refactor Integrating transliteration into Locales with ABC refactoring Aug 27, 2025
@anqixxx anqixxx force-pushed the transliterate-refactor branch from 38c60b6 to b8bdaf8 Compare August 28, 2025 15:42
- Refactored code for better readability and modularity, adding a new ABC for locales
- Added transliteration support, including Latin transliteration, and integrated it into the library
- Migrated country and language data to the nominatim_api for improved localization
- Rewrote tests to use actual result objects instead of mocks
- Integrated YAML configuration for language normalization and updated dependency management
- Improved handling of optional dependencies and added GitHub workflows for testing them

first pass in adding transliteration, still issues with searching Dandong

Minor issue, realized also I need to add mock information about the Dandong database in order to test

mypy fixed

Testing

linting fix

Made from_accept_languages an abstract class, make display name and display name locale defined in base

Changed from global to attribute, removed mock search

updated .toml for dependenies

fixed issue with display name with locales

renaming and adding lang info file

linting issues

integrated yaml reading from config

fixed issue with test normalization

removed old locales class

tried to add localize and localize results as abstract methods, had to change signature

refactored code a bit, rewrote test to use actual result object not just mock

restructured code for readablity, added a latin transliterator, however tests are failing on github that are not failing locally

fixed mypy issues with base.py

integrated latin transliteration for cleaner code

made some comments better

reverted back to original git ignore

Dict to mapping change

Double quotes to single quotes

data country and language migration to api

added optional dependencies

add optional dependencies

better job at optional imports

lint

Added data information in init

Added more dependencies to fix import issue

Trying to fix import

Revert server glue

Added fix for linter than is not on local machine

Lint

fighting linter

added git workflow for optional dependencies

trying agfain for optional

linting again:(

optional dependencies github again

trying to fix opt dependencies 24

opt dep again

lint

reverted data country info

removed wrong get
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants