Comments (8)
Please note that HashMap.put(K,V) documentation says:
If the map previously contained a mapping for the key, the old value is replaced.
from osmand.
We don't use now more than 1 value. So this is an issue for now
from osmand.
Actually there is legitimate need for duplicate keys for supporting common aliases. This intent by developers can be observed in specialphrases_en.txt, which contains 82 duplicated keys, eg:
gym,Fitness Centre
gym,Fitness Center
gym,Gym
to accomodate for various aliases that are used in the POI list to make it prettier (show "Some Fitness Center" instead of "Gym Some Fitness Center"), but still show it with POI type if some alias is not included in the name already ("Gym Some").
from osmand.
The duplicate keys are included in the text file, for when it's needed to have a map in the reverse order (phrase -> key). This can be useful for full-text search, or for the thing you says.
But as natural text search isn't implemented yet, I didn't include code to create that map, as it would most likely appear to be useless anyway.
For your advantage, I don't know if it's needed. I just filtered the text so it wouldn't repeat itself (as the comment in the code says, "backery backery the Corner" looks very silly), but I don't see a problem with synonyms. To me, "Gym Quality Fitness Centre" looks fine.
Of course, if you don't agree, you have the code, so you can make a map in the other direction to solve your issue.
from osmand.
I just wanted to see some consensus before starting to fix it.
My proposals:
- OsmAndFormatter.getPoiStringWithoutType() should look for included string case insensitive (english commonly uses capitalized all words in names, while in other languages only the first letter of the first word in the name, to avoid "Bakery Some bakery")
- key in specialphrases should be composed of both type and subtype (to address weird current
"yes" -> "Building"
mapping and expand it with"building.yes" -> "Building"
,"office.yes"->"Office"
,"bridge.yes" -> "Bridge"
,"tunnel.yes"-> "Tunnel"
), with fallback on just subtype (so we don't need to fix all specialphrase files) - Change HashMap in SpecialPhrases from
m = new HashMap<String, String>();
tom = new HashMap<String, List<String>>();
to support a variable number of aliases and use them accordingly. For the previously mentioned full text search the same specialphrases files will need to be read into different structure to provide effective reverse mapping alias -> [type.]subtype.
Opinions, objections, other ideas, better proposals?
from osmand.
What do you mean by "and use them accordingly", how will you choose wich alias to use?
from osmand.
- I agree with the capitalisation issue, but that's not related to this
- Take a look at this script: https://github.com/osmandapp/Osmand/blob/master/OsmAnd/scripts/generate.sh it parses the wiki pages to make those txt files. So you can include the key too if you want. I just don't immediately see how you can solve that building issue. But I don't know what you want to do exactly. OsmAnd is defining the type from the value, and those *=yes things are not indexed as far as I know.
- Changing the hashmap is indeed a trivial change, and won't break anything as the hashmap is never accessed directly outside that class.
from osmand.
What do you mean by "and use them accordingly", how will you choose wich alias to use?
Show the first one (aliases.get(0)
) unless any alias from the list of aliases is already included (case insensitively) in the name.
For backward compatibility adding to the list should be always done at the beginning aliases.add(0, alias)
, so that the last mentioned alias in file will be used.
from osmand.
Related Issues (20)
- Unnecessary detour in pedestrian navigation HOT 6
- Abnormal work of Attach to the roads HOT 6
- Custom bicycle routing different speed on different hills HOT 3
- Add maximum level of slope to a routing parameters
- Add UNESCO POIs HOT 2
- Speedometer using external sensor value
- crash after editing a track HOT 2
- Closed bridge HOT 5
- Wrong turn indication in lanes widget HOT 1
- True and magnetic bearings in route planning
- Displaying true and magnetic bearing on the widget the radius of the ruler
- Osmand gets really slow and crashes at max zoom level HOT 4
- Android app crashes HOT 7
- OpenStreetMap editor plugin failed to login HOT 3
- Consolidate map names HOT 1
- Please Add "NEW IN VERSION" header to F-Droid Store Listing HOT 3
- Dynamic waypoint/favourite name setting HOT 1
- Osm in jetpack compose
- Include Hash of .apk App Signing Key in README
- Distance between two points HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from osmand.