Etymology prefixes: we should first replace *long* prefixes #2624
Labels
No labels
Android-shell
awaiting feedback
awaiting fix confirmation
bug
enhancement
Help Wanted
high-priority
huge
low-priority
Meta
NLNet
OSOC21:Cycling-OVL
Performance
question
search-ui-enhancement
Studio
Tailwind
Themes
UI
upstream-issue
usertest
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MapComplete/MapComplete#2624
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I noticed that, when an Italian street is called "Viale XYZ" (example: "Viale Marebello"), then the prefix "Viale" is not omitted correctly.
The "le" part remains by mistake.
The same mistake happens with "Piazzale". The prefix "Piazzale" is never removed correctly and "le" always remains.
Exploration
If I understand correctly, the dataset of prefixes is already OK, since it already includes "Viale" and "Piazzale":
"viale","piazzale",So, I think the problem is in the string replacer:
https://source.mapcomplete.org/MapComplete/MapComplete/src/branch/develop/src/UI/InputElement/Validators/WikidataValidator.ts#L156
This replaces strings by order of appearance in the array. Note that "Via" is listed before "Viale", so "Via" is replaced first, leaving the wrong remaining "le".
Proposal
In
WikidataValidator.removePostAndPrefixes()we can manipulate the input argumentsprefixesToRemoveandpostfixesToRemoveto sort their values by string length, so that the longest strings are at the beginning of the array, so that the problems of intermediate sub-strings are solved.P.S.
In the next months I think I will not produce a working patch in Typescript. Thanks in advance for any comment / patch :) Hoping my troubleshooting was enough precise.
(Thank you for such beautiful and useful project <3)
Etymology prefixes: we should first replace *short* prefixesto Etymology prefixes: we should first replace *long* prefixesHey,
Thanks for the super-detailed bug report! It made it super-easy to fix.