User:SafwatHalaby/scripts/nameCopy

From OpenStreetMap Wiki
Jump to navigation Jump to search

Israel is multilingual and getting name tag consistency is tricky. This script helps with that. It copies name to name:en, name:he, or name:ar when it does not exist already.

Script pages:

This script is part of my scripting project. (Click for contact details, other scripts, overview, etc.).

Overview

The goal

  • To make sure everything in Israel has both name and name:lang as agreed upon in the IL wiki.
  • To fix inconsistent name tags, editing mistakes, and sometimes vandalism, by manually scanning the warning logs created by the script. The script creates warnings when some name tags don't make sense.

Detected errors

Some errors require human attention. Click here for a list.

Changesets

History

v5

v4

v3

  • #52025378 - 14/09/2017 - 542 name copies: Copied missing name tags and fixed whitespace.
  • #50520193 - 24/07/2017 - 429 name copies: Copied missing name tags and fixed whitespace.
  • Previous change was reverted
  • #50233725 - 12/07/2017 - 45 name copies, 372 autofixes: Copied missing name tags and fixed whitespace. Autofixed some name tags.

v2

  • #50137827 - 08/07/2017 - 124 names copies: Copied missing name tags and fixed whitespace.
  • #49881298 - 28/06/2017 - 50 names copies: Copied missing name tags and fixed whitespace.
  • #49768266 - 23/06/2017 - 77 names copies: Copied missing name tags and fixed whitespace.
  • #49674056 - 19/06/2017 - 356 name copies: Copied missing name tags and fixed whitespace.
  • #49548816 - 15/06/2017 - 9362 name copies: Copied missing name tags and fixed whitespace - Southern District pt. 2, and Area C
  • #49475143 - 12/06/2017 - 6626 name copies: Copied missing name tags and fixed whitespace - Jerusalem District
  • #49412690 - 10/06/2017 - 5479 name copies: Copied missing name tags and fixed whitespace - Southern District
  • #49299149 - 06/06/2017 - 5967 name copies: Copied missing name tags and fixed whitespace - Tel Aviv District
  • #49294617 - 06/06/2017 - 11076 name copies: Copied missing name tags and fixed whitespace - Central District

v1

  • #49225264 - 03/06/2017 - 5658 changes: Copied missing name tags - Haifa District
  • #49223571 - 03/06/2017 - 9828 changes: Copied missing name tags - Northern District
  • #49171684 - 01/06/2017 - 115 changes: Copied missing name tags (limited test in Dalia)

Other

  • #49031645 - 27/05/2017 - 607 changes: Copied name tag from "name:he" or "name:ar" in Israel (This was a much less ambitious edit with a trivial algorithm: when name:he or name:ar was the only name tag, it was copied to name.)

The algorithm

only he,ar,en names are analyzed.

For each POI:

  • If name exists, deduce language, if name:lang doesn't exist for that language, copy name to name:lang.

Exceptions

The following are possible exceptions and how they're handled.

  • name,name:lang mismatch (these two have the same language, but mismatched value) - fixme tag is added. Node skipped.
  • name is not ar,he,en - skipped

History

v5 no longer copies name:lang to name, ever.

v4 fixes a bug where names like "123" are copied from name to name:en. v4 also adds a "fixme" tag to obvious errors.

v3 had an experimental mismatch autofix function that was never used. Effectively making it identical to v2.

The exceptions were changed a couple of times in SafwatHalaby_nameCopy2.

name:en' No longer copied to name since SafwatHalaby_nameCopy2. Let humans decide whether a translation exists or if it's a good idea to copy English.

Extra

The script fixes obvious whitespace issues in any tag. This doesn't guarantee perfect whitespace all across Israel; the fix is only applied opportunistically to the nodes being checked for name issues.